[network-manager-applet] core: fix wording for action-less notification daemons (lp:383404)



commit 194899ece55837f9b1165f868401453d075aba22
Author: Dan Williams <dcbw redhat com>
Date:   Sat Sep 25 00:44:11 2010 -0500

    core: fix wording for action-less notification daemons (lp:383404)

 src/applet-device-wifi.c |    4 +++-
 src/applet.c             |   14 +++++---------
 src/applet.h             |    1 +
 3 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c
index 8548d4b..39c2f91 100644
--- a/src/applet-device-wifi.c
+++ b/src/applet-device-wifi.c
@@ -1046,7 +1046,9 @@ idle_check_avail_access_point_notification (gpointer datap)
 	applet_do_notify (applet,
 	                  NOTIFY_URGENCY_LOW,
 	                  _("Wireless Networks Available"),
-	                  _("Click on this icon to connect to a wireless network"),
+	                  applet->notify_actions ?
+	                        _("Click on this icon to connect to a wireless network") :
+	                        _("Use the network menu to connect to a wireless network"),
 	                  "nm-device-wireless",
 	                  "dont-show",
 	                  _("Don't show this message again"),
diff --git a/src/applet.c b/src/applet.c
index 30ea876..87a7ea2 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -577,15 +577,11 @@ applet_clear_notify (NMApplet *applet)
 }
 
 static gboolean
-applet_notify_server_has_actions ()
+applet_notify_server_has_actions (void)
 {
-	static gboolean queried = FALSE;
-	static gboolean has_actions = FALSE;
+	gboolean has_actions = FALSE;
 	GList *server_caps, *iter;
 
-	if (queried)
-		return has_actions;
-
 	server_caps = notify_get_server_caps();
 	for (iter = server_caps; iter; iter = g_list_next (iter)) {
 		if (!strcmp ((const char *) iter->data, NOTIFY_CAPS_ACTIONS_KEY)) {
@@ -593,10 +589,8 @@ applet_notify_server_has_actions ()
 			break;
 		}
 	}
-
 	g_list_foreach (server_caps, (GFunc) g_free, NULL);
 	g_list_free (server_caps);
-	queried = TRUE;
 
 	return has_actions;
 }
@@ -637,7 +631,7 @@ applet_do_notify (NMApplet *applet,
 	notify_notification_set_urgency (notify, urgency);
 	notify_notification_set_timeout (notify, NOTIFY_EXPIRES_DEFAULT);
 
-	if (applet_notify_server_has_actions () && action1) {
+	if (applet->notify_actions && action1) {
 		notify_notification_add_action (notify, action1, action1_label,
 		                                action1_cb, action1_user_data, NULL);
 	}
@@ -3085,6 +3079,8 @@ constructor (GType type,
 	                  G_CALLBACK (applet_embedded_cb), NULL);
 	applet_embedded_cb (G_OBJECT (applet->status_icon), NULL, NULL);
 
+	applet->notify_actions = applet_notify_server_has_actions ();
+
 	return G_OBJECT (applet);
 
 error:
diff --git a/src/applet.h b/src/applet.h
index 3324809..3270123 100644
--- a/src/applet.h
+++ b/src/applet.h
@@ -166,6 +166,7 @@ typedef struct
 
 	GladeXML *		info_dialog_xml;
 	NotifyNotification*	notification;
+	gboolean        notify_actions;
 } NMApplet;
 
 typedef void (*AppletNewAutoConnectionCallback) (NMConnection *connection,



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