[gedit/dbus2: 9/9] Use g_dbus_connection_invoke_method directly for service



commit 079ce5098e47733ef0b22e2ca29e2ea2ef65ec13
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date:   Mon May 3 17:51:32 2010 +0200

    Use g_dbus_connection_invoke_method directly for service

 gedit/gedit-dbus.c |   36 ++++++++++--------------------------
 1 files changed, 10 insertions(+), 26 deletions(-)
---
diff --git a/gedit/gedit-dbus.c b/gedit/gedit-dbus.c
index a4dc738..6223c64 100644
--- a/gedit/gedit-dbus.c
+++ b/gedit/gedit-dbus.c
@@ -136,7 +136,6 @@ activate_service (GeditDBus *dbus,
                   guint     *result)
 {
 	GDBusConnection *conn;
-	GDBusProxy *proxy;
 	GVariant *ret;
 
 	conn = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
@@ -146,32 +145,17 @@ activate_service (GeditDBus *dbus,
 		return GEDIT_DBUS_RESULT_FAILED;
 	}
 
-	proxy = g_dbus_proxy_new_sync (conn,
-	                               G_TYPE_DBUS_PROXY,
-	                               G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
-	                               G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
-	                               NULL,
-	                               "org.freedesktop.DBus",
-	                               "/org/freedesktop/DBus",
-	                               "org.freedesktop.DBus",
-	                               NULL,
-	                               NULL);
+	ret = g_dbus_connection_invoke_method_sync (conn,
+	                                            "org.freedesktop.DBus",
+	                                            "/org/freedesktop/DBus",
+	                                            "org.freedesktop.DBus",
+	                                            "StartServiceByName",
+	                                            g_variant_new ("(su)", "org.gnome.gedit", 0),
+	                                            G_DBUS_INVOKE_METHOD_FLAGS_NONE,
+	                                            -1,
+	                                            NULL,
+	                                            NULL);
 
-	if (!proxy)
-	{
-		g_object_unref (conn);
-		return GEDIT_DBUS_RESULT_FAILED;
-	}
-
-	ret = g_dbus_proxy_invoke_method_sync (proxy,
-	                                       "StartServiceByName",
-	                                       g_variant_new ("(su)", "org.gnome.gedit", 0),
-	                                       G_DBUS_INVOKE_METHOD_FLAGS_NONE,
-	                                       -1,
-	                                       NULL,
-	                                       NULL);
-
-	g_object_unref (proxy);
 	g_object_unref (conn);
 
 	if (ret)



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