[glib] gnetworkmonitornm: Check if network-manager is running
- From: Lars Uebernickel <larsu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gnetworkmonitornm: Check if network-manager is running
- Date: Tue, 13 Jan 2015 11:13:56 +0000 (UTC)
commit f7be461601ab51a9f29e1fd07692efb261d0104b
Author: Iain Lane <iain lane canonical com>
Date: Mon Jan 12 10:03:18 2015 +0000
gnetworkmonitornm: Check if network-manager is running
We were asking for properties on NM's dbus interface, but if NM is not
running then there won't be any. Check if the name has an owner before
doing anything to it.
https://bugzilla.gnome.org/show_bug.cgi?id=741653
gio/gnetworkmonitornm.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gio/gnetworkmonitornm.c b/gio/gnetworkmonitornm.c
index 73e2ed6..d052716 100644
--- a/gio/gnetworkmonitornm.c
+++ b/gio/gnetworkmonitornm.c
@@ -244,6 +244,7 @@ g_network_monitor_nm_initable_init (GInitable *initable,
GNetworkMonitorNM *nm = G_NETWORK_MONITOR_NM (initable);
GDBusProxy *proxy;
GInitableIface *parent_iface;
+ gchar *name_owner = NULL;
parent_iface = g_type_interface_peek_parent (G_NETWORK_MONITOR_NM_GET_INITABLE_IFACE (initable));
if (!parent_iface->init (initable, cancellable, error))
@@ -260,6 +261,16 @@ g_network_monitor_nm_initable_init (GInitable *initable,
if (!proxy)
return FALSE;
+ name_owner = g_dbus_proxy_get_name_owner (proxy);
+
+ if (!name_owner)
+ {
+ g_object_unref (proxy);
+ return FALSE;
+ }
+
+ g_free (name_owner);
+
/* Verify it has the PrimaryConnection and Connectivity properties */
if (!has_property (proxy, "Connectivity"))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]