[network-manager-applet/wimax] applet: add WiMAX enable context menu item
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/wimax] applet: add WiMAX enable context menu item
- Date: Tue, 4 Jan 2011 22:28:59 +0000 (UTC)
commit f9a254fc130159d3e43abb50c32c308f1bc52039
Author: Dan Williams <dcbw redhat com>
Date: Tue Jan 4 16:28:16 2011 -0600
applet: add WiMAX enable context menu item
src/applet.c | 42 ++++++++++++++++++++++++++++++++++++++++++
src/applet.h | 2 ++
2 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index dfc00e5..fc4599a 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -1591,6 +1591,17 @@ nma_set_wwan_enabled_cb (GtkWidget *widget, NMApplet *applet)
}
static void
+nma_set_wimax_enabled_cb (GtkWidget *widget, NMApplet *applet)
+{
+ gboolean state;
+
+ g_return_if_fail (applet != NULL);
+
+ state = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget));
+ nm_client_wimax_set_enabled (applet->nm_client, state);
+}
+
+static void
nma_set_networking_enabled_cb (GtkWidget *widget, NMApplet *applet)
{
gboolean state;
@@ -1716,8 +1727,10 @@ nma_context_menu_update (NMApplet *applet)
gboolean net_enabled = TRUE;
gboolean have_wireless = FALSE;
gboolean have_wwan = FALSE;
+ gboolean have_wimax = FALSE;
gboolean wireless_hw_enabled;
gboolean wwan_hw_enabled;
+ gboolean wimax_hw_enabled;
gboolean notifications_enabled = TRUE;
state = nm_client_get_state (applet->nm_client);
@@ -1763,6 +1776,18 @@ nma_context_menu_update (NMApplet *applet)
gtk_widget_set_sensitive (GTK_WIDGET (applet->wwan_enabled_item),
wwan_hw_enabled && is_permission_yes (applet, NM_CLIENT_PERMISSION_ENABLE_DISABLE_WWAN));
+ /* Enable WiMAX */
+ g_signal_handler_block (G_OBJECT (applet->wimax_enabled_item),
+ applet->wimax_enabled_toggled_id);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (applet->wimax_enabled_item),
+ nm_client_wimax_get_enabled (applet->nm_client));
+ g_signal_handler_unblock (G_OBJECT (applet->wimax_enabled_item),
+ applet->wimax_enabled_toggled_id);
+
+ wimax_hw_enabled = nm_client_wimax_hardware_get_enabled (applet->nm_client);
+ gtk_widget_set_sensitive (GTK_WIDGET (applet->wimax_enabled_item),
+ wimax_hw_enabled && is_permission_yes (applet, NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIMAX));
+
/* Enabled notifications */
g_signal_handler_block (G_OBJECT (applet->notifications_enabled_item),
applet->notifications_enabled_toggled_id);
@@ -1787,6 +1812,8 @@ nma_context_menu_update (NMApplet *applet)
have_wireless = TRUE;
else if (NM_IS_SERIAL_DEVICE (candidate))
have_wwan = TRUE;
+ else if (NM_IS_DEVICE_WIMAX (candidate))
+ have_wimax = TRUE;
}
}
@@ -1799,6 +1826,11 @@ nma_context_menu_update (NMApplet *applet)
gtk_widget_show_all (applet->wwan_enabled_item);
else
gtk_widget_hide (applet->wwan_enabled_item);
+
+ if (have_wimax)
+ gtk_widget_show_all (applet->wimax_enabled_item);
+ else
+ gtk_widget_hide (applet->wimax_enabled_item);
}
static void
@@ -1876,6 +1908,15 @@ static GtkWidget *nma_context_menu_create (NMApplet *applet)
applet->wwan_enabled_toggled_id = id;
gtk_menu_shell_append (menu, applet->wwan_enabled_item);
+ /* 'Enable WiMAX Mobile Broadband' item */
+ applet->wimax_enabled_item = gtk_check_menu_item_new_with_mnemonic (_("Enable WiMA_X Mobile Broadband"));
+ id = g_signal_connect (applet->wimax_enabled_item,
+ "toggled",
+ G_CALLBACK (nma_set_wimax_enabled_cb),
+ applet);
+ applet->wimax_enabled_toggled_id = id;
+ gtk_menu_shell_append (menu, applet->wimax_enabled_item);
+
nma_menu_add_separator_item (GTK_WIDGET (menu));
/* Toggle notifications item */
@@ -2229,6 +2270,7 @@ foo_client_setup (NMApplet *applet)
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_ENABLE_DISABLE_WIMAX] = nm_client_get_permission_result (applet->nm_client, NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIMAX);
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))
diff --git a/src/applet.h b/src/applet.h
index 236ced9..076c2b8 100644
--- a/src/applet.h
+++ b/src/applet.h
@@ -157,6 +157,8 @@ typedef struct
guint wifi_enabled_toggled_id;
GtkWidget * wwan_enabled_item;
guint wwan_enabled_toggled_id;
+ GtkWidget * wimax_enabled_item;
+ guint wimax_enabled_toggled_id;
GtkWidget * notifications_enabled_item;
guint notifications_enabled_toggled_id;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]