[network-manager-applet] applet: initialize permissions in the applet to show 'Enable ...' menu items' visibility correctly (



commit 1aeb178397dd16316bfc242a2e41c54e28933f9a
Author: JiÅ?í KlimeÅ¡ <jklimes redhat com>
Date:   Mon Aug 30 14:03:55 2010 +0200

    applet: initialize permissions in the applet to show 'Enable ...' menu items' visibility correctly (rh #627365)
    
    'Enable Networking/Wireless/Mobile Broadband' was grayed out due to not
    initializing permissions. The first 'permission-changed' signals are emitted
    from withing NMClient constructor and the signal handler is not connected yet.
    So we call nm_client_get_permission_result() to set initial permissions.

 src/applet.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index f936a35..d1d9b06 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -2225,6 +2225,11 @@ foo_client_setup (NMApplet *applet)
 	g_signal_connect (applet->nm_client, "permission-changed",
 	                  G_CALLBACK (foo_manager_permission_changed),
 	                  applet);
+	/* Initialize permissions - the initial 'permission-changed' signal is emitted from NMClient constructor, and thus not caught */
+	applet->permissions[NM_CLIENT_PERMISSION_ENABLE_DISABLE_NETWORK] = nm_client_get_permission_result (applet->nm_client, NM_CLIENT_PERMISSION_ENABLE_DISABLE_NETWORK);
+	applet->permissions[NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIFI] = nm_client_get_permission_result (applet->nm_client, NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIFI);
+	applet->permissions[NM_CLIENT_PERMISSION_ENABLE_DISABLE_WWAN] = nm_client_get_permission_result (applet->nm_client, NM_CLIENT_PERMISSION_ENABLE_DISABLE_WWAN);
+	applet->permissions[NM_CLIENT_PERMISSION_USE_USER_CONNECTIONS] = nm_client_get_permission_result (applet->nm_client, NM_CLIENT_PERMISSION_USE_USER_CONNECTIONS);
 
 	if (nm_client_get_manager_running (applet->nm_client))
 		g_idle_add (foo_set_initial_state, applet);



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