network-manager-applet r1046 - in trunk: . src
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: network-manager-applet r1046 - in trunk: . src
- Date: Mon, 24 Nov 2008 17:49:50 +0000 (UTC)
Author: dcbw
Date: Mon Nov 24 17:49:50 2008
New Revision: 1046
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=1046&view=rev
Log:
2008-11-24 Dan Williams <dcbw redhat com>
Patch from Tony Houghton <h realh co uk> (bgo #455250)
* src/applet.c
src/applet.h
- (applet_do_notify_with_pref): add notification helper for connect/
disconnect messages with a "disable me" button
- (foo_client_state_changed_cb): add ability to disable disconnected
notification too
- (applet_do_notify): set default timeout for notifications
* src/applet-device-cdma.c
src/applet-device-gsm.c
src/applet-device-wifi.c
src/applet-device-wired.c
- Use applet_do_notify_connect_state()
Modified:
trunk/ChangeLog
trunk/src/applet-device-cdma.c
trunk/src/applet-device-gsm.c
trunk/src/applet-device-wifi.c
trunk/src/applet-device-wired.c
trunk/src/applet.c
trunk/src/applet.h
Modified: trunk/src/applet-device-cdma.c
==============================================================================
--- trunk/src/applet-device-cdma.c (original)
+++ trunk/src/applet-device-cdma.c Mon Nov 24 17:49:50 2008
@@ -300,10 +300,11 @@
str = g_strdup_printf (_("You are now connected to '%s'."), id);
}
- applet_do_notify (applet, NOTIFY_URGENCY_LOW,
- _("Connection Established"),
- str ? str : _("You are now connected to the CDMA network."),
- "nm-device-wwan", NULL, NULL, NULL, NULL);
+ applet_do_notify_with_pref (applet,
+ _("Connection Established"),
+ str ? str : _("You are now connected to the CDMA network."),
+ "nm-device-wwan",
+ PREF_DISABLE_CONNECTED_NOTIFICATIONS);
g_free (str);
}
}
Modified: trunk/src/applet-device-gsm.c
==============================================================================
--- trunk/src/applet-device-gsm.c (original)
+++ trunk/src/applet-device-gsm.c Mon Nov 24 17:49:50 2008
@@ -301,10 +301,11 @@
str = g_strdup_printf (_("You are now connected to '%s'."), id);
}
- applet_do_notify (applet, NOTIFY_URGENCY_LOW,
- _("Connection Established"),
- str ? str : _("You are now connected to the GSM network."),
- "nm-device-wwan", NULL, NULL, NULL, NULL);
+ applet_do_notify_with_pref (applet,
+ _("Connection Established"),
+ str ? str : _("You are now connected to the GSM network."),
+ "nm-device-wwan",
+ PREF_DISABLE_CONNECTED_NOTIFICATIONS);
g_free (str);
}
}
Modified: trunk/src/applet-device-wifi.c
==============================================================================
--- trunk/src/applet-device-wifi.c (original)
+++ trunk/src/applet-device-wifi.c Mon Nov 24 17:49:50 2008
@@ -1182,8 +1182,9 @@
msg = g_strdup_printf (_("You are now connected to the wireless network '%s'."),
esc_ssid ? esc_ssid : _("(none)"));
- applet_do_notify (applet, NOTIFY_URGENCY_LOW, _("Connection Established"),
- msg, "nm-device-wireless", NULL, NULL, NULL, NULL);
+ applet_do_notify_with_pref (applet, _("Connection Established"),
+ msg, "nm-device-wireless",
+ PREF_DISABLE_CONNECTED_NOTIFICATIONS);
g_free (msg);
g_free (esc_ssid);
}
Modified: trunk/src/applet-device-wired.c
==============================================================================
--- trunk/src/applet-device-wired.c (original)
+++ trunk/src/applet-device-wired.c Mon Nov 24 17:49:50 2008
@@ -264,10 +264,11 @@
str = g_strdup_printf (_("You are now connected to '%s'."), id);
}
- applet_do_notify (applet, NOTIFY_URGENCY_LOW,
- _("Connection Established"),
- str ? str : _("You are now connected to the wired network."),
- "nm-device-wired", NULL, NULL, NULL, NULL);
+ applet_do_notify_with_pref (applet,
+ _("Connection Established"),
+ str ? str : _("You are now connected to the wired network."),
+ "nm-device-wired",
+ PREF_DISABLE_CONNECTED_NOTIFICATIONS);
g_free (str);
}
}
Modified: trunk/src/applet.c
==============================================================================
--- trunk/src/applet.c (original)
+++ trunk/src/applet.c Mon Nov 24 17:49:50 2008
@@ -393,6 +393,7 @@
notify_notification_attach_to_status_icon (notify, applet->status_icon);
notify_notification_set_urgency (notify, urgency);
+ notify_notification_set_timeout (notify, NOTIFY_EXPIRES_DEFAULT);
if (action1) {
notify_notification_add_action (notify, action1, action1_label,
@@ -405,6 +406,38 @@
}
}
+static void
+notify_connected_dont_show_cb (NotifyNotification *notify,
+ gchar *id,
+ gpointer user_data)
+{
+ NMApplet *applet = NM_APPLET (user_data);
+
+ if (!id)
+ return;
+
+ if ( strcmp (id, PREF_DISABLE_CONNECTED_NOTIFICATIONS)
+ && strcmp (id, PREF_DISABLE_DISCONNECTED_NOTIFICATIONS))
+ return;
+
+ gconf_client_set_bool (applet->gconf_client, id, TRUE, NULL);
+}
+
+void applet_do_notify_with_pref (NMApplet *applet,
+ const char *summary,
+ const char *message,
+ const char *icon,
+ const char *pref)
+{
+ if (gconf_client_get_bool (applet->gconf_client, pref, NULL))
+ return;
+
+ applet_do_notify (applet, NOTIFY_URGENCY_LOW, summary, message, icon, pref,
+ _("Don't show this message again"),
+ notify_connected_dont_show_cb,
+ applet);
+}
+
static gboolean
animation_timeout (gpointer data)
{
@@ -1546,9 +1579,10 @@
switch (nm_client_get_state (client)) {
case NM_STATE_DISCONNECTED:
- applet_do_notify (applet, NOTIFY_URGENCY_NORMAL, _("Disconnected"),
- _("The network connection has been disconnected."),
- "nm-no-connection", NULL, NULL, NULL, NULL);
+ applet_do_notify_with_pref (applet, _("Disconnected"),
+ _("The network connection has been disconnected."),
+ "nm-no-connection",
+ PREF_DISABLE_DISCONNECTED_NOTIFICATIONS);
/* Fall through */
default:
break;
Modified: trunk/src/applet.h
==============================================================================
--- trunk/src/applet.h (original)
+++ trunk/src/applet.h Mon Nov 24 17:49:50 2008
@@ -64,6 +64,8 @@
} NMAppletClass;
#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 ICON_LAYER_LINK 0
#define ICON_LAYER_VPN 1
@@ -212,6 +214,12 @@
NotifyActionCallback action1_cb,
gpointer action1_user_data);
+void applet_do_notify_with_pref (NMApplet *applet,
+ const char *summary,
+ const char *message,
+ const char *icon,
+ const char *pref);
+
NMConnection * applet_find_active_connection_for_device (NMDevice *device,
NMApplet *applet,
NMActiveConnection **out_active);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]