[epiphany/gdbus: 5/6] ephy-main: adapt to ephy-dbus gdbus port



commit aa6c9d8f469e4ebcbd26041906a5792ef551bfcc
Author: Diego Escalante Urrelo <descalante igalia com>
Date:   Sat May 7 18:37:34 2011 -0500

    ephy-main: adapt to ephy-dbus gdbus port

 src/ephy-main.c |   48 ++++++++++++++++++++++--------------------------
 1 files changed, 22 insertions(+), 26 deletions(-)
---
diff --git a/src/ephy-main.c b/src/ephy-main.c
index 17ebb8f..4f9f103 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -27,7 +27,7 @@
 #include "ephy-state.h"
 #include "ephy-debug.h"
 #include "ephy-stock-icons.h"
-#include "ephy-dbus-client-bindings.h"
+#include "ephy-gdbus-bindings.h"
 #include "ephy-activation.h"
 #include "ephy-session.h"
 #include "ephy-shell.h"
@@ -199,16 +199,10 @@ slowly_and_stupidly_obtain_timestamp (Display *xdisplay)
 }
 
 static void
-unref_proxy_reply_cb (DBusGProxy *proxy,
-		      GError *error,
+unref_proxy_reply_cb (GObject *proxy,
+		      GAsyncResult *res,
 		      gpointer user_data)
 {
-	if (error != NULL)
-	{
-		g_warning ("An error occurred while calling remote method: %s", error->message);
-		g_error_free (error);
-	}
-
 	g_object_unref (proxy);
 
 	if (gtk_main_level ())
@@ -218,7 +212,7 @@ unref_proxy_reply_cb (DBusGProxy *proxy,
 }
 
 static gboolean
-open_urls (DBusGProxy *proxy,
+open_urls (GDBusProxy *proxy,
 	   guint32 user_time,
 	   GError **error)
 {
@@ -246,9 +240,10 @@ open_urls (DBusGProxy *proxy,
 		uris = (char **) arguments;
 	}
 
-	org_gnome_Epiphany_load_ur_ilist_async
-		(proxy, (const char **) uris, options->str, user_time,
-		 unref_proxy_reply_cb, NULL);
+	org_gnome_epiphany_call_load_urilist
+		(ORG_GNOME_EPIPHANY (proxy),
+		 (const char **) uris, options->str, user_time,
+		 NULL, unref_proxy_reply_cb, NULL);
 	
 	if (arguments != NULL)
 	{
@@ -262,26 +257,25 @@ open_urls (DBusGProxy *proxy,
 }
 
 static gboolean
-call_dbus_proxy (DBusGProxy *proxy,
+call_dbus_proxy (GDBusProxy *proxy,
 		 guint32 user_time,
 		 GError **error)
 {
-	EphyShell *shell;
 	gboolean retval = TRUE;
 
-	shell = ephy_shell_get_default ();
-
 	if (open_as_bookmarks_editor)
 	{
-		org_gnome_Epiphany_open_bookmarks_editor_async
-			(proxy, user_time,
-			 unref_proxy_reply_cb, shell);
+		org_gnome_epiphany_call_open_bookmarks_editor
+			(ORG_GNOME_EPIPHANY (proxy),
+			 user_time,
+			 NULL, unref_proxy_reply_cb, NULL);
 	}
 	else if (session_filename != NULL)
 	{
-		org_gnome_Epiphany_load_session_async
-			(proxy, session_filename, user_time,
-			 unref_proxy_reply_cb, shell);
+		org_gnome_epiphany_call_load_session
+			(ORG_GNOME_EPIPHANY (proxy),
+			 session_filename, user_time,
+			 NULL, unref_proxy_reply_cb, NULL);
 
 		g_free (session_filename);
 		session_filename = NULL;
@@ -291,8 +285,10 @@ call_dbus_proxy (DBusGProxy *proxy,
 		retval = open_urls (proxy, user_time, error);
 	}
 
-	/* FIXME why? */
-	dbus_g_connection_flush (ephy_dbus_get_bus (ephy_dbus_get_default (), EPHY_DBUS_SESSION));
+	/* Ensure this messages are processed, instead of (possibly) being
+	 * queued. */
+	g_dbus_connection_flush_sync (g_dbus_proxy_get_connection (proxy),
+				      NULL, NULL);
 
 	return retval;
 }
@@ -394,7 +390,7 @@ main (int argc,
 {
 	GOptionContext *option_context;
 	GOptionGroup *option_group;
-	DBusGProxy *proxy;
+	GDBusProxy *proxy;
 	GError *error = NULL;
 	guint32 user_time;
 	gboolean arbitrary_url;



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