[network-manager-applet] applet: make "Enable Notifications" also work for VPN (bgo #635650)
- From: Jiří Klimeš <jklimes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet] applet: make "Enable Notifications" also work for VPN (bgo #635650)
- Date: Tue, 18 Jan 2011 16:16:05 +0000 (UTC)
commit 559080731fd043cf3583c38fa39ca103787afb92
Author: JiÅ?à KlimeÅ¡ <jklimes redhat com>
Date: Tue Jan 18 17:08:47 2011 +0100
applet: make "Enable Notifications" also work for VPN (bgo #635650)
Separate preference is added for VPN: PREF_DISABLE_VPN_NOTIFICATIONS.
src/applet.c | 32 +++++++++++++++++++-------------
src/applet.h | 1 +
2 files changed, 20 insertions(+), 13 deletions(-)
---
diff --git a/src/applet.c b/src/applet.c
index fc4599a..928b07f 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -684,9 +684,9 @@ applet_do_notify (NMApplet *applet,
}
static void
-notify_connected_dont_show_cb (NotifyNotification *notify,
- gchar *id,
- gpointer user_data)
+notify_dont_show_cb (NotifyNotification *notify,
+ gchar *id,
+ gpointer user_data)
{
NMApplet *applet = NM_APPLET (user_data);
@@ -694,7 +694,8 @@ notify_connected_dont_show_cb (NotifyNotification *notify,
return;
if ( strcmp (id, PREF_DISABLE_CONNECTED_NOTIFICATIONS)
- && strcmp (id, PREF_DISABLE_DISCONNECTED_NOTIFICATIONS))
+ && strcmp (id, PREF_DISABLE_DISCONNECTED_NOTIFICATIONS)
+ && strcmp (id, PREF_DISABLE_VPN_NOTIFICATIONS))
return;
gconf_client_set_bool (applet->gconf_client, id, TRUE, NULL);
@@ -711,7 +712,7 @@ void applet_do_notify_with_pref (NMApplet *applet,
applet_do_notify (applet, NOTIFY_URGENCY_LOW, summary, message, icon, pref,
_("Don't show this message again"),
- notify_connected_dont_show_cb,
+ notify_dont_show_cb,
applet);
}
@@ -914,8 +915,8 @@ vpn_connection_state_changed (NMVPNConnection *vpn,
msg = g_strdup ("VPN connection has been successfully established.\n");
title = _("VPN Login Message");
- applet_do_notify (applet, NOTIFY_URGENCY_LOW, title, msg,
- "gnome-lockscreen", NULL, NULL, NULL, NULL);
+ applet_do_notify_with_pref (applet, title, msg, "gnome-lockscreen",
+ PREF_DISABLE_VPN_NOTIFICATIONS);
g_free (msg);
connection = applet_get_connection_for_active (applet, NM_ACTIVE_CONNECTION (vpn));
@@ -925,16 +926,16 @@ vpn_connection_state_changed (NMVPNConnection *vpn,
case NM_VPN_CONNECTION_STATE_FAILED:
title = _("VPN Connection Failed");
msg = make_vpn_failure_message (vpn, reason, applet);
- applet_do_notify (applet, NOTIFY_URGENCY_LOW, title, msg,
- "gnome-lockscreen", NULL, NULL, NULL, NULL);
+ applet_do_notify_with_pref (applet, title, msg, "gnome-lockscreen",
+ PREF_DISABLE_VPN_NOTIFICATIONS);
g_free (msg);
break;
case NM_VPN_CONNECTION_STATE_DISCONNECTED:
if (reason != NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED) {
title = _("VPN Connection Failed");
msg = make_vpn_disconnection_message (vpn, reason, applet);
- applet_do_notify (applet, NOTIFY_URGENCY_LOW, title, msg,
- "gnome-lockscreen", NULL, NULL, NULL, NULL);
+ applet_do_notify_with_pref (applet, title, msg, "gnome-lockscreen",
+ PREF_DISABLE_VPN_NOTIFICATIONS);
g_free (msg);
}
break;
@@ -992,8 +993,8 @@ activate_vpn_cb (gpointer user_data, const char *path, GError *error)
info->vpn_name, error->message);
}
- applet_do_notify (info->applet, NOTIFY_URGENCY_LOW, title, msg,
- "gnome-lockscreen", NULL, NULL, NULL, NULL);
+ applet_do_notify_with_pref (info->applet, title, msg, "gnome-lockscreen",
+ PREF_DISABLE_VPN_NOTIFICATIONS);
g_free (msg);
nm_warning ("VPN Connection activation failed: (%s) %s", name, error->message);
@@ -1631,6 +1632,10 @@ nma_set_notifications_enabled_cb (GtkWidget *widget, NMApplet *applet)
!state,
NULL);
gconf_client_set_bool (applet->gconf_client,
+ PREF_DISABLE_VPN_NOTIFICATIONS,
+ !state,
+ NULL);
+ gconf_client_set_bool (applet->gconf_client,
PREF_SUPPRESS_WIRELESS_NETWORKS_AVAILABLE,
!state,
NULL);
@@ -1793,6 +1798,7 @@ nma_context_menu_update (NMApplet *applet)
applet->notifications_enabled_toggled_id);
if ( gconf_client_get_bool (applet->gconf_client, PREF_DISABLE_CONNECTED_NOTIFICATIONS, NULL)
&& gconf_client_get_bool (applet->gconf_client, PREF_DISABLE_DISCONNECTED_NOTIFICATIONS, NULL)
+ && gconf_client_get_bool (applet->gconf_client, PREF_DISABLE_VPN_NOTIFICATIONS, NULL)
&& gconf_client_get_bool (applet->gconf_client, PREF_SUPPRESS_WIRELESS_NETWORKS_AVAILABLE, NULL))
notifications_enabled = FALSE;
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (applet->notifications_enabled_item), notifications_enabled);
diff --git a/src/applet.h b/src/applet.h
index 076c2b8..fb53357 100644
--- a/src/applet.h
+++ b/src/applet.h
@@ -64,6 +64,7 @@ typedef struct
#define APPLET_PREFS_PATH "/apps/nm-applet"
#define PREF_DISABLE_CONNECTED_NOTIFICATIONS APPLET_PREFS_PATH "/disable-connected-notifications"
#define PREF_DISABLE_DISCONNECTED_NOTIFICATIONS APPLET_PREFS_PATH "/disable-disconnected-notifications"
+#define PREF_DISABLE_VPN_NOTIFICATIONS APPLET_PREFS_PATH "/disable-vpn-notifications"
#define PREF_DISABLE_WIFI_CREATE APPLET_PREFS_PATH "/disable-wifi-create"
#define PREF_SUPPRESS_WIRELESS_NETWORKS_AVAILABLE APPLET_PREFS_PATH "/suppress-wireless-networks-available"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]