rpms/gnome-applets/devel gweather-network.patch, NONE, 1.1 gnome-applets.spec, 1.248, 1.249

Matthias Clasen (mclasen) fedora-extras-commits at redhat.com
Sun Oct 21 04:18:47 UTC 2007


Author: mclasen

Update of /cvs/extras/rpms/gnome-applets/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25419

Modified Files:
	gnome-applets.spec 
Added Files:
	gweather-network.patch 
Log Message:
Update weather info when going online


gweather-network.patch:

--- NEW FILE gweather-network.patch ---
diff -up gnome-applets-2.20.0/gweather/gweather-applet.c.network gnome-applets-2.20.0/gweather/gweather-applet.c
--- gnome-applets-2.20.0/gweather/gweather-applet.c.network	2007-10-21 00:12:36.000000000 -0400
+++ gnome-applets-2.20.0/gweather/gweather-applet.c	2007-10-21 00:12:41.000000000 -0400
@@ -29,6 +29,10 @@
 #include <libnotify/notification.h>
 #endif
 
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+#include <NetworkManager/NetworkManager.h>
+
 #include "gweather.h"
 #include "gweather-about.h"
 #include "gweather-pref.h"
@@ -291,6 +295,8 @@ applet_destroy (GtkWidget *widget, GWeat
     weather_info_abort (gw_applet->gweather_info);
 }
 
+static void setup_network_monitor (GWeatherApplet *gw_applet);
+
 void gweather_applet_create (GWeatherApplet *gw_applet)
 {
     AtkObject *atk_obj;
@@ -326,7 +332,7 @@ void gweather_applet_create (GWeatherApp
     g_signal_connect (GTK_OBJECT(gw_applet->applet), "button_press_event",
                        GTK_SIGNAL_FUNC(clicked_cb), gw_applet);
     g_signal_connect (G_OBJECT(gw_applet->applet), "key_press_event",           
-			G_CALLBACK(key_press_cb), gw_applet);                    
+			G_CALLBACK(key_press_cb), gw_applet);
                      
     gtk_widget_set_tooltip_text (GTK_WIDGET(gw_applet->applet), _("GNOME Weather"));
 
@@ -356,9 +362,9 @@ void gweather_applet_create (GWeatherApp
 					  NULL);
     }
 	
-    place_widgets(gw_applet);
-  
-	return;
+    place_widgets(gw_applet);        
+
+    setup_network_monitor (gw_applet);     
 }
 
 gint timeout_cb (gpointer data)
@@ -525,3 +531,52 @@ void gweather_update (GWeatherApplet *gw
 						    update_finish, gw_applet);
     }
 }
+
+static DBusHandlerResult
+filter_func (DBusConnection *connection, DBusMessage *message, void *user_data)
+{
+    GWeatherApplet *gw_applet = user_data;
+    guint32 state = NM_DEVICE_STATE_UNKNOWN;
+
+    if (dbus_message_is_signal (message,
+                                NM_DBUS_INTERFACE_DEVICE, "StateChanged")) {
+        dbus_message_get_args (message, NULL, 
+                               DBUS_TYPE_UINT32, &state, 
+                               DBUS_TYPE_INVALID); 
+        if (state == NM_DEVICE_STATE_ACTIVATED) {
+             gweather_update (gw_applet);
+        }
+
+        return DBUS_HANDLER_RESULT_HANDLED;
+    }
+
+    return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+static void
+setup_network_monitor (GWeatherApplet *gw_applet)
+{
+    GError *error;
+    static DBusGConnection *bus = NULL;
+    DBusConnection *dbus;
+
+    if (bus == NULL) {
+        error = NULL;
+        bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+        if (bus == NULL) {
+            g_warning ("Couldn't connect to system bus: %s",
+                       error->message);
+            g_error_free (error);
+
+            return;
+        }
+
+        dbus = dbus_g_connection_get_connection (bus);	
+        dbus_connection_add_filter (dbus, filter_func, gw_applet, NULL);
+        dbus_bus_add_match (dbus,
+                            "type='signal',"
+                            "interface='" NM_DBUS_INTERFACE_DEVICE "'",
+                            NULL);
+    }
+}	
+


Index: gnome-applets.spec
===================================================================
RCS file: /cvs/extras/rpms/gnome-applets/devel/gnome-applets.spec,v
retrieving revision 1.248
retrieving revision 1.249
diff -u -r1.248 -r1.249
--- gnome-applets.spec	20 Oct 2007 03:10:24 -0000	1.248
+++ gnome-applets.spec	21 Oct 2007 04:18:14 -0000	1.249
@@ -34,7 +34,7 @@
 Summary:        Small applications for the GNOME panel
 Name:		gnome-applets
 Version:	2.20.0
-Release: 	7%{?dist}
+Release: 	8%{?dist}
 Epoch:          1
 License:	GPLv2+ and GFDL+
 Group:          User Interface/Desktops
@@ -62,17 +62,21 @@
 
 # http://bugzilla.gnome.org/show_bug.cgi?id=370937
 # Patch34:	mixer-wakeups.patch
+
+Patch34:        ppp-includes.patch
+
 # http://bugzilla.gnome.org/show_bug.cgi?id=478485 includes the above
 Patch35:	gnome-applets-2.20.0-mixer-out-of-sync.patch
 
 # http://bugzilla.gnome.org/show_bug.cgi?id=479172
 Patch36:	gweather-pc.patch
 
-Patch34:        ppp-includes.patch
-
 # fixed in upstream svn
 Patch38:	mixer-preferences-leak.patch
 
+# 
+Patch39:	gweather-network.patch
+
 BuildRequires:  glib2-devel >= %{glib2_version}
 BuildRequires:  gtk2-devel >= %{gtk2_version}
 BuildRequires:  libgnomeui-devel >= %{libgnomeui_version}
@@ -175,6 +179,7 @@
 popd
 %patch36 -p1 -b .gweather-pc
 %patch38 -p1 -b .mixer-preferences-leak
+%patch39 -p1 -b .geweather-network
 
 cp gswitchit/gswitchit-applet.png  gswitchit/gswitchit-properties-capplet.png
 
@@ -361,6 +366,9 @@
 %{_libdir}/libgweather.so
 
 %changelog
+* Sun Oct 21 2007 Matthias Clasen <mclasen at redhat.com> - 1:2.20.0-8
+- Update weather info when going online
+
 * Fri Oct 12 2007 - Bastien Nocera <bnocera at redhat.com> - 1:2.20.0-7
 - Update out-of-sync patch to handle mute properly (#320451)
 




More information about the fedora-extras-commits mailing list