~dylanmccall/ubuntu/oneiric/network-manager-applet/lp852961-disable-autostart-for-gnome-shell

« back to all changes in this revision

Viewing changes to src/applet-dbus.c

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Mercatante
  • Date: 2007-06-15 12:46:22 UTC
  • Revision ID: james.westby@ubuntu.com-20070615124622-01cyrnf0uxxun4lz
Tags: upstream-0.6.5
ImportĀ upstreamĀ versionĀ 0.6.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* NetworkManager Wireless Applet -- Display wireless access points and allow user control
 
2
 *
 
3
 * Dan Williams <dcbw@redhat.com>
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; either version 2 of the License, or
 
8
 * (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; if not, write to the Free Software
 
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
18
 *
 
19
 * (C) Copyright 2004 Red Hat, Inc.
 
20
 */
 
21
 
 
22
#ifdef HAVE_CONFIG_H
 
23
#include <config.h>
 
24
#endif
 
25
 
 
26
#include <glib.h>
 
27
#include <glib/gi18n.h>
 
28
#include <stdio.h>
 
29
#include <string.h>
 
30
#include <stdarg.h>
 
31
#include <dbus/dbus.h>
 
32
#include <dbus/dbus-glib-lowlevel.h>
 
33
#include "applet.h"
 
34
#include "applet-dbus.h"
 
35
#include "applet-dbus-devices.h"
 
36
#include "applet-dbus-vpn.h"
 
37
#include "applet-dbus-info.h"
 
38
#include "vpn-connection.h"
 
39
#include "passphrase-dialog.h"
 
40
#include "nm-utils.h"
 
41
 
 
42
#define DBUS_NO_SERVICE_ERROR                   "org.freedesktop.DBus.Error.ServiceDoesNotExist"
 
43
 
 
44
 
 
45
/*
 
46
 * nma_dbus_filter
 
47
 *
 
48
 */
 
49
static DBusHandlerResult nma_dbus_filter (DBusConnection *connection, DBusMessage *message, void *user_data)
 
50
{
 
51
        NMApplet        *applet = (NMApplet *)user_data;
 
52
        gboolean                         handled = TRUE;
 
53
 
 
54
        const char *            object_path;
 
55
        const char *            member;
 
56
        const char *            interface;
 
57
 
 
58
        g_return_val_if_fail (applet != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
 
59
        g_return_val_if_fail (connection != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
 
60
        g_return_val_if_fail (message != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
 
61
 
 
62
        if (!(object_path = dbus_message_get_path (message)))
 
63
                return FALSE;
 
64
        if (!(member = dbus_message_get_member (message)))
 
65
                return FALSE;
 
66
        if (!(interface = dbus_message_get_interface (message)))
 
67
                return FALSE;
 
68
 
 
69
        /* nm_info ("signal(): got signal op='%s' member='%s' interface='%s'", object_path, member, interface); */
 
70
 
 
71
        if (dbus_message_is_signal (message, DBUS_INTERFACE_LOCAL, "Disconnected"))
 
72
        {
 
73
                dbus_connection_unref (applet->connection);
 
74
                applet->connection = NULL;
 
75
                nma_set_running (applet, FALSE);
 
76
                if (!applet->connection_timeout_id)
 
77
                        nma_start_dbus_connection_watch (applet);
 
78
        }
 
79
        else if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged"))
 
80
        {
 
81
                char    *service;
 
82
                char            *old_owner;
 
83
                char            *new_owner;
 
84
 
 
85
                if (dbus_message_get_args (message, NULL,
 
86
                                                                DBUS_TYPE_STRING, &service,
 
87
                                                                DBUS_TYPE_STRING, &old_owner,
 
88
                                                                DBUS_TYPE_STRING, &new_owner,
 
89
                                                                DBUS_TYPE_INVALID))
 
90
                {
 
91
                        if (strcmp (service, NM_DBUS_SERVICE) == 0)
 
92
                        {
 
93
                                gboolean old_owner_good = (old_owner && (strlen (old_owner) > 0));
 
94
                                gboolean new_owner_good = (new_owner && (strlen (new_owner) > 0));
 
95
 
 
96
                                if (!old_owner_good && new_owner_good && !applet->nm_running)
 
97
                                {
 
98
                                        /* NetworkManager started up */
 
99
                                        nma_set_running (applet, TRUE);
 
100
                                        nma_set_state (applet, NM_STATE_DISCONNECTED);
 
101
 
 
102
                                        nma_dbus_update_nm_state (applet);
 
103
                                        nma_dbus_update_devices (applet);
 
104
                                        nma_dbus_update_dialup (applet);
 
105
                                        nma_dbus_vpn_update_vpn_connections (applet);
 
106
 
 
107
                                        /* Immediate redraw */
 
108
                                        nma_update_state (applet);
 
109
                                }
 
110
                                else if (old_owner_good && !new_owner_good)
 
111
                                {
 
112
                                        nma_set_state (applet, NM_STATE_DISCONNECTED);
 
113
                                        nma_set_running (applet, FALSE);
 
114
                                        nmi_passphrase_dialog_destroy (applet);
 
115
 
 
116
                                        /* One last redraw to capture new state before sleeping */
 
117
                                        nma_update_state (applet);
 
118
                                }
 
119
                        }
 
120
                }
 
121
        }
 
122
        else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, NM_DBUS_SIGNAL_STATE_CHANGE))
 
123
        {
 
124
                NMState state = NM_STATE_UNKNOWN;
 
125
 
 
126
                if (dbus_message_get_args (message, NULL, DBUS_TYPE_UINT32, &state, DBUS_TYPE_INVALID))
 
127
                {
 
128
                        NetworkDevice *act_dev = nma_get_first_active_device (applet->device_list);
 
129
 
 
130
                        /* If we've switched to connecting, update the active device to ensure that we have
 
131
                         * valid wireless network information for it.
 
132
                         */
 
133
                        if (state == NM_STATE_CONNECTING && act_dev && network_device_is_wireless (act_dev))
 
134
                        {
 
135
                                nma_dbus_device_update_one_device (applet, network_device_get_nm_path (act_dev));
 
136
                        }
 
137
                        nma_set_state (applet, state);
 
138
                }
 
139
        }
 
140
        else if (    dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceAdded")
 
141
                        || dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceActivating")
 
142
                        || dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceCarrierOn")
 
143
                        || dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceCarrierOff"))
 
144
        {
 
145
                char *path = NULL;
 
146
 
 
147
                if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID))
 
148
                        nma_dbus_device_update_one_device (applet, path);
 
149
        }
 
150
        else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNowActive"))
 
151
        {
 
152
                char *path = NULL;
 
153
                char *essid = NULL;
 
154
 
 
155
                if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_STRING, &essid, DBUS_TYPE_INVALID))
 
156
                        nma_dbus_device_activated (applet, path, essid);
 
157
                else if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID))
 
