[Goodies-commits] r7586 - in xfce4-weather-plugin/trunk: . panel-plugin

Colin Leroy colin at xfce.org
Tue Jun 16 09:00:59 CEST 2009


Author: colin
Date: 2009-06-16 07:00:59 +0000 (Tue, 16 Jun 2009)
New Revision: 7586

Modified:
   xfce4-weather-plugin/trunk/ChangeLog
   xfce4-weather-plugin/trunk/panel-plugin/weather.c
Log:
2009-06-16	Colin Leroy <colin at colino.net>

	* panel-plugin/weather.c: Add a Forecast menu item for completeness.



Modified: xfce4-weather-plugin/trunk/ChangeLog
===================================================================
--- xfce4-weather-plugin/trunk/ChangeLog	2009-06-16 06:39:42 UTC (rev 7585)
+++ xfce4-weather-plugin/trunk/ChangeLog	2009-06-16 07:00:59 UTC (rev 7586)
@@ -1,5 +1,9 @@
 2009-06-16	Colin Leroy <colin at colino.net>
 
+	* panel-plugin/weather.c: Add a Forecast menu item for completeness.
+
+2009-06-16	Colin Leroy <colin at colino.net>
+
 	* icons/liquid/*: Fix bug #4641, "Unreadable icons". Fix the fog icon, 
 	and also fix a few mismatches.
 

Modified: xfce4-weather-plugin/trunk/panel-plugin/weather.c
===================================================================
--- xfce4-weather-plugin/trunk/panel-plugin/weather.c	2009-06-16 06:39:42 UTC (rev 7585)
+++ xfce4-weather-plugin/trunk/panel-plugin/weather.c	2009-06-16 07:00:59 UTC (rev 7586)
@@ -591,6 +591,28 @@
 
 
 
+static void
+forecast_click (GtkWidget *widget,
+          gpointer   user_data)
+{
+  xfceweather_data *data = (xfceweather_data *) user_data;
+
+  if (data->summary_window != NULL)
+    {
+
+      gtk_window_present (GTK_WINDOW (data->summary_window));
+    }
+  else
+    {
+      data->summary_window = create_summary_window (data->weatherdata,
+                                                    data->unit);
+      g_signal_connect (G_OBJECT (data->summary_window), "destroy",
+                	G_CALLBACK (close_summary), data);
+
+      gtk_widget_show_all (data->summary_window);
+    }
+}
+
 static gboolean
 cb_click (GtkWidget      *widget,
           GdkEventButton *event,
@@ -600,21 +622,7 @@
 
   if (event->button == 1)
     {
-
-      if (data->summary_window != NULL)
-        {
-
-          gtk_window_present (GTK_WINDOW (data->summary_window));
-        }
-      else
-        {
-          data->summary_window = create_summary_window (data->weatherdata,
-                                                        data->unit);
-          g_signal_connect (G_OBJECT (data->summary_window), "destroy",
-                            G_CALLBACK (close_summary), data);
-
-          gtk_widget_show_all (data->summary_window);
-        }
+      forecast_click(widget, user_data);
     }
   else if (event->button == 2)
     {
@@ -624,8 +632,6 @@
   return FALSE;
 }
 
-
-
 static void
 mi_click (GtkWidget *widget,
           gpointer   user_data)
@@ -741,7 +747,7 @@
 xfceweather_create_control (XfcePanelPlugin *plugin)
 {
   xfceweather_data *data = panel_slice_new0 (xfceweather_data);
-  GtkWidget        *refresh;
+  GtkWidget        *refresh, *forecast;
   datas             lbl;
   GdkPixbuf        *icon = NULL;
 
@@ -798,6 +804,20 @@
 
   xfce_panel_plugin_menu_insert_item (plugin, GTK_MENU_ITEM (refresh));
 
+  /* add refresh button to right click menu, for people who missed the middle mouse click feature */
+  forecast = gtk_image_menu_item_new_with_mnemonic (_("_Forecast"));
+  icon = get_icon ("32", 16);
+  gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(forecast),
+  	gtk_image_new_from_pixbuf(icon));
+  if (G_LIKELY (icon))
+    g_object_unref (G_OBJECT (icon));
+  gtk_widget_show (forecast);
+
+  g_signal_connect (G_OBJECT (forecast), "activate",
+                    G_CALLBACK (forecast_click), data);
+
+  xfce_panel_plugin_menu_insert_item (plugin, GTK_MENU_ITEM (forecast));
+
   /* assign to tempval because g_array_append_val () is using & operator */
   lbl = TEMP;
   g_array_append_val (data->labels, lbl);




More information about the Goodies-commits mailing list