~ubuntu-branches/ubuntu/saucy/network-manager-applet/saucy-updates

« back to all changes in this revision

Viewing changes to .pc/lp341684_device_sensitive_disconnect_notify.patch/src/applet.c

  • Committer: Package Import Robot
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2013-02-05 16:15:00 UTC
  • mfrom: (1.2.33)
  • Revision ID: package-import@ubuntu.com-20130205161500-nax1yrh7klr0o8ir
Tags: 0.9.7.995+git201301311844.0376019-0ubuntu1
* upstream snapshot 2013-01-31 18:44:13 (GMT)
  + 03760194e54eaeaf493e9b45c4835e84524d8650
* debian/patches/nm-applet-use-indicator.patch: refreshed.
* debian/patches/lp1048516_dont_req_keyring_in_greeter.patch: refreshed.
* debian/patches/lp289466_always_show_tray_icon.patch: refreshed.
* debian/patches/lp829673_gconf_hide_applet.patch: refreshed.
* debian/patches/position_dialogs_to_center_of_the_screen.patch: refreshed.
* debian/patches/hide_policy_items_env_var.patch: refreshed.
* debian/patches/lp1048520_delay_pin_dialog_in_greeter.patch: refreshed.
* debian/patches/nm-applet-use-indicator.patch: fix the addition of separator
  menu items to avoid multiple separators added in a block.
* debian/control: bump network-manager Depends and Build-Depends to the
  appropriate snapshot version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
#include "shell-watcher.h"
81
81
#include "nm-ui-utils.h"
82
82
 
 
83
#if WITH_MODEM_MANAGER_1
 
84
# include "applet-device-broadband.h"
 
85
#endif
 
86
 
83
87
#define NOTIFY_CAPS_ACTIONS_KEY "actions"
84
88
 
85
89
extern gboolean shell_debug;
190
194
                return FALSE;
191
195
        }
192
196
 
 
197
#if WITH_MODEM_MANAGER_1
 
198
        if (g_str_has_prefix (nm_device_get_udi (device), "/org/freedesktop/ModemManager1/Modem/")) {
 
199
                if (applet->mm1_running) {
 
200
                        applet_broadband_connect_network (applet, device);
 
201
                        return TRUE;
 
202
                }
 
203
 
 
204
                g_set_error_literal (error,
 
205
                                     NM_SECRET_AGENT_ERROR,
 
206
                                     NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
 
207
                                     "ModemManager was not found");
 
208
                return FALSE;
 
209
        }
 
210
#endif
 
211
 
193
212
        caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (device));
194
213
        if (caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS) {
195
214
                applet_gsm_connect_network (applet, device);
223
242
        else if (NM_IS_DEVICE_MODEM (device)) {
224
243
                NMDeviceModemCapabilities caps;
225
244
 
 
245
#if WITH_MODEM_MANAGER_1
 
246
                if (g_str_has_prefix (nm_device_get_udi (device), "/org/freedesktop/ModemManager1/Modem/")) {
 
247
                        if (applet->mm1_running)
 
248
                                return applet->broadband_class;
 
249
                        g_message ("%s: ModemManager was not found", __func__);
 
250
                        return NULL;
 
251
                }
 
252
#endif
 
253
 
226
254
                caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (device));
227
255
                if (caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS)
228
256
                        return applet->gsm_class;
258
286
                return applet->ethernet_class;
259
287
        else if (!strcmp (ctype, NM_SETTING_WIRELESS_SETTING_NAME))
260
288
                return applet->wifi_class;
 
289
#if WITH_MODEM_MANAGER_1
 
290
        else if (applet->mm1_running && (!strcmp (ctype, NM_SETTING_GSM_SETTING_NAME) || !strcmp (ctype, NM_SETTING_CDMA_SETTING_NAME)))
 
291
                return applet->broadband_class;
 
292
#endif
261
293
        else if (!strcmp (ctype, NM_SETTING_GSM_SETTING_NAME))
262
294
                return applet->gsm_class;
263
295
        else if (!strcmp (ctype, NM_SETTING_CDMA_SETTING_NAME))
904
936
 
905
937
#if HAVE_LIBNOTIFY_07
906
938
        notify_notification_set_hint (notify, "transient", g_variant_new_boolean (TRUE));
 
939
        notify_notification_set_hint (notify, "desktop-entry", g_variant_new_string ("nm-applet"));
907
940
#else
908
941
        notify_notification_attach_to_status_icon (notify, applet->status_icon);
909
942
#endif
2457
2490
        applet_schedule_update_icon (applet);
2458
2491
}
2459
2492
 
 
2493
#if WITH_MODEM_MANAGER_1
 