158
                        nma_dbus_device_activated (applet, path, NULL);
 
159
        }
 
160
        else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNoLongerActive"))
 
161
        {
 
162
                char *path = NULL;
 
163
 
 
164
                if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID))
 
165
                        nma_dbus_device_deactivated (applet, path);
 
166
        }
 
167
        else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceRemoved"))
 
168
        {
 
169
                char *path = NULL;
 
170
 
 
171
                if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID))
 
172
                        nma_dbus_device_remove_one_device (applet, path);
 
173
        }
 
174
        else if (    dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, "VPNConnectionAdded")
 
175
                        || dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, "VPNConnectionUpdate"))      /* VPN connection properties changed */
 
176
        {
 
177
                char *name = NULL;
 
178
 
 
179
                if (dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID))
 
180
                        nma_dbus_vpn_update_one_vpn_connection (applet, name);
 
181
        }
 
182
        else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, "VPNConnectionStateChange"))   /* Active VPN connection changed */
 
183
        {
 
184
                char *          name = NULL;
 
185
                NMVPNActStage   vpn_stage;
 
186
                dbus_uint32_t   vpn_stage_int;
 
187
 
 
188
                if (dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &name, DBUS_TYPE_UINT32, &vpn_stage_int, DBUS_TYPE_INVALID))
 
189
                {
 
190
                        vpn_stage = (NMVPNActStage) vpn_stage_int;
 
191
                        nma_dbus_vpn_update_vpn_connection_stage (applet, name, vpn_stage);
 
192
                }
 
193
        }
 
194
        else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, "VPNConnectionRemoved"))
 
