rpms/gnome-applets/F-8 gweather-network.patch, NONE, 1.1 nl_langinfo.patch, NONE, 1.1 weather-abort.patch, NONE, 1.1 weather-update.patch, NONE, 1.1 gnome-applets.spec, 1.248, 1.249

Matthias Clasen (mclasen) fedora-extras-commits at redhat.com
Tue Nov 13 00:59:05 UTC 2007


Author: mclasen

Update of /cvs/extras/rpms/gnome-applets/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv916

Modified Files:
	gnome-applets.spec 
Added Files:
	gweather-network.patch nl_langinfo.patch weather-abort.patch 
	weather-update.patch 
Log Message:
Backport assorted weather applet fixes


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);
+    }
+}	
+

nl_langinfo.patch:

--- NEW FILE nl_langinfo.patch ---
diff -up gnome-applets-2.20.0/libgweather/gweather-prefs.c.nl_langinfo gnome-applets-2.20.0/libgweather/gweather-prefs.c
--- gnome-applets-2.20.0/libgweather/gweather-prefs.c.nl_langinfo	2007-10-29 12:06:59.000000000 -0400
+++ gnome-applets-2.20.0/libgweather/gweather-prefs.c	2007-10-29 12:07:42.000000000 -0400
@@ -12,6 +12,8 @@
 #  include <config.h>
 #endif
 
+#include <langinfo.h>
+
 #include <glib/gi18n-lib.h>
 #include <gconf/gconf-client.h>
 #include <libgweather/gweather-prefs.h>
