network-manager-applet r1228 - in branches/NETWORKMANAGER_APPLET_0_7: . src



Author: dcbw
Date: Fri Mar 20 12:54:57 2009
New Revision: 1228
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=1228&view=rev

Log:
2009-03-20  Alexander Sack <asac ubuntu com>

	* src/applet.c
	  src/applet.h
		- (constructor): check whether the notification server supports
			actions
		- (applet_do_notify): don't set a notification if the notification
			server doesn't support them



Modified:
   branches/NETWORKMANAGER_APPLET_0_7/ChangeLog
   branches/NETWORKMANAGER_APPLET_0_7/src/applet.c
   branches/NETWORKMANAGER_APPLET_0_7/src/applet.h

Modified: branches/NETWORKMANAGER_APPLET_0_7/src/applet.c
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/applet.c	(original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/applet.c	Fri Mar 20 12:54:57 2009
@@ -70,6 +70,7 @@
 #include "utils.h"
 #include "gconf-helpers.h"
 
+#define NOTIFY_CAPS_ACTIONS_KEY "actions"
 
 G_DEFINE_TYPE(NMApplet, nma, G_TYPE_OBJECT)
 
@@ -396,7 +397,7 @@
 	notify_notification_set_urgency (notify, urgency);
 	notify_notification_set_timeout (notify, NOTIFY_EXPIRES_DEFAULT);
 
-	if (action1) {
+	if (applet->notify_with_actions && action1) {
 		notify_notification_add_action (notify, action1, action1_label,
 		                                action1_cb, action1_user_data, NULL);
 	}
@@ -2477,6 +2478,7 @@
 {
 	NMApplet *applet;
 	AppletDBusManager *dbus_mgr;
+	GList *server_caps;
 
 	applet = NM_APPLET (G_OBJECT_CLASS (nma_parent_class)->constructor (type, n_props, construct_props));
 
@@ -2507,6 +2509,15 @@
 	if (!notify_is_initted ())
 		notify_init ("NetworkManager");
 
+	server_caps = notify_get_server_caps();
+	if (g_list_find (server_caps, NOTIFY_CAPS_ACTIONS_KEY))
+		applet->notify_with_actions = TRUE;
+	else
+		applet->notify_with_actions = FALSE;
+
+	g_list_foreach (server_caps, (GFunc) g_free, NULL);
+	g_list_free (server_caps);
+
 	dbus_mgr = applet_dbus_manager_get ();
 	if (dbus_mgr == NULL) {
 		nm_warning ("Couldn't initialize the D-Bus manager.");

Modified: branches/NETWORKMANAGER_APPLET_0_7/src/applet.h
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/applet.h	(original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/applet.h	Fri Mar 20 12:54:57 2009
@@ -143,6 +143,7 @@
 
 	GladeXML *		info_dialog_xml;
 	NotifyNotification*	notification;
+	gboolean		notify_with_actions;
 } NMApplet;
 
 



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