gnome-main-menu r454 - in trunk: . main-menu/src



Author: federico
Date: Wed May  7 16:41:53 2008
New Revision: 454
URL: http://svn.gnome.org/viewvc/gnome-main-menu?rev=454&view=rev

Log:
bnc262334 - Correct network status even if NetworkManager is not running
2008-05-07  Magnus Boman  <captain magnus gmail com>

	https://bugzilla.novell.com/show_bug.cgi?id=262334 -
	Show the correct status in the network status tile even if
	NetworkManager is not running.

	* main-menu/src/main-menu-ui.c (create_status_section): Remember
	our network_status widget in the MainMenuUIPrivate.
	(present_slab_window): Update the network tile.

	* main-menu/src/network-status-tile.c (network_tile_update_status):
	New function.

	* main-menu/src/network-status-agent.c (init_nm_connection):
	Handle the case where we obtained a NM client object, but NM is
	not running.

Signed-off-by: Federico Mena Quintero <federico gnu org>


Modified:
   trunk/ChangeLog
   trunk/main-menu/src/main-menu-ui.c
   trunk/main-menu/src/network-status-agent.c
   trunk/main-menu/src/network-status-tile.c
   trunk/main-menu/src/network-status-tile.h

Modified: trunk/main-menu/src/main-menu-ui.c
==============================================================================
--- trunk/main-menu/src/main-menu-ui.c	(original)
+++ trunk/main-menu/src/main-menu-ui.c	Wed May  7 16:41:53 2008
@@ -100,6 +100,7 @@
 
 	GtkWidget *search_section;
 	GtkWidget *search_entry;
+	GtkWidget *network_status;
 
 	GtkNotebook *file_section;
 	GtkWidget   *page_selectors    [3];
@@ -404,6 +405,7 @@
 
 	priv->status_section                             = NULL;
 	priv->system_section                             = NULL;
+	priv->network_status                             = NULL;
 
 	priv->volume_mon                                 = NULL;
 
@@ -730,15 +732,15 @@
 
 	ctnr = GTK_CONTAINER (glade_xml_get_widget (
 		priv->main_menu_xml, "network-status-container"));
-	tile = network_status_tile_new ();
+	priv->network_status = network_status_tile_new ();
 
-	gtk_widget_set_size_request (tile, 6 * icon_width, -1);
+	gtk_widget_set_size_request (priv->network_status, 6 * icon_width, -1);
 
 	g_signal_connect (
-		G_OBJECT (tile), "tile-action-triggered",
+		G_OBJECT (priv->network_status), "tile-action-triggered",
 		G_CALLBACK (tile_action_triggered_cb), this);
 
-	gtk_container_add   (ctnr, tile);
+	gtk_container_add   (ctnr, priv->network_status);
 	gtk_widget_show_all (GTK_WIDGET (ctnr));
 
 	priv->status_section = glade_xml_get_widget (
@@ -1841,6 +1843,8 @@
 {
 	MainMenuUIPrivate *priv = PRIVATE (this);
 
+	network_tile_update_status (priv->network_status);
+
 	update_recently_used_sections (this);
 
 	gtk_window_present_with_time (GTK_WINDOW (priv->slab_window), gtk_get_current_event_time ());

Modified: trunk/main-menu/src/network-status-agent.c
==============================================================================
--- trunk/main-menu/src/network-status-agent.c	(original)
+++ trunk/main-menu/src/network-status-agent.c	Wed May  7 16:41:53 2008
@@ -131,7 +131,7 @@
 
 	priv->nm_client = nm_client_new();
 
-	if (!priv->nm_client)
+	if (!(priv->nm_client && nm_client_get_manager_running (priv->nm_client)))
 	{
 		g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "nm_client_new failed");
 

Modified: trunk/main-menu/src/network-status-tile.c
==============================================================================
--- trunk/main-menu/src/network-status-tile.c	(original)
+++ trunk/main-menu/src/network-status-tile.c	Wed May  7 16:41:53 2008
@@ -363,6 +363,19 @@
 	update_tile (tile);
 }
 
+void
+network_tile_update_status (GtkWidget * widget)
+{
+	NetworkStatusTile *tile = NETWORK_STATUS_TILE (widget);
+	NetworkStatusTilePrivate *priv = NETWORK_STATUS_TILE_GET_PRIVATE (tile);
+
+	if (priv->agent->nm_present)
+		return;
+
+	refresh_status (tile);
+	update_tile (tile);
+}
+
 static void
 status_changed_cb (NetworkStatusAgent * agent, gpointer user_data)
 {

Modified: trunk/main-menu/src/network-status-tile.h
==============================================================================
--- trunk/main-menu/src/network-status-tile.h	(original)
+++ trunk/main-menu/src/network-status-tile.h	Wed May  7 16:41:53 2008
@@ -48,5 +48,7 @@
 
 GtkWidget *network_status_tile_new (void);
 
+void network_tile_update_status (GtkWidget * widget);
+
 G_END_DECLS
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]