rpms/NetworkManager/FC-5 NetworkManager-0.6.4-dbus-vpn-dont-block.patch, NONE, 1.1 NetworkManager-0.6.4-kill-stupid-timeouts.patch, NONE, 1.1 NetworkManager.spec, 1.112, 1.113

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed Oct 25 04:13:39 UTC 2006


Author: dcbw

Update of /cvs/dist/rpms/NetworkManager/FC-5
In directory cvs.devel.redhat.com:/tmp/cvs-serv5816

Modified Files:
	NetworkManager.spec 
Added Files:
	NetworkManager-0.6.4-dbus-vpn-dont-block.patch 
	NetworkManager-0.6.4-kill-stupid-timeouts.patch 
Log Message:
* Tue Oct 24 2006 Dan Williams <dcbw at redhat.com> - 1:0.6.4-6
- Don't block when grabbing VPN Connection settings from NMI
- Fix more stupid timeouts that wake up the applet periodically



NetworkManager-0.6.4-dbus-vpn-dont-block.patch:
 nm-dbus-vpn.c |    3 ---
 1 files changed, 3 deletions(-)

--- NEW FILE NetworkManager-0.6.4-dbus-vpn-dont-block.patch ---
--- NetworkManager-0.6.4/src/vpn-manager/nm-dbus-vpn.c.nonblock	2006-10-24 22:46:37.000000000 -0400
+++ NetworkManager-0.6.4/src/vpn-manager/nm-dbus-vpn.c	2006-10-24 22:46:55.000000000 -0400
@@ -540,10 +540,7 @@
 	dbus_connection_send_with_reply (data->dbus_connection, message, &pcall, -1);
 	dbus_message_unref (message);
 	if (pcall)
-	{
 		dbus_pending_call_set_notify (pcall, nm_dbus_vpn_connections_update_cb, data, NULL);
-		dbus_pending_call_block (pcall);
-	}
 
 	return FALSE;
 }

NetworkManager-0.6.4-kill-stupid-timeouts.patch:
 applet-dbus.c |  163 +++++++++++++++++++++++++++++++++++-----------------------
 applet-dbus.h |    1 
 applet.c      |   44 ++++++++++++---
 applet.h      |    3 +
 4 files changed, 138 insertions(+), 73 deletions(-)

--- NEW FILE NetworkManager-0.6.4-kill-stupid-timeouts.patch ---
Index: NetworkManager/gnome/applet/applet-dbus.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/NetworkManager/gnome/applet/applet-dbus.c,v
retrieving revision 1.29.2.1
diff -u -p -r1.29.2.1 applet-dbus.c
--- NetworkManager/gnome/applet/applet-dbus.c	22 Mar 2006 21:17:07 -0000	1.29.2.1
+++ NetworkManager/gnome/applet/applet-dbus.c	25 Oct 2006 03:31:31 -0000
@@ -72,7 +72,9 @@ static DBusHandlerResult nma_dbus_filter
 	{
 		dbus_connection_unref (applet->connection);
 		applet->connection = NULL;
-		applet->nm_running = FALSE;
+		nma_set_running (applet, FALSE);
+		if (!applet->connection_timeout_id)
+			nma_start_dbus_connection_watch (applet);
 	}
 	else if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged"))
 	{
@@ -94,18 +96,25 @@ static DBusHandlerResult nma_dbus_filter
 				if (!old_owner_good && new_owner_good && !applet->nm_running)
 				{
 					/* NetworkManager started up */
-					applet->nm_running = TRUE;
+					nma_set_running (applet, TRUE);
 					nma_set_state (applet, NM_STATE_DISCONNECTED);
+
 					nma_dbus_update_nm_state (applet);
 					nma_dbus_update_devices (applet);
 					nma_dbus_update_dialup (applet);
 					nma_dbus_vpn_update_vpn_connections (applet);
+
+					/* Immediate redraw */
+					nma_update_state (applet);
 				}
 				else if (old_owner_good && !new_owner_good)
 				{
-					applet->nm_running = FALSE;
 					nma_set_state (applet, NM_STATE_DISCONNECTED);
+					nma_set_running (applet, FALSE);
 					nmi_passphrase_dialog_destroy (applet);
+
+					/* One last redraw to capture new state before sleeping */
+					nma_update_state (applet);
 				}
 			}
 		}