2494
 
 
2495
static void
 
2496
mm1_name_owner_changed_cb (GDBusObjectManagerClient *mm1,
 
2497
                           GParamSpec *pspec,
 
2498
                           NMApplet *applet)
 
2499
{
 
2500
        gchar *name_owner;
 
2501
 
 
2502
        name_owner = g_dbus_object_manager_client_get_name_owner (mm1);
 
2503
        applet->mm1_running = !!name_owner;
 
2504
        g_free (name_owner);
 
2505
}
 
2506
 
 
2507
static void
 
2508
mm1_client_setup (NMApplet *applet)
 
2509
{
 
2510
        GDBusConnection *system_bus;
 
2511
        GError *error = NULL;
 
2512
 
 
2513
        system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
 
2514
        if (!system_bus) {
 
2515
                g_warning ("Error connecting to system D-Bus: %s",
 
2516
                           error->message);
 
2517
                g_clear_error (&error);
 
2518
                return;
 
2519
        }
 
2520
 
 
2521
        applet->mm1 = (mm_manager_new_sync (
 
2522
                               system_bus,
 
2523
                               G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
 
2524
                               NULL,
 
2525
                               &error));
 
2526
        if (!applet->mm1) {
 
2527
                g_warning ("Error connecting to ModemManager: %s",
 
2528
                           error->message);
 
2529
                g_clear_error (&error);
 
2530
                return;
 
2531
        }
 
2532
 
 
2533
        /* Check whether the ModemManager is really running */
 
2534
        g_signal_connect (applet->mm1,
 
2535
                          "notify::name-owner",
 
2536
                          G_CALLBACK (mm1_name_owner_changed_cb),
 
2537
                          applet);
 
2538
        mm1_name_owner_changed_cb (G_DBUS_OBJECT_MANAGER_CLIENT (applet->mm1), NULL, applet);
 
2539
}
 
2540
 
 
2541
#endif /* WITH_MODEM_MANAGER_1 */
 
2542
 
2460
2543
static GdkPixbuf *
2461
2544
applet_common_get_device_icon (NMDeviceState state, NMApplet *applet)
2462
2545
{
3427
3510
        applet->cdma_class = applet_device_cdma_get_class (applet);
3428
3511
        g_assert (applet->cdma_class);
3429
3512
 
 
3513
#if WITH_MODEM_MANAGER_1
 
3514
        applet->broadband_class = applet_device_broadband_get_class (applet);
 
3515
        g_assert (applet->broadband_class);
 
3516
#endif
 
3517
 
3430
3518
        applet->bt_class = applet_device_bt_get_class (applet);
3431
3519
        g_assert (applet->bt_class);
3432
3520
 
3435
3523
 
3436
3524
        foo_client_setup (applet);
3437
3525
 
 
3526
#if WITH_MODEM_MANAGER_1
 
3527
        mm1_client_setup (applet);
 
3528
#endif
 
3529
 
3438
3530
        /* Track embedding to help debug issues where user has removed the
3439
3531
         * notification area applet from the panel, and thus nm-applet too.
3440
3532
         */
3466
3558
        g_slice_free (NMADeviceClass, applet->wifi_class);
3467
3559
        g_slice_free (NMADeviceClass, applet->gsm_class);
3468
3560
        g_slice_free (NMADeviceClass, applet->cdma_class);
 
3561
#if WITH_MODEM_MANAGER_1
 
3562
        g_slice_free (NMADeviceClass, applet->broadband_class);
 
3563
#endif
3469
3564
        g_slice_free (NMADeviceClass, applet->bt_class);
3470
3565
        g_slice_free (NMADeviceClass, applet->wimax_class);
3471
3566
 
3498
3593
        if (applet->nm_client)
3499
3594
                g_object_unref (applet->nm_client);
3500
3595
 
 
3596
#if WITH_MODEM_MANAGER_1
 
3597
        if (applet->mm1)
 
3598
                g_object_unref (applet->mm1);
 
3599
#endif
 
3600
 
3501
3601
        if (applet->fallback_icon)
3502
3602
                g_object_unref (applet->fallback_icon);
3503
3603