]> Pileus Git - ~andy/gtk/blobdiff - tests/testcalendar.c
Use GtkComboBox instead of GtkCombo in testsocket
[~andy/gtk] / tests / testcalendar.c
index d3cf08c83278b2e11bbb325e1f9b27ce017a3f9c..c926be317aa7c68067976691f0837dcab7916c08 100644 (file)
@@ -18,7 +18,7 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <config.h>
+#include "config.h"
 #include <stdio.h>
 #include <string.h>
 #include <gtk/gtk.h>
@@ -85,7 +85,7 @@ calendar_set_detail (CalendarData *data,
   g_hash_table_replace (data->details_table, key, detail);
 }
 
-static G_CONST_RETURN gchar*
+static gchar*
 calendar_get_detail (CalendarData *data,
                      guint         year,
                      guint         month,
@@ -98,14 +98,14 @@ calendar_get_detail (CalendarData *data,
   detail = g_hash_table_lookup (data->details_table, key);
   g_free (key);
 
-  return detail;
+  return (detail ? g_strdup (detail) : NULL);
 }
 
 static void
 calendar_update_details (CalendarData *data)
 {
   guint year, month, day;
-  const gchar *detail;
+  gchar *detail;
 
   gtk_calendar_get_date (GTK_CALENDAR (data->calendar_widget), &year, &month, &day);
   detail = calendar_get_detail (data, year, month, day);
@@ -113,6 +113,8 @@ calendar_update_details (CalendarData *data)
   g_signal_handler_block (data->details_buffer, data->details_changed);
   gtk_text_buffer_set_text (data->details_buffer, detail ? detail : "", -1);
   g_signal_handler_unblock (data->details_buffer, data->details_changed);
+
+  g_free (detail);
 }
 
 static void
@@ -257,7 +259,7 @@ void calendar_select_font (GtkWidget    *button,
        }
 }
 
-static G_CONST_RETURN gchar*
+static gchar*
 calendar_detail_cb (GtkCalendar *calendar,
                     guint        year,
                     guint        month,
@@ -677,7 +679,7 @@ create_calendar(void)
 
   gtk_container_add (GTK_CONTAINER (window), vbox);
 
-  GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+  gtk_widget_set_can_default (button, TRUE);
   gtk_widget_grab_default (button);
 
   gtk_window_set_default_size (GTK_WINDOW (window), 600, 0);