[network-manager-applet] all: propagate type for g_object_ref() and fix pointer types



commit 848cef051ffb28db4ad97df21bf1127e4fda9ea6
Author: Thomas Haller <thaller redhat com>
Date:   Thu Dec 21 10:01:30 2017 +0100

    all: propagate type for g_object_ref() and fix pointer types
    
    See related bug https://bugzilla.gnome.org/show_bug.cgi?id=790697.
    This was introduced by NetworkManager commit 7ca601d529329f756340961fcd153399b2f5063c.

 shared/nm-utils/nm-glib.h     |    5 +++++
 src/applet-device-broadband.c |    2 +-
 src/applet-device-wifi.c      |   10 +++++-----
 3 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/shared/nm-utils/nm-glib.h b/shared/nm-utils/nm-glib.h
index 4ef538e..599890e 100644
--- a/shared/nm-utils/nm-glib.h
+++ b/shared/nm-utils/nm-glib.h
@@ -481,4 +481,9 @@ _nm_g_variant_new_printf (const char *format_string, ...)
        })
 #endif
 
+#if !GLIB_CHECK_VERSION (2, 56, 0)
+#define g_object_ref(Obj)      ((typeof(Obj)) g_object_ref (Obj))
+#define g_object_ref_sink(Obj) ((typeof(Obj)) g_object_ref_sink (Obj))
+#endif
+
 #endif  /* __NM_GLIB_H__ */
diff --git a/src/applet-device-broadband.c b/src/applet-device-broadband.c
index 2afdbf1..da1790e 100644
--- a/src/applet-device-broadband.c
+++ b/src/applet-device-broadband.c
@@ -698,7 +698,7 @@ add_connection_item (NMDevice *device,
 
        info = g_slice_new0 (BroadbandMenuItemInfo);
        info->applet = applet;
-       info->device = g_object_ref (G_OBJECT (device));
+       info->device = g_object_ref (device);
        info->connection = connection ? g_object_ref (connection) : NULL;
 
        g_signal_connect_data (item, "activate",
diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c
index d0ea6a1..08ecef1 100644
--- a/src/applet-device-wifi.c
+++ b/src/applet-device-wifi.c
@@ -645,9 +645,9 @@ create_new_ap_item (NMDeviceWifi *device,
 
                        info = g_slice_new0 (WifiMenuItemInfo);
                        info->applet = applet;
-                       info->device = g_object_ref (G_OBJECT (device));
-                       info->ap = g_object_ref (G_OBJECT (ap));
-                       info->connection = g_object_ref (G_OBJECT (connection));
+                       info->device = g_object_ref (device);
+                       info->ap = g_object_ref (ap);
+                       info->connection = g_object_ref (connection);
 
                        g_signal_connect_data (subitem, "activate",
                                               G_CALLBACK (wifi_menu_item_activate),
@@ -664,8 +664,8 @@ create_new_ap_item (NMDeviceWifi *device,
 
                info = g_slice_new0 (WifiMenuItemInfo);
                info->applet = applet;
-               info->device = g_object_ref (G_OBJECT (device));
-               info->ap = g_object_ref (G_OBJECT (ap));
+               info->device = g_object_ref (device);
+               info->ap = g_object_ref (ap);
 
                if (ap_connections->len == 1) {
                        connection = NM_CONNECTION (ap_connections->pdata[0]);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]