@@ -57,7 +59,7 @@ static GConfEnumStringPair distance_unit
 static void parse_temp_string (const gchar *gconf_str, GWeatherPrefs *prefs)
 {
     gint value = 0;
-#ifdef _NL_MEASUREMENT_MEASUREMENT
+#ifdef HAVE__NL_MEASUREMENT_MEASUREMENT
     char *imperial = NULL;
 #endif
 	
@@ -81,7 +83,7 @@ static void parse_temp_string (const gch
         }
     }
     if (!prefs->temperature_unit || prefs->temperature_unit == TEMP_UNIT_DEFAULT ) {
-#ifdef _NL_MEASUREMENT_MEASUREMENT
+#ifdef HAVE__NL_MEASUREMENT_MEASUREMENT
         imperial = nl_langinfo(_NL_MEASUREMENT_MEASUREMENT);
         if ( imperial && imperial[0] == 2 )  {
             /* imperial */
@@ -95,7 +97,7 @@ static void parse_temp_string (const gch
 static void parse_speed_string (const gchar *gconf_str, GWeatherPrefs *prefs)
 {
     gint value = 0;
-#ifdef _NL_MEASUREMENT_MEASUREMENT
+#ifdef HAVE__NL_MEASUREMENT_MEASUREMENT
     char *imperial = NULL;
 #endif
 	
@@ -119,7 +121,7 @@ static void parse_speed_string (const gc
         }
     }
     if ( (!prefs->speed_unit) || prefs->speed_unit == SPEED_UNIT_DEFAULT ) {
-#ifdef _NL_MEASUREMENT_MEASUREMENT
+#ifdef HAVE__NL_MEASUREMENT_MEASUREMENT
         imperial = nl_langinfo(_NL_MEASUREMENT_MEASUREMENT);
         if ( imperial && imperial[0] == 2 )  {
             /* imperial */
diff -up gnome-applets-2.20.0/configure.in.nl_langinfo gnome-applets-2.20.0/configure.in
--- gnome-applets-2.20.0/configure.in.nl_langinfo	2007-10-29 12:08:28.000000000 -0400
+++ gnome-applets-2.20.0/configure.in	2007-10-29 12:09:28.000000000 -0400
@@ -647,6 +647,20 @@ case $struct_tm_tm_gmtoff in
 esac
 
 dnl ***************************************************************************
+dnl *** _NL_MEASUREMENT_MEASUREMENT is an enum and not a define             ***
+dnl ***************************************************************************
+AC_MSG_CHECKING([for _NL_MEASUREMENT_MEASUREMENT])
+AC_TRY_LINK([#include <langinfo.h>], [
+char c;
+c = *((unsigned char *)  nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));
+], gtk_ok=yes, gtk_ok=no)
+AC_MSG_RESULT($gtk_ok)
+if test "$gtk_ok" = "yes"; then
+  AC_DEFINE([HAVE__NL_MEASUREMENT_MEASUREMENT], [1],
+            [Define if _NL_MEASUREMENT_MEASUREMENT is available])
+fi
+
+dnl ***************************************************************************
 dnl *** Honour aclocal flags                                                ***
 dnl ***************************************************************************
 ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}"

weather-abort.patch:

--- NEW FILE weather-abort.patch ---
diff -up gnome-applets-2.20.0/libgweather/weather.c.weather-abort gnome-applets-2.20.0/libgweather/weather.c
--- gnome-applets-2.20.0/libgweather/weather.c.weather-abort	2007-10-29 12:05:50.000000000 -0400
+++ gnome-applets-2.20.0/libgweather/weather.c	2007-10-29 12:06:09.000000000 -0400
@@ -560,6 +560,8 @@ void weather_info_abort (WeatherInfo *in
        gnome_vfs_async_cancel(info->bom_handle);
        info->bom_handle = NULL;
     }
+
+    info->requests_pending = FALSE;
 }
 
 WeatherInfo *weather_info_clone (const WeatherInfo *info)

weather-update.patch:

--- NEW FILE weather-update.patch ---
diff -up gnome-applets-2.20.0/libgweather/weather.h.weather-update gnome-applets-2.20.0/libgweather/weather.h
--- gnome-applets-2.20.0/libgweather/weather.h.weather-update	2007-10-29 12:04:33.000000000 -0400
+++ gnome-applets-2.20.0/libgweather/weather.h	2007-10-29 12:04:41.000000000 -0400
@@ -121,7 +121,7 @@ WeatherInfo *	_weather_info_fill			(Weat
 							 WeatherInfoFunc cb,
 							 gpointer data);
 #define	weather_info_new(location, prefs, cb, data) _weather_info_fill(NULL, (location), (prefs), (cb), (data))
-#define	weather_info_update(info, prefs, cb, data) _weather_info_fill((info), NULL, (prefs), (cb), (data));
+#define	weather_info_update(info, prefs, cb, data) _weather_info_fill((info), NULL, (prefs), (cb), (data))
 
 void			weather_info_abort		(WeatherInfo *info);
 WeatherInfo *		weather_info_clone		(const WeatherInfo *info);


Index: gnome-applets.spec
===================================================================
RCS file: /cvs/extras/rpms/gnome-applets/F-8/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	13 Nov 2007 00:58:31 -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
@@ -73,6 +73,16 @@
 # fixed in upstream svn
 Patch38:	mixer-preferences-leak.patch
 
+# http://bugzilla.gnome.org/show_bug.cgi?id=488824
+Patch39:        gweather-network.patch
+
+# http://bugzilla.gnome.org/show_bug.cgi?id=491435
+Patch40:        weather-update.patch
+# http://bugzilla.gnome.org/show_bug.cgi?id=491437
+Patch41:        weather-abort.patch
+# http://bugzilla.gnome.org/show_bug.cgi?id=491438
+Patch42:        nl_langinfo.patch
+
 BuildRequires:  glib2-devel >= %{glib2_version}
 BuildRequires:  gtk2-devel >= %{gtk2_version}
 BuildRequires:  libgnomeui-devel >= %{libgnomeui_version}
@@ -175,6 +185,10 @@
 popd
 %patch36 -p1 -b .gweather-pc
 %patch38 -p1 -b .mixer-preferences-leak
+%patch39 -p1 -b .geweather-network
+%patch40 -p1 -b .weather-update
+%patch41 -p1 -b .weather-abort
+%patch42 -p1 -b .nl_langinfo
 
 cp gswitchit/gswitchit-applet.png  gswitchit/gswitchit-properties-capplet.png
 
@@ -361,6 +375,10 @@
 %{_libdir}/libgweather.so
 
 %changelog
+* Mon Nov 12 2007 Matthias Clasen <mclasen at redhat.com> - 1:2.20.0-8
+- Update weather info when going online
+- Fix a number of problems in the weather applet
+
 * 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