[Goodies-commits] r4814 - in xfce4-datetime-plugin/trunk: . panel-plugin

Diego Ongaro ongardie at xfce.org
Sat May 17 19:32:05 CEST 2008


Author: ongardie
Date: 2008-05-17 17:32:05 +0000 (Sat, 17 May 2008)
New Revision: 4814

Modified:
   xfce4-datetime-plugin/trunk/ChangeLog
   xfce4-datetime-plugin/trunk/panel-plugin/datetime.c
Log:
handle delete event on popup calendar (patch from Mike Massonet)


Modified: xfce4-datetime-plugin/trunk/ChangeLog
===================================================================
--- xfce4-datetime-plugin/trunk/ChangeLog	2008-05-17 17:32:02 UTC (rev 4813)
+++ xfce4-datetime-plugin/trunk/ChangeLog	2008-05-17 17:32:05 UTC (rev 4814)
@@ -1,5 +1,6 @@
 2008-05-17  Diego Ongaro <ongardie at gmail.com>
     * panel-plugin/datetime.c:
+      - handle delete event on popup calendar (patch from Mike Massonet)
       - show popup calendar on all workspaces (patch from Mike Massonet)
       - allow ctrl-click on plugin (patch from Mike Massonet)
 

Modified: xfce4-datetime-plugin/trunk/panel-plugin/datetime.c
===================================================================
--- xfce4-datetime-plugin/trunk/panel-plugin/datetime.c	2008-05-17 17:32:02 UTC (rev 4813)
+++ xfce4-datetime-plugin/trunk/panel-plugin/datetime.c	2008-05-17 17:32:05 UTC (rev 4814)
@@ -252,11 +252,17 @@
   gtk_window_move(GTK_WINDOW(widget), x, y);
 }
 
+static gboolean on_calendar_delete(GtkWidget *widget, GdkEvent *event, t_datetime *datetime)
+{
+  gtk_widget_destroy(datetime->cal);
+  datetime->cal = NULL;
+  return TRUE;
+}
 
 /*
  * call the gtk calendar
  */
-static GtkWidget * pop_calendar_window(GtkWidget *parent,
+static GtkWidget * pop_calendar_window(t_datetime *datetime,
     int orientation,
     const char *date_string)
 {
@@ -267,6 +273,7 @@
   GtkWidget *cal;
   GtkWidget *entry;
   GtkWidget *label;
+  GtkWidget *parent = datetime->eventbox;
   GdkScreen *screen;
   GtkCalendarDisplayOptions display_options;
   int num;
@@ -312,6 +319,9 @@
   g_signal_connect_after(G_OBJECT(window), "realize",
       G_CALLBACK(on_calendar_realized),
       GINT_TO_POINTER(orientation));
+  g_signal_connect(G_OBJECT(window), "delete-event",
+      G_CALLBACK(on_calendar_delete),
+      datetime);
   gtk_widget_show_all(window);
 
   return window;
@@ -343,9 +353,9 @@
     orientation = xfce_panel_plugin_get_orientation(datetime->plugin);
 
     /* draw calendar */
-    datetime->cal = pop_calendar_window(datetime->eventbox,
-	                                orientation,
-	                                gtk_label_get_text(GTK_LABEL(datetime->date_label)));
+    datetime->cal = pop_calendar_window(datetime,
+                                        orientation,
+                                        gtk_label_get_text(GTK_LABEL(datetime->date_label)));
   }
   return TRUE;
 }




More information about the Goodies-commits mailing list