[gnome-control-center] network: Do not show the start hotspot button if the user has no permissions
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Do not show the start hotspot button if the user has no permissions
- Date: Mon, 30 Jul 2012 09:05:11 +0000 (UTC)
commit 240e3b0598926d0411bcf258a92e055b94e36966
Author: Richard Hughes <richard hughsie com>
Date: Mon Jul 30 09:45:44 2012 +0100
network: Do not show the start hotspot button if the user has no permissions
panels/network/net-device-wifi.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index 0344edf..11860a9 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -1773,6 +1773,8 @@ net_device_wifi_constructed (GObject *object)
NetDeviceWifi *device_wifi = NET_DEVICE_WIFI (object);
NMClient *client;
NMRemoteSettings *remote_settings;
+ NMClientPermissionResult perm;
+ GtkWidget *widget;
G_OBJECT_CLASS (net_device_wifi_parent_class)->constructed (object);
@@ -1780,6 +1782,13 @@ net_device_wifi_constructed (GObject *object)
g_signal_connect (client, "notify::wireless-enabled",
G_CALLBACK (wireless_enabled_toggled), device_wifi);
+ /* only show the button if the user can create a hotspot */
+ perm = nm_client_get_permission_result (client, NM_CLIENT_PERMISSION_WIFI_SHARE_OPEN);
+ widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
+ "start_hotspot_button"));
+ gtk_widget_set_sensitive (widget, perm == NM_CLIENT_PERMISSION_RESULT_YES ||
+ perm == NM_CLIENT_PERMISSION_RESULT_AUTH);
+
remote_settings = net_object_get_remote_settings (NET_OBJECT (device_wifi));
g_signal_connect (remote_settings, "connections-read",
G_CALLBACK (remote_settings_read_cb), device_wifi);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]