]> git.0d.be Git - empathy.git/blob - tests/interactive/test-empathy-calendar-button.c
Merge remote-tracking branch 'origin/gnome-3-8'
[empathy.git] / tests / interactive / test-empathy-calendar-button.c
1 /*
2  * Copyright (C) 2012 Collabora Ltd.
3  *
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.
8  *
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.
13  *
14  * You should have received a copy of the GNU General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  *
19  * Authors: Danielle Madeley <danielle.madeley@collabora.co.uk>
20  */
21
22 #include "config.h"
23
24 #include "empathy-calendar-button.h"
25
26 static void
27 date_changed_cb (EmpathyCalendarButton *button,
28     GDate *date,
29     gpointer user_data)
30 {
31   if (date == NULL)
32     {
33       g_print ("date changed: none\n");
34     }
35   else
36     {
37       gchar buffer[128];
38
39       g_date_strftime (buffer, 128, "%x", date);
40       g_print ("date changed: %s\n", buffer);
41     }
42 }
43
44 int
45 main (int argc,
46     char **argv)
47 {
48   GtkWidget *win, *button;
49   GDate *date;
50
51   gtk_init (&argc, &argv);
52
53   win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
54
55   g_signal_connect_swapped (win, "destroy",
56       G_CALLBACK (gtk_main_quit), NULL);
57
58   button = empathy_calendar_button_new ();
59
60   date = g_date_new_dmy (30, 11, 1984);
61   empathy_calendar_button_set_date (EMPATHY_CALENDAR_BUTTON (button), date);
62   g_date_free (date);
63
64   g_signal_connect (button, "date-changed",
65       G_CALLBACK (date_changed_cb), NULL);
66
67   gtk_container_add (GTK_CONTAINER (win), button);
68   gtk_widget_show_all (win);
69
70   gtk_main ();
71   return 0;
72 }