~network-manager/network-manager-applet/ubuntu.0.7.1

« back to all changes in this revision

Viewing changes to patches/lp341684_device_sensitive_disconnect_notify.patch

  • Committer: Alexander Sack
  • Date: 2009-04-03 10:17:59 UTC
  • Revision ID: asac@ubuntu.com-20090403101759-9pszf150145zjiqh
* fix LP: #354420 - offline notification should have NOTIFY_URGENCY_CRITICAL;
  normal disconnect notifications get NOTIFY_URGENCY_NORMAL
  - update patches/lp341684_device_sensitive_disconnect_notify.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
=== modified file 'src/applet-device-wifi.c'
2
2
---
3
3
 src/applet-device-wifi.c |    4 +
4
 
 src/applet.c             |  134 +++++++++++++++++++++++++++++++++++++++++++++--
 
4
 src/applet.c             |  138 +++++++++++++++++++++++++++++++++++++++++++++--
5
5
 src/applet.h             |    2 
6
 
 3 files changed, 135 insertions(+), 5 deletions(-)
 
6
 3 files changed, 139 insertions(+), 5 deletions(-)
7
7
 
8
8
Index: network-manager-applet-0.7.1~rc3/src/applet-device-wifi.c
9
9
===================================================================
53
53
 #include <nm-connection.h>
54
54
 #include <nm-vpn-connection.h>
55
55
 #include <nm-setting-connection.h>
56
 
@@ -69,16 +70,28 @@
 
56
@@ -69,16 +70,29 @@
57
57
 #include "applet-dbus-manager.h"
58
58
 #include "utils.h"
59
59
 #include "gconf-helpers.h"
70
70
+  gchar* title;
71
71
+  const gchar* text;
72
72
+  const gchar* icon;
 
73
+  NotifyUrgency urgency;
73
74
+};
74
75
+
75
76
+typedef struct _OfflineNotificationContextInfo OfflineNotificationContextInfo;
82
83
        const GPtrArray *connections;
83
84
        int i;
84
85
 
85
 
@@ -1634,27 +1647,127 @@
 
86
@@ -1634,27 +1648,130 @@
86
87
                if (!gconf_connection || !nm_exported_connection_get_connection (NM_EXPORTED_CONNECTION (gconf_connection)))
87
88
                        continue;
88
89
 
94
95
+static gboolean
95
96
+select_merged_notification_text (OfflineNotificationContextInfo *info)
96
97
+{
 
98
+       info->urgency = NOTIFY_URGENCY_LOW;
97
99
+       /* only do something if this is about full offline state */
98
100
+       if(info->state != NM_STATE_UNKNOWN || info->device_state != NM_STATE_UNKNOWN) {
 
101
+               info->urgency = NOTIFY_URGENCY_NORMAL;
99
102
+               if (!info->title)
100
103
+                       info->title = g_strdup (_("Network"));
101
 
+               if (info->state == NM_STATE_DISCONNECTED || info->state == NM_STATE_ASLEEP)
 
104
+               if (info->state == NM_STATE_DISCONNECTED || info->state == NM_STATE_ASLEEP) {
 
105
+                       info->urgency = NOTIFY_URGENCY_CRITICAL;
102
106
+                       info->text = _("Disconnected - you are now offline");
103
 
+               else
 
107
+               } else
104
108
+                       info->text = _("Disconnected");
105
109
+
106
110
+               switch (info->device_type) {
129
133
+       NMApplet *applet = NM_APPLET (user_data);
130
134
+       OfflineNotificationContextInfo *info = applet->notification_queue_data;
131
135
+        if(select_merged_notification_text (info))
132
 
+               applet_do_notify (applet, NOTIFY_URGENCY_LOW, info->title, info->text, info->icon, NULL, NULL, NULL, applet);
 
136
+               applet_do_notify (applet, info->urgency, info->title, info->text, info->icon, NULL, NULL, NULL, applet);
133
137
+       else
134
138
+               g_debug("no notification because merged found that we have nothing to say (e.g. not offline)");
135
139
+       if (info->title)
210
214
                break;
211
215
        case NM_DEVICE_STATE_ACTIVATED:
212
216
                /* If the device activation was successful, update the corresponding
213
 
@@ -1712,23 +1825,36 @@
 
217
@@ -1712,23 +1829,36 @@
214
218
                                     applet);
215
219
 }
216
220