Help: Use stable 'if' namespace instead of experimental
[empathy-mirror.git] / tests / interactive / test-empathy-calendar-button.c
blobfb94303f4528aaa1334992ce726f4b1c87c8292a
1 /*
2 * Copyright (C) 2012 Collabora Ltd.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 * Authors: Danielle Madeley <danielle.madeley@collabora.co.uk>
21 #include "config.h"
23 #include <tp-account-widgets/tpaw-calendar-button.h>
25 static void
26 date_changed_cb (TpawCalendarButton *button,
27 GDate *date,
28 gpointer user_data)
30 if (date == NULL)
32 g_print ("date changed: none\n");
34 else
36 gchar buffer[128];
38 g_date_strftime (buffer, 128, "%x", date);
39 g_print ("date changed: %s\n", buffer);
43 int
44 main (int argc,
45 char **argv)
47 GtkWidget *win, *button;
48 GDate *date;
50 gtk_init (&argc, &argv);
52 win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
54 g_signal_connect_swapped (win, "destroy",
55 G_CALLBACK (gtk_main_quit), NULL);
57 button = tpaw_calendar_button_new ();
59 date = g_date_new_dmy (30, 11, 1984);
60 tpaw_calendar_button_set_date (TPAW_CALENDAR_BUTTON (button), date);
61 g_date_free (date);
63 g_signal_connect (button, "date-changed",
64 G_CALLBACK (date_changed_cb), NULL);
66 gtk_container_add (GTK_CONTAINER (win), button);
67 gtk_widget_show_all (win);
69 gtk_main ();
70 return 0;