195
        {
 
196
                char *name = NULL;
 
197
 
 
198
                if (dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID))
 
199
                        nma_dbus_vpn_remove_one_vpn_connection (applet, name);
 
200
        }
 
201
        else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "WirelessNetworkAppeared"))
 
202
        {
 
203
                char *dev_path = NULL;
 
204
                char *net_path = NULL;
 
205
 
 
206
                if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &dev_path, DBUS_TYPE_OBJECT_PATH, &net_path, DBUS_TYPE_INVALID))
 
207
                        nma_dbus_device_update_one_network (applet, dev_path, net_path, NULL);
 
208
        }
 
209
        else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "WirelessNetworkDisappeared"))
 
210
        {
 
211
                char *dev_path = NULL;
 
212
                char *net_path = NULL;
 
213
 
 
214
                if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &dev_path, DBUS_TYPE_OBJECT_PATH, &net_path, DBUS_TYPE_INVALID))
 
215
                        nma_dbus_device_remove_one_network (applet, dev_path, net_path);
 
216
        }
 
217
        else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "WirelessNetworkStrengthChanged"))
 
218
        {
 
219
                char *  dev_path = NULL;
 
220
                char *  net_path = NULL;
 
221
                int             strength = -1;
 
222
 
 
223
                if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &dev_path, DBUS_TYPE_OBJECT_PATH, &net_path, DBUS_TYPE_INT32, &strength, DBUS_TYPE_INVALID))
 
224
                        nma_dbus_update_strength (applet, dev_path, net_path, strength);
 
225
        }
 
226
        else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceStrengthChanged"))
 
227
        {
 
228
                char *dev_path = NULL;
 
229
                int strength = -1;
 
230
                if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &dev_path, DBUS_TYPE_INT32, &strength, DBUS_TYPE_INVALID))
 
231
                        nma_dbus_update_strength (applet, dev_path, NULL, strength);
 
232
        }
 
233
        else if (    dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, NM_DBUS_VPN_SIGNAL_LOGIN_FAILED)
 
234
                        || dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, NM_DBUS_VPN_SIGNAL_LAUNCH_FAILED)
 
235
                        || dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, NM_DBUS_VPN_SIGNAL_CONNECT_FAILED)
 
236
                        || dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, NM_DBUS_VPN_SIGNAL_VPN_CONFIG_BAD)
 
237
                        || dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, NM_DBUS_VPN_SIGNAL_IP_CONFIG_BAD))
 
238
        {
 
239
                char *vpn_name;
 
240
                char *error_msg;
 
241
 
 
242
                if (dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &vpn_name, DBUS_TYPE_STRING, &error_msg, DBUS_TYPE_INVALID)) {
 
243
                        nma_show_vpn_failure_alert (applet, member, vpn_name, error_msg);
 
244
                        /* clear the 'last_attempt_success' key in gconf so we prompt for password next time */
 
245
                        nma_dbus_vpn_set_last_attempt_status (applet, vpn_name, FALSE);
 
246
                }
 
247
        }
 
248
        else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE_VPN, NM_DBUS_VPN_SIGNAL_LOGIN_BANNER))
 
249
        {
 
250
                char *vpn_name;
 
251
                char *banner;
 
252
 
 
253
                if (dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &vpn_name, DBUS_TYPE_STRING, &banner, DBUS_TYPE_INVALID))
 
254
                {
 
255
                        char *stripped = g_strstrip (g_strdup (banner));
 
256
 
 
257
                        nma_show_vpn_login_banner (applet, vpn_name, stripped);
 
258
                        g_free (stripped);
 
259
 
 
260
                        /* set the 'last_attempt_success' key in gconf so we DON'T prompt for password next time */
 
261
                        nma_dbus_vpn_set_last_attempt_status (applet, vpn_name, TRUE);
 
262
                }
 
263
        }
 
264
        else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceActivationFailed"))
 
265
        {
 
266
                char            *dev = NULL;
 
267
                char            *net = NULL;
 
268
 
 
269
                if (!dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &dev, DBUS_TYPE_STRING, &net, DBUS_TYPE_INVALID))
 
270
                        dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &dev, DBUS_TYPE_INVALID);
 
271
 
 
272
                if (dev && net)
 