@@ -322,68 +331,94 @@ static DBusConnection * nma_dbus_init (N
 	DBusError		 		error;
 	DBusObjectPathVTable	vtable = { NULL, &nmi_dbus_info_message_handler, NULL, NULL, NULL, NULL };
 	int					acquisition;
+	dbus_bool_t			success = FALSE;
 
 	g_return_val_if_fail (applet != NULL, NULL);
 
 	dbus_error_init (&error);
 	connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
-	if (dbus_error_is_set (&error))
-	{
+	if (dbus_error_is_set (&error)) {
 		nm_warning ("%s raised:\n %s\n\n", error.name, error.message);
-		dbus_error_free (&error);
-		return NULL;
+		goto error;
 	}
 
 	dbus_error_init (&error);
-	acquisition = dbus_bus_request_name (connection, NMI_DBUS_SERVICE, DBUS_NAME_FLAG_REPLACE_EXISTING, &error);
-	if (dbus_error_is_set (&error))
-	{
-		nm_warning ("nma_dbus_init() could not acquire its service.  dbus_bus_acquire_service() says: '%s'", error.message);
-		dbus_error_free (&error);
-		return NULL;
+	acquisition = dbus_bus_request_name (connection,
+	                                     NMI_DBUS_SERVICE,
+	                                     DBUS_NAME_FLAG_REPLACE_EXISTING,
+	                                     &error);
+	if (dbus_error_is_set (&error)) {
+		nm_warning ("could not acquire its service.  dbus_bus_acquire_service()"
+		            " says: '%s'",
+		            error.message);
+		goto error;
 	}
 	if (acquisition == DBUS_REQUEST_NAME_REPLY_EXISTS)
-	     return NULL;
+		goto error;
 
-	if (!dbus_connection_register_object_path (connection, NMI_DBUS_PATH, &vtable, applet))
-	{
-		nm_warning ("nma_dbus_init() could not register a handler for NetworkManagerInfo.  Not enough memory?");
-		return NULL;
+	success = dbus_connection_register_object_path (connection,
+	                                                NMI_DBUS_PATH,
+	                                                &vtable,
+	                                                applet);
+	if (!success) {
+		nm_warning ("could not register a messgae handler for the"
+		            " NetworkManagerInfo service.  Not enough memory?");
+		goto error;
 	}
 
-	if (!dbus_connection_add_filter (connection, nma_dbus_filter, applet, NULL))
-		return NULL;
+	success = dbus_connection_add_filter (connection, nma_dbus_filter, applet, NULL);
+	if (!success)
+		goto error;
 
 	dbus_connection_set_exit_on_disconnect (connection, FALSE);
 	dbus_connection_setup_with_g_main (connection, NULL);
 
+	dbus_error_init (&error);
 	dbus_bus_add_match(connection,
 				"type='signal',"
 				"interface='" DBUS_INTERFACE_DBUS "',"
 				"sender='" DBUS_SERVICE_DBUS "'",
 				&error);
-	if (dbus_error_is_set (&error))
-		dbus_error_free (&error);
+	if (dbus_error_is_set (&error)) {
+		nm_warning ("Could not register signal handlers.  '%s'",
+		            error.message);
+		goto error;
+	}
 
+	dbus_error_init (&error);
 	dbus_bus_add_match(connection,
 				"type='signal',"
 				"interface='" NM_DBUS_INTERFACE "',"
 				"path='" NM_DBUS_PATH "',"
 				"sender='" NM_DBUS_SERVICE "'",
 				&error);
-	if (dbus_error_is_set (&error))
-		dbus_error_free (&error);
+	if (dbus_error_is_set (&error)) {
+		nm_warning ("Could not register signal handlers.  '%s'",
+		            error.message);
+		goto error;
+	}
 
+	dbus_error_init (&error);
 	dbus_bus_add_match(connection,
 				"type='signal',"
 				"interface='" NM_DBUS_INTERFACE_VPN "',"
 				"path='" NM_DBUS_PATH_VPN "',"
 				"sender='" NM_DBUS_SERVICE "'",
 				&error);
+	if (dbus_error_is_set (&error)) {
+		nm_warning ("Could not register signal handlers.  '%s'",
+		            error.message);
+		goto error;
+	}
+
+	return connection;
+
+error:
 	if (dbus_error_is_set (&error))
 		dbus_error_free (&error);
-
-	return (connection);
+	if (connection)
+		dbus_connection_unref (connection);
+	return NULL;
 }
 
 
@@ -393,62 +428,62 @@ static DBusConnection * nma_dbus_init (N
  * Try to reconnect if we ever get disconnected from the bus
  *
  */
-static gboolean nma_dbus_connection_watcher (gpointer user_data)
+static gboolean
+nma_dbus_connection_watcher (gpointer user_data)
 {
-	NMApplet	*applet = (NMApplet *)user_data;
+	NMApplet * applet = (NMApplet *)user_data;
 
 	g_return_val_if_fail (applet != NULL, TRUE);
 
-	if (!applet->connection)
-	{
-		if ((applet->connection = nma_dbus_init (applet)))
-		{
-			applet->nm_running = nma_dbus_nm_is_running (applet->connection);
-			if (applet->nm_running)
-			{
-				nma_set_state (applet, NM_STATE_DISCONNECTED);
-				nma_dbus_update_nm_state (applet);
-				nma_dbus_update_devices (applet);
-				nma_dbus_update_dialup (applet);
-				nma_dbus_vpn_update_vpn_connections (applet);
-			}
-		}
+	nma_dbus_init_helper (applet);
+	if (applet->connection) {
+		applet->connection_timeout_id = 0;
+		return FALSE;  /* Remove timeout */
 	}
 
-	return (TRUE);
+	return TRUE;
+}
+
+
+void
+nma_start_dbus_connection_watch (NMApplet *applet)
+{
+	if (applet->connection_timeout_id)
+		g_source_remove (applet->connection_timeout_id);
+
+	applet->connection_timeout_id = g_timeout_add (5000,
+	                                               (GSourceFunc) nma_dbus_connection_watcher,
+	                                               applet);
 }
 
 
 /*
- * nma_dbus_worker
+ * nma_dbus_init_helper
  *
- * Thread worker function that periodically grabs the NetworkManager state
- * and updates our local applet state to reflect that.
+ * Set up the applet's NMI dbus methods and dbus connection
  *
  */
-void nma_dbus_init_helper (NMApplet *applet)
+void
+nma_dbus_init_helper (NMApplet *applet)
 {
-	GSource *			timeout_source;
-
 	g_return_if_fail (applet != NULL);
 
-	dbus_g_thread_init ();
-
 	applet->connection = nma_dbus_init (applet);
-	applet->nmi_methods = nmi_dbus_nmi_methods_setup ();
+	if (applet->connection) {
+		if (applet->connection_timeout_id) {
+			g_source_remove (applet->connection_timeout_id);
+			applet->connection_timeout_id = 0;
+		}
 
-	timeout_source = g_timeout_source_new (2000);
-	g_source_set_callback (timeout_source, nma_dbus_connection_watcher, applet, NULL);
-	g_source_attach (timeout_source, NULL);
+		if (nma_dbus_nm_is_running (applet->connection)) {
+			nma_set_running (applet, TRUE);
+			nma_dbus_update_nm_state (applet);
+			nma_dbus_update_devices (applet);
+			nma_dbus_update_dialup (applet);
+			nma_dbus_vpn_update_vpn_connections (applet);
 
-	if (applet->connection && nma_dbus_nm_is_running (applet->connection))
-	{
-		applet->nm_running = TRUE;
-		nma_dbus_update_nm_state (applet);
-		nma_dbus_update_devices (applet);
-		nma_dbus_update_dialup (applet);
-		nma_dbus_vpn_update_vpn_connections (applet);
+			/* Immediate redraw */
+			nma_update_state (applet);
+		}
 	}
-
-	g_source_unref (timeout_source);
 }
Index: NetworkManager/gnome/applet/applet-dbus.h
===================================================================
RCS file: /cvs/gnome/NetworkManager/NetworkManager/gnome/applet/applet-dbus.h,v
retrieving revision 1.7
diff -u -p -r1.7 applet-dbus.h
--- NetworkManager/gnome/applet/applet-dbus.h	27 Feb 2006 06:26:31 -0000	1.7
+++ NetworkManager/gnome/applet/applet-dbus.h	25 Oct 2006 03:31:31 -0000
@@ -43,6 +43,7 @@ static inline gboolean message_is_error 
 }
 
 void			nma_dbus_init_helper				(NMApplet *applet);
+void			nma_start_dbus_connection_watch		(NMApplet *applet);
 void			nma_dbus_enable_wireless			(NMApplet *applet, gboolean enabled);
 void			nma_dbus_enable_networking			(NMApplet *applet, gboolean enabled);
 void			nma_free_gui_data_model				(NMApplet *applet);
Index: NetworkManager/gnome/applet/applet.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/NetworkManager/gnome/applet/applet.c,v
retrieving revision 1.112.2.11
diff -u -p -r1.112.2.11 applet.c
--- NetworkManager/gnome/applet/applet.c	11 Oct 2006 09:01:22 -0000	1.112.2.11
+++ NetworkManager/gnome/applet/applet.c	25 Oct 2006 03:31:33 -0000
@@ -80,7 +80,6 @@ static gboolean				nma_icons_init (NMApp
 static void					nma_icons_free (NMApplet *applet);
 static void					nma_context_menu_update (NMApplet *applet);
 static GtkWidget *				nma_get_instance (NMApplet *applet);
-static void					nma_update_state (NMApplet *applet);
 static void					nma_dropdown_menu_deactivate_cb (GtkWidget *menu, NMApplet *applet);
 static G_GNUC_NORETURN void		nma_destroy (NMApplet *applet);
 static GType					nma_get_type (void);	/* for G_DEFINE_TYPE */
@@ -1049,7 +1048,7 @@ static gboolean animation_timeout (NMApp
  * and what our icon on the panel should look like for each type.
  *
  */
-static void nma_update_state (NMApplet *applet)
+void nma_update_state (NMApplet *applet)
 {
 	gboolean			show_applet = TRUE;
 	gboolean			need_animation = FALSE;
@@ -2135,6 +2134,29 @@ static inline void nma_enable_networking
 
 
 /*
+ * nma_set_running
+ *
+ * Set whether NM is running to TRUE or FALSE.
+ *
+ */
+void nma_set_running (NMApplet *applet, gboolean running)
+{
+	if (running == applet->nm_running)
+		return;
+
+	applet->nm_running = running;
+
+	/* if NM became active, start drawing our icon, else stop drawing it */
+	if (applet->nm_running && !applet->redraw_timeout_id)
+		applet->redraw_timeout_id = g_timeout_add (1000, (GSourceFunc) nma_redraw_timeout, applet);
+	else if (!applet->nm_running && applet->redraw_timeout_id)
+	{
+		g_source_remove (applet->redraw_timeout_id);
+		applet->redraw_timeout_id = 0;
+	}
+}
+
+/*
  * nma_set_state
  *
  * Set the applet's state to one of the NMState enumerations.
@@ -2460,10 +2482,10 @@ static void G_GNUC_NORETURN nma_destroy 
 	}
 #endif
 
-	if (applet->redraw_timeout_id > 0)
-	{
-		gtk_timeout_remove (applet->redraw_timeout_id);
-		applet->redraw_timeout_id = 0;
+	nma_set_running (applet, FALSE);
+	if (applet->connection_timeout_id) {
+		g_source_remove (applet->connection_timeout_id);
+		applet->connection_timeout_id = 0;
 	}
 
 	if (applet->gconf_client)
@@ -2500,6 +2522,8 @@ static GtkWidget * nma_get_instance (NMA
 	applet->nm_state = NM_STATE_DISCONNECTED;
 	applet->tooltips = NULL;
 	applet->passphrase_dialog = NULL;
+	applet->connection_timeout_id = 0;
+	applet->redraw_timeout_id = 0;
 #ifdef ENABLE_NOTIFY
 	applet->notification = NULL;
 #endif
@@ -2533,16 +2557,18 @@ static GtkWidget * nma_get_instance (NMA
 	 */
 	nma_compat_convert_oldformat_entries (applet->gconf_client);
 
+	/* D-Bus init stuff */
+	dbus_g_thread_init ();
+	applet->nmi_methods = nmi_dbus_nmi_methods_setup ();
 	nma_dbus_init_helper (applet);
+	if (!applet->connection)
+		nma_start_dbus_connection_watch (applet);
 
 	/* Load pixmaps and create applet widgets */
 	nma_setup_widgets (applet);
 
 	g_signal_connect (applet, "destroy", G_CALLBACK (nma_destroy), NULL);
 	g_signal_connect (applet, "style-set", G_CALLBACK (nma_theme_change_cb), NULL);
-
-	/* Start redraw timeout */
-	applet->redraw_timeout_id = g_timeout_add (1000, (GtkFunction) nma_redraw_timeout, applet);
 
 	return GTK_WIDGET (applet);
 }
Index: NetworkManager/gnome/applet/applet.h
===================================================================
RCS file: /cvs/gnome/NetworkManager/NetworkManager/gnome/applet/applet.h,v
retrieving revision 1.31.2.2
diff -u -p -r1.31.2.2 applet.h
--- NetworkManager/gnome/applet/applet.h	11 May 2006 21:30:34 -0000	1.31.2.2
+++ NetworkManager/gnome/applet/applet.h	25 Oct 2006 03:31:34 -0000
@@ -81,6 +81,7 @@ typedef struct
 	guint		 	gconf_vpn_notify_id;
 	char	*			glade_file;
 	guint			redraw_timeout_id;
+	guint			connection_timeout_id;
 
 	/* Data model elements */
 	gboolean			is_adhoc;
@@ -152,6 +153,8 @@ VPNConnection *	nma_get_first_active_vpn
 void				nma_enable_wireless_set_active		(NMApplet *applet);
 
 void				nma_set_state						(NMApplet *applet, NMState state);
+void				nma_set_running						(NMApplet *applet, gboolean running);
+void				nma_update_state					(NMApplet *applet);
 
 int				nm_null_safe_strcmp					(const char *s1, const char *s2);
 


Index: NetworkManager.spec
===================================================================
RCS file: /cvs/dist/rpms/NetworkManager/FC-5/NetworkManager.spec,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -r1.112 -r1.113
--- NetworkManager.spec	30 Aug 2006 18:33:41 -0000	1.112
+++ NetworkManager.spec	25 Oct 2006 04:13:36 -0000	1.113
@@ -27,7 +27,7 @@
 Summary: Network connection manager and user applications
 Epoch: 1
 Version: 0.6.4
-Release: 4%{?dist}
+Release: 6%{?dist}
 Group: System Environment/Base
 License: GPL
 URL: http://www.gnome.org/projects/NetworkManager/
@@ -35,6 +35,8 @@
 Patch0: NetworkManager-0.6.4-old-dbus.patch
 Patch1: NetworkManager-0.6.4-fc5-specialcase-madwifi.patch
 Patch2: NetworkManager-0.6.4-startup-dhcdbd.patch
+Patch3: NetworkManager-0.6.4-kill-stupid-timeouts.patch
+Patch4: NetworkManager-0.6.4-dbus-vpn-dont-block.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 PreReq:   chkconfig
@@ -140,6 +142,8 @@
 %patch1 -p1 -b .specialcase-madwifi
 %endif
 %patch2 -p1 -b .startup-dhcdbd
+%patch3 -p1 -b .kill-stupid-timeouts
+%patch4 -p1 -b .dbus-vpn-nonblock
 
 %build
 # Even though we don't require named, we still build with it
@@ -240,6 +244,13 @@
 
 
 %changelog
+* Tue Oct 24 2006 Dan Williams <dcbw at redhat.com> - 1:0.6.4-6
+- Don't block when grabbing VPN Connection settings from NMI
+- Fix more stupid timeouts that wake up the applet periodically
+
+* Mon Sep  4 2006 Christopher Aillon <caillon at redhat.com> - 1:0.6.4-5
+- Don't wake up to redraw if NM is inactive (#204850)
+
 * Wed Aug 30 2006 Bill Nottingham <notting at redhat.com> - 1:0.6.4-4
 - add epochs in requirements
 




More information about the fedora-cvs-commits mailing list