network-manager-applet r744 - in trunk: . src
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: network-manager-applet r744 - in trunk: . src
- Date: Fri, 6 Jun 2008 02:59:02 +0000 (UTC)
Author: dcbw
Date: Fri Jun 6 02:59:02 2008
New Revision: 744
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=744&view=rev
Log:
2008-06-05 Dan Williams <dcbw redhat com>
* src/applet.c
src/applet.h
- (applet_do_notify): add action support
* src/applet-device-wireless.c
- (wifi_available_dont_show_cb): suppress notification of APs when the
user says so
- (idle_check_avail_access_point_notification): add suppression action
- (queue_avail_access_point_notification): don't show the notificiation
if it's suppressed
* src/applet-device-gsm.c
src/applet-device-cdma.c
src/applet-device-wired.c
src/applet.c
- Fix for applet_do_notify() changes
Modified:
trunk/ChangeLog
trunk/src/applet-device-cdma.c
trunk/src/applet-device-gsm.c
trunk/src/applet-device-wired.c
trunk/src/applet-device-wireless.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 Fri Jun 6 02:59:02 2008
@@ -282,7 +282,7 @@
applet_do_notify (applet, NOTIFY_URGENCY_LOW,
_("Connection Established"),
_("You are now connected to the CDMA network."),
- "nm-device-wwan");
+ "nm-device-wwan", NULL, NULL, NULL, NULL);
}
}
Modified: trunk/src/applet-device-gsm.c
==============================================================================
--- trunk/src/applet-device-gsm.c (original)
+++ trunk/src/applet-device-gsm.c Fri Jun 6 02:59:02 2008
@@ -283,7 +283,7 @@
applet_do_notify (applet, NOTIFY_URGENCY_LOW,
_("Connection Established"),
_("You are now connected to the GSM network."),
- "nm-device-wwan");
+ "nm-device-wwan", NULL, NULL, NULL, NULL);
}
}
Modified: trunk/src/applet-device-wired.c
==============================================================================
--- trunk/src/applet-device-wired.c (original)
+++ trunk/src/applet-device-wired.c Fri Jun 6 02:59:02 2008
@@ -243,7 +243,7 @@
applet_do_notify (applet, NOTIFY_URGENCY_LOW,
_("Connection Established"),
_("You are now connected to the wired network."),
- "nm-device-wired");
+ "nm-device-wired", NULL, NULL, NULL, NULL);
}
}
Modified: trunk/src/applet-device-wireless.c
==============================================================================
--- trunk/src/applet-device-wireless.c (original)
+++ trunk/src/applet-device-wireless.c Fri Jun 6 02:59:02 2008
@@ -51,6 +51,8 @@
#include "gnome-keyring-md5.h"
#include "wireless-dialog.h"
+#define PREF_SUPPRESS_WIRELESS_NEWORKS_AVAILABLE APPLET_PREFS_PATH "/suppress-wireless-networks-available"
+
static void wireless_dialog_response_cb (GtkDialog *dialog, gint response, gpointer user_data);
static void
@@ -883,6 +885,23 @@
}
}
+static void
+wifi_available_dont_show_cb (NotifyNotification *notify,
+ gchar *id,
+ gpointer user_data)
+{
+ NMApplet *applet = NM_APPLET (user_data);
+
+ if (id || strcmp (id, "dont-show"))
+ return;
+
+ gconf_client_set_bool (applet->gconf_client,
+ PREF_SUPPRESS_WIRELESS_NEWORKS_AVAILABLE,
+ TRUE,
+ NULL);
+}
+
+
struct ap_notification_data
{
NMApplet *applet;
@@ -961,7 +980,11 @@
NOTIFY_URGENCY_LOW,
_("Wireless Networks Available"),
_("Click on this icon to connect to a wireless network"),
- "nm-device-wireless");
+ "nm-device-wireless",
+ "dont-show",
+ _("Don't show this message again"),
+ wifi_available_dont_show_cb,
+ applet);
return FALSE;
}
@@ -969,11 +992,16 @@
queue_avail_access_point_notification (NMDevice *device)
{
struct ap_notification_data *data;
- data = g_object_get_data (G_OBJECT (device), "notify-wireless-avail-data");
+ data = g_object_get_data (G_OBJECT (device), "notify-wireless-avail-data");
if (data->id != 0)
return;
+ if (gconf_client_get_bool (data->applet->gconf_client,
+ PREF_SUPPRESS_WIRELESS_NEWORKS_AVAILABLE,
+ NULL))
+ return;
+
data->id = g_timeout_add (3000, idle_check_avail_access_point_notification, data);
}
@@ -1030,7 +1058,7 @@
*/
g_signal_connect (applet_get_settings (applet), "new-connection",
G_CALLBACK (on_new_connection),
- data);
+ data);
queue_avail_access_point_notification (device);
/* Hash all APs this device knows about */
@@ -1103,7 +1131,7 @@
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");
+ msg, "nm-device-wireless", NULL, NULL, NULL, NULL);
g_free (msg);
g_free (esc_ssid);
}
Modified: trunk/src/applet.c
==============================================================================
--- trunk/src/applet.c (original)
+++ trunk/src/applet.c Fri Jun 6 02:59:02 2008
@@ -395,13 +395,18 @@
}
void
-applet_do_notify (NMApplet *applet,
+applet_do_notify (NMApplet *applet,
NotifyUrgency urgency,
const char *summary,
const char *message,
- const char *icon)
+ const char *icon,
+ const char *action1,
+ const char *action1_label,
+ NotifyActionCallback action1_cb,
+ gpointer action1_user_data)
{
- const char *notify_icon;
+ NotifyNotification *notify;
+ GError *error = NULL;
g_return_if_fail (applet != NULL);
g_return_if_fail (summary != NULL);
@@ -412,20 +417,27 @@
return;
#endif
- if (!notify_is_initted ())
- notify_init ("NetworkManager");
-
if (applet->notification != NULL) {
notify_notification_close (applet->notification, NULL);
g_object_unref (applet->notification);
}
- notify_icon = icon ? icon : GTK_STOCK_NETWORK;
+ notify = notify_notification_new (summary, message,
+ icon ? icon : GTK_STOCK_NETWORK, NULL);
+ applet->notification = notify;
+
+ notify_notification_attach_to_status_icon (notify, applet->status_icon);
+ notify_notification_set_urgency (notify, urgency);
- applet->notification = notify_notification_new_with_status_icon (summary, message, notify_icon, applet->status_icon);
+ if (action1) {
+ notify_notification_add_action (notify, action1, action1_label,
+ action1_cb, action1_user_data, NULL);
+ }
- notify_notification_set_urgency (applet->notification, urgency);
- notify_notification_show (applet->notification, NULL);
+ if (!notify_notification_show (notify, &error)) {
+ g_warning ("Failed to show notification: %s", error->message);
+ g_error_free (error);
+ }
}
static gboolean
@@ -563,7 +575,8 @@
if (banner && strlen (banner)) {
title = _("VPN Login Message");
msg = g_strdup_printf ("\n%s", banner);
- applet_do_notify (applet, NOTIFY_URGENCY_LOW, title, msg, "gnome-lockscreen");
+ applet_do_notify (applet, NOTIFY_URGENCY_LOW, title, msg,
+ "gnome-lockscreen", NULL, NULL, NULL, NULL);
g_free (msg);
}
@@ -574,14 +587,16 @@
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");
+ applet_do_notify (applet, NOTIFY_URGENCY_LOW, title, msg,
+ "gnome-lockscreen", NULL, NULL, NULL, NULL);
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");
+ applet_do_notify (applet, NOTIFY_URGENCY_LOW, title, msg,
+ "gnome-lockscreen", NULL, NULL, NULL, NULL);
g_free (msg);
}
break;
@@ -634,7 +649,8 @@
info->vpn_name, error->message);
}
- applet_do_notify (info->applet, NOTIFY_URGENCY_LOW, title, msg, "gnome-lockscreen");
+ applet_do_notify (info->applet, NOTIFY_URGENCY_LOW, title, msg,
+ "gnome-lockscreen", NULL, NULL, NULL, NULL);
g_free (msg);
nm_warning ("VPN Connection activation failed: (%s) %s", name, error->message);
@@ -1522,7 +1538,7 @@
case NM_STATE_DISCONNECTED:
applet_do_notify (applet, NOTIFY_URGENCY_NORMAL, _("Disconnected"),
_("The network connection has been disconnected."),
- "nm-no-connection");
+ "nm-no-connection", NULL, NULL, NULL, NULL);
/* Fall through */
default:
break;
@@ -2173,6 +2189,9 @@
goto error;
nma_icons_init (applet);
+ if (!notify_is_initted ())
+ notify_init ("NetworkManager");
+
dbus_mgr = applet_dbus_manager_get ();
if (dbus_mgr == NULL) {
nm_warning ("Couldn't initialize the D-Bus manager.");
Modified: trunk/src/applet.h
==============================================================================
--- trunk/src/applet.h (original)
+++ trunk/src/applet.h Fri Jun 6 02:59:02 2008
@@ -63,6 +63,7 @@
GObjectClass parent_class;
} NMAppletClass;
+#define APPLET_PREFS_PATH "/apps/nm-applet"
#define ICON_LAYER_LINK 0
#define ICON_LAYER_VPN 1
@@ -175,11 +176,15 @@
NMAGConfConnection *applet_get_exported_connection_for_device (NMDevice *device, NMApplet *applet);
-void applet_do_notify (NMApplet *applet,
+void applet_do_notify (NMApplet *applet,
NotifyUrgency urgency,
const char *summary,
const char *message,
- const char *icon);
+ const char *icon,
+ const char *action1,
+ const char *action1_label,
+ NotifyActionCallback action1_cb,
+ gpointer action1_user_data);
NMConnection * applet_find_active_connection_for_device (NMDevice *device,
NMApplet *applet,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]