273
                {
 
274
                        char *string = g_strdup_printf (_("Connection to the wireless network '%s' failed."), net);
 
275
                        nma_schedule_warning_dialog (applet, string);
 
276
                        g_free (string);
 
277
                }
 
278
                else if (dev)
 
279
                        nma_schedule_warning_dialog (applet, _("Connection to the wired network failed."));
 
280
        }
 
281
        else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceActivationStage"))
 
282
        {
 
283
                char *          dev_path = NULL;
 
284
                NMActStage      stage;
 
285
 
 
286
                if (dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &dev_path, DBUS_TYPE_UINT32, &stage, DBUS_TYPE_INVALID))
 
287
                {
 
288
                        NetworkDevice *dev;
 
289
 
 
290
                        if ((dev = nma_get_device_for_nm_path (applet->device_list, dev_path)))
 
291
                                network_device_set_act_stage (dev, stage);
 
292
                }
 
293
        }
 
294
        else
 
295
                handled = FALSE;
 
296
 
 
297
        return (handled ? DBUS_HANDLER_RESULT_HANDLED : DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
 
298
}
 
299
 
 
300
 
 
301
/*
 
302
 * nma_dbus_nm_is_running
 
303
 *
 
304
 * Ask dbus whether or not NetworkManager is running
 
305
 *
 
306
 */
 
307
static gboolean nma_dbus_nm_is_running (DBusConnection *connection)
 
308
{
 
309
        DBusError               error;
 
310
        gboolean                exists;
 
311
 
 
312
        g_return_val_if_fail (connection != NULL, FALSE);
 
313
 
 
314
        dbus_error_init (&error);
 
315
        exists = dbus_bus_name_has_owner (connection, NM_DBUS_SERVICE, &error);
 
316
        if (dbus_error_is_set (&error))
 
317
                dbus_error_free (&error);
 
318
        return (exists);
 
319
}
 
320
 
 
321
 
 
322
/*
 
323
 * nma_dbus_init
 
324
 *
 
325
 * Initialize a connection to NetworkManager if we can get one
 
326
 *
 
327
 */
 
328
static DBusConnection * nma_dbus_init (NMApplet *applet)
 
329
{
 
330
        DBusConnection  *               connection = NULL;
 
331
        DBusError                               error;
 
332
        DBusObjectPathVTable    vtable = { NULL, &nmi_dbus_info_message_handler, NULL, NULL, NULL, NULL };
 
333
        int                                     acquisition;
 
334
        dbus_bool_t                     success = FALSE;
 
335
 
 
336
        g_return_val_if_fail (applet != NULL, NULL);
 
337
 
 
338
        dbus_error_init (&error);
 
339
        connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
 
340
        if (dbus_error_is_set (&error)) {
 
341
                nm_warning ("%s raised:\n %s\n\n", error.name, error.message);
 
342
                goto error;
 
343
        }
 
344
 
 
345
        dbus_error_init (&error);
 
346
        acquisition = dbus_bus_request_name (connection,
 
347
                                             NMI_DBUS_SERVICE,
 
348
                                             DBUS_NAME_FLAG_REPLACE_EXISTING,
 
349
                                             &error);
 
350
        if (dbus_error_is_set (&error)) {
 
351
                nm_warning ("could not acquire its service.  dbus_bus_acquire_service()"
 
352
                            " says: '%s'",
 
353
                            error.message);
 
354
                goto error;
 
355
        }
 
356
        if (acquisition == DBUS_REQUEST_NAME_REPLY_EXISTS)
 
357
                goto error;
 
358
 
 
359
        success = dbus_connection_register_object_path (connection,
 
360
                                                        NMI_DBUS_PATH,
 
361
                                                        &vtable,
 
362
                                                        applet);
 
363
        if (!success) {
 
364
                nm_warning ("could not register a messgae handler for the"
 
365
                            " NetworkManagerInfo service.  Not enough memory?");
 
366
                goto error;
 
367
        }
 
368
 
 
369
        success = dbus_connection_add_filter (connection, nma_dbus_filter, applet, NULL);
 
370
        if (!success)
 
371
                goto error;
 
372
 
 
373
        dbus_connection_set_exit_on_disconnect (connection, FALSE);
 
374
        dbus_connection_setup_with_g_main (connection, NULL);
 
375
 
 
376
        dbus_error_init (&error);
 
377
        dbus_bus_add_match(connection,
 
378
                                "type='signal',"
 
379
                                "interface='" DBUS_INTERFACE_DBUS "',"
 
380
                                "sender='" DBUS_SERVICE_DBUS "'",
 
381
                                &error);
 
382
        if (dbus_error_is_set (&error)) {
 
383
                nm_warning ("Could not register signal handlers.  '%s'",
 
384
                            error.message);
 
385
                goto error;
 
386
        }
 
387
 
 
388
        dbus_error_init (&error);
 
389
        dbus_bus_add_match(connection,
 
390
                                "type='signal',"
 
391
                                "interface='" NM_DBUS_INTERFACE "',"
 
392
                                "path='" NM_DBUS_PATH "',"
 
393
                                "sender='" NM_DBUS_SERVICE "'",
 
394
                                &error);
 
395
        if (dbus_error_is_set (&error)) {
 
396
                nm_warning ("Could not register signal handlers.  '%s'",
 
397
                            error.message);
 
398
                goto error;
 
399
        }
 
400
 
 
401
        dbus_error_init (&error);
 
402
        dbus_bus_add_match(connection,
 
403
                                "type='signal',"
 
404
                                "interface='" NM_DBUS_INTERFACE_VPN "',"
 
405
                                "path='" NM_DBUS_PATH_VPN "',"
 
406
                                "sender='" NM_DBUS_SERVICE "'",
 
407
                                &error);
 
408
        if (dbus_error_is_set (&error)) {
 
409
                nm_warning ("Could not register signal handlers.  '%s'",
 
410
                            error.message);
 
411
                goto error;
 
412
        }
 
413
 
 
414
        return connection;
 
415
 
 
416
error:
 
417
        if (dbus_error_is_set (&error))
 
418
                dbus_error_free (&error);
 
419
        if (connection)
 
420
                dbus_connection_unref (connection);
 
421
        return NULL;
 
422
}
 
