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

« back to all changes in this revision

Viewing changes to .pc/lp829673_gconf_hide_applet.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:
81
81
#include "shell-watcher.h"
82
82
#include "nm-ui-utils.h"
83
83
 
 
84
#if WITH_MODEM_MANAGER_1
 
85
# include "applet-device-broadband.h"
 
86
#endif
 
87
 
84
88
#define NOTIFY_CAPS_ACTIONS_KEY "actions"
85
89
 
86
90
extern gboolean shell_debug;
191
195
                return FALSE;
192
196
        }
193
197
 
 
198
#if WITH_MODEM_MANAGER_1
 
199
        if (g_str_has_prefix (nm_device_get_udi (device), "/org/freedesktop/ModemManager1/Modem/")) {
 
200
                if (applet->mm1_running) {
 
201
                        applet_broadband_connect_network (applet, device);
 
202
                        return TRUE;
 
203
                }
 
204
 
 
205
                g_set_error_literal (error,
 
206
                                     NM_SECRET_AGENT_ERROR,
 
207
                                     NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
 
208
                                     "ModemManager was not found");
 
209
                return FALSE;
 
210
        }
 
211
#endif
 
212
 
194
213
        caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (device));
195
214
        if (caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS) {
196
215
                applet_gsm_connect_network (applet, device);
224
243
        else if (NM_IS_DEVICE_MODEM (device)) {
225
244
                NMDeviceModemCapabilities caps;
226
245
 
 
246
#if WITH_MODEM_MANAGER_1
 
247
                if (g_str_has_prefix (nm_device_get_udi (device), "/org/freedesktop/ModemManager1/Modem/")) {
 
248
                        if (applet->mm1_running)
 
249
                                return applet->broadband_class;
 
250
                        g_message ("%s: ModemManager was not found", __func__);
 
251
                        return NULL;
 
252
                }
 
253
#endif
 
254
 
227
255
                caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (device));
228
256
                if (caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS)
229
257
                        return applet->gsm_class;
259
287
                return applet->ethernet_class;
260
288
        else if (!strcmp (ctype, NM_SETTING_WIRELESS_SETTING_NAME))
261
289
                return applet->wifi_class;
 
290
#if WITH_MODEM_MANAGER_1
 
291
        else if (applet->mm1_running && (!strcmp (ctype, NM_SETTING_GSM_SETTING_NAME) || !strcmp (ctype, NM_SETTING_CDMA_SETTING_NAME)))
 
292
                return applet->broadband_class;
 
293
#endif
262
294
        else if (!strcmp (ctype, NM_SETTING_GSM_SETTING_NAME))
263
295
                return applet->gsm_class;
264
296
        else if (!strcmp (ctype, NM_SETTING_CDMA_SETTING_NAME))
916
948
 
917
949
#if HAVE_LIBNOTIFY_07
918
950
        notify_notification_set_hint (notify, "transient", g_variant_new_boolean (TRUE));
 
951
        notify_notification_set_hint (notify, "desktop-entry", g_variant_new_string ("nm-applet"));
919
952
#else
920
953
        notify_notification_attach_to_status_icon (notify, applet->status_icon);
921
954
#endif
2588
2621
        applet_schedule_update_icon (applet);
2589
2622
}
2590
2623
 
 
2624
#if WITH_MODEM_MANAGER_1
 
2625
 
 
2626
static void
 
2627
mm1_name_owner_changed_cb (GDBusObjectManagerClient *mm1,
 
2628
                           GParamSpec *pspec,
 
2629
                           NMApplet *applet)
 
2630
{
 
2631
        gchar *name_owner;
 
2632
 
 
2633
        name_owner = g_dbus_object_manager_client_get_name_owner (mm1);
 
2634
        applet->mm1_running = !!name_owner;
 
2635
        g_free (name_owner);
 
2636
}
 
2637
 
 
2638
static void
 
2639
mm1_client_setup (NMApplet *applet)
 
2640
{
 
2641
        GDBusConnection *system_bus;
 
2642
        GError *error = NULL;
 
2643
 
 
2644
        system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
 
2645
        if (!system_bus) {
 
2646
                g_warning ("Error connecting to system D-Bus: %s",
 
2647
                           error->message);
 
2648
                g_clear_error (&error);
 
2649
                return;
 
2650
        }
 
2651
 
 
2652
        applet->mm1 = (mm_manager_new_sync (
 
2653
                               system_bus,
 
2654
                               G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
 
2655
                               NULL,
 
2656
                               &error));
 
2657
        if (!applet->mm1) {
 
2658
                g_warning ("Error connecting to ModemManager: %s",
 
2659
                           error->message);
 
2660
                g_clear_error (&error);
 
2661
                return;
 
2662
        }
 
2663
 
 
2664
        /* Check whether the ModemManager is really running */
 
2665
        g_signal_connect (applet->mm1,
 
2666
                          "notify::name-owner",
 
2667
                          G_CALLBACK (mm1_name_owner_changed_cb),
 
2668
                          applet);
 
2669
        mm1_name_owner_changed_cb (G_DBUS_OBJECT_MANAGER_CLIENT (applet->mm1), NULL, applet);
 
2670
}
 
2671
 
 
2672
#endif /* WITH_MODEM_MANAGER_1 */
 
2673
 
2591
2674
static GdkPixbuf *
2592
2675
applet_common_get_device_icon (NMDeviceState state, NMApplet *applet)
2593
2676
{
3556
3639
        applet->cdma_class = applet_device_cdma_get_class (applet);
3557
3640
        g_assert (applet->cdma_class);
3558
3641
 
 
3642
#if WITH_MODEM_MANAGER_1
 
3643
        applet->broadband_class = applet_device_broadband_get_class (applet);
 
3644
        g_assert (applet->broadband_class);
 
3645
#endif
 
3646
 
3559
3647
        applet->bt_class = applet_device_bt_get_class (applet);
3560
3648
        g_assert (applet->bt_class);
3561
3649
 
3564
3652
 
3565
3653
        foo_client_setup (applet);
3566
3654
 
 
3655
#if WITH_MODEM_MANAGER_1
 
3656
        mm1_client_setup (applet);
 
3657
#endif
 
3658
 
3567
3659
        /* Track embedding to help debug issues where user has removed the
3568
3660
         * notification area applet from the panel, and thus nm-applet too.
3569
3661
         */
3595
3687
        g_slice_free (NMADeviceClass, applet->wifi_class);
3596
3688
        g_slice_free (NMADeviceClass, applet->gsm_class);
3597
3689
        g_slice_free (NMADeviceClass, applet->cdma_class);
 
3690
#if WITH_MODEM_MANAGER_1
 
3691
        g_slice_free (NMADeviceClass, applet->broadband_class);
 
3692
#endif
3598
3693
        g_slice_free (NMADeviceClass, applet->bt_class);
3599
3694
        g_slice_free (NMADeviceClass, applet->wimax_class);
3600
3695
 
3627
3722
        if (applet->nm_client)
3628
3723
                g_object_unref (applet->nm_client);
3629
3724
 
 
3725
#if WITH_MODEM_MANAGER_1
 
3726
        if (applet->mm1)
 
3727
                g_object_unref (applet->mm1);
 
3728
#endif
 
3729
 
3630
3730
        if (applet->fallback_icon)
3631
3731
                g_object_unref (applet->fallback_icon);
3632
3732