423
 
 
424
 
 
425
/*
 
426
 * nma_dbus_connection_watcher
 
427
 *
 
428
 * Try to reconnect if we ever get disconnected from the bus
 
429
 *
 
430
 */
 
431
static gboolean
 
432
nma_dbus_connection_watcher (gpointer user_data)
 
433
{
 
434
        NMApplet * applet = (NMApplet *)user_data;
 
435
 
 
436
        g_return_val_if_fail (applet != NULL, TRUE);
 
437
 
 
438
        nma_dbus_init_helper (applet);
 
439
        if (applet->connection) {
 
440
                applet->connection_timeout_id = 0;
 
441
                return FALSE;  /* Remove timeout */
 
442
        }
 
443
 
 
444
        return TRUE;
 
445
}
 
446
 
 
447
 
 
448
void
 
449
nma_start_dbus_connection_watch (NMApplet *applet)
 
450
{
 
451
        if (applet->connection_timeout_id)
 
452
                g_source_remove (applet->connection_timeout_id);
 
453
 
 
454
        applet->connection_timeout_id = g_timeout_add (5000,
 
455
                                                       (GSourceFunc) nma_dbus_connection_watcher,
 
456
                                                       applet);
 
457
}
 
458
 
 
459
 
 
460
/*
 
461
 * nma_dbus_init_helper
 
462
 *
 
463
 * Set up the applet's NMI dbus methods and dbus connection
 
464
 *
 
465
 */
 
466
void
 
467
nma_dbus_init_helper (NMApplet *applet)
 
468
{
 
469
        g_return_if_fail (applet != NULL);
 
470
 
 
471
        applet->connection = nma_dbus_init (applet);
 
472
        if (applet->connection) {
 
473
                if (applet->connection_timeout_id) {
 
474
                        g_source_remove (applet->connection_timeout_id);
 
475
                        applet->connection_timeout_id = 0;
 
476
                }
 
477
 
 
478
                if (nma_dbus_nm_is_running (applet->connection)) {
 
479
                        nma_set_running (applet, TRUE);
 
480
                        nma_dbus_update_nm_state (applet);
 
481
                        nma_dbus_update_devices (applet);
 
482
                        nma_dbus_update_dialup (applet);
 
483
                        nma_dbus_vpn_update_vpn_connections (applet);
 
484
 
 
485
                        /* Immediate redraw */
 
486
                        nma_update_state (applet);
 
487
                }
 
488
        }
 
489
}