aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-02-01 04:03:38 +0800
committerChristian Persch <chpe@src.gnome.org>2006-02-01 04:03:38 +0800
commit0541bcb1e3d64c8ebbd9d514641917def2515f97 (patch)
tree65c59efdb54212cceea1d0bbdf7cf87da776fe59
parentf6afe77cb705b9ba2f356ed3d44bdc0201887e4f (diff)
downloadgsoc2013-epiphany-0541bcb1e3d64c8ebbd9d514641917def2515f97.tar
gsoc2013-epiphany-0541bcb1e3d64c8ebbd9d514641917def2515f97.tar.gz
gsoc2013-epiphany-0541bcb1e3d64c8ebbd9d514641917def2515f97.tar.bz2
gsoc2013-epiphany-0541bcb1e3d64c8ebbd9d514641917def2515f97.tar.lz
gsoc2013-epiphany-0541bcb1e3d64c8ebbd9d514641917def2515f97.tar.xz
gsoc2013-epiphany-0541bcb1e3d64c8ebbd9d514641917def2515f97.tar.zst
gsoc2013-epiphany-0541bcb1e3d64c8ebbd9d514641917def2515f97.zip
Change the DBUS interface to sending all the uris at one as string array.
2006-01-31 Christian Persch <chpe@cvs.gnome.org> * data/epiphany-service.xml: * src/ephy-activation.c: (ephy_activation_load_uris): * src/ephy-activation.h: * src/ephy-main.c: (unref_proxy_reply_cb), (open_urls): Change the DBUS interface to sending all the uris at one as string array.
-rw-r--r--ChangeLog10
-rw-r--r--data/epiphany-service.xml4
-rw-r--r--src/ephy-activation.c65
-rw-r--r--src/ephy-activation.h4
-rw-r--r--src/ephy-main.c55
5 files changed, 78 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index a4640676a..6d31f4873 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2006-01-31 Christian Persch <chpe@cvs.gnome.org>
+
+ * data/epiphany-service.xml:
+ * src/ephy-activation.c: (ephy_activation_load_uris):
+ * src/ephy-activation.h:
+ * src/ephy-main.c: (unref_proxy_reply_cb), (open_urls):
+
+ Change the DBUS interface to sending all the uris at one
+ as string array.
+
2006-01-31 Peter Harvey <peter.a.harvey@gmail.com>
* lib/egg/egg-toolbars-model.c
diff --git a/data/epiphany-service.xml b/data/epiphany-service.xml
index e5fb0b44d..049536f27 100644
--- a/data/epiphany-service.xml
+++ b/data/epiphany-service.xml
@@ -5,8 +5,8 @@
<arg type="s"/>
<arg type="u"/>
</method>
- <method name="loadUrl">
- <arg type="s"/>
+ <method name="loadUris">
+ <arg type="as"/>
<arg type="s"/>
<arg type="u"/>
</method>
diff --git a/src/ephy-activation.c b/src/ephy-activation.c
index b7cb4a54a..8ad478748 100644
--- a/src/ephy-activation.c
+++ b/src/ephy-activation.c
@@ -32,25 +32,33 @@
#include <string.h>
gboolean
-ephy_activation_load_url (EphyDbus *ephy_dbus,
- char *url,
- char *options,
- guint startup_id,
- GError **error)
+ephy_activation_load_uris (EphyDbus *ephy_dbus,
+ char **uris,
+ char *options,
+ guint startup_id,
+ GError **error)
{
+ EphyShell *shell;
+ EphySession *session;
EphyNewTabFlags flags = 0;
EphyWindow *window;
- EphySession *session;
+ EphyTab *tab;
+ static char *empty_urls[] = { "", NULL };
guint32 user_time = (guint32) startup_id;
+ guint i;
- g_return_val_if_fail (url != NULL && options != NULL, TRUE);
+ g_return_val_if_fail (uris != NULL && options != NULL, TRUE);
- session = EPHY_SESSION (ephy_shell_get_session (ephy_shell));
- g_return_val_if_fail (session != NULL, TRUE);
+ shell = ephy_shell_get_default ();
+
+ g_object_ref (shell);
+
+ session = EPHY_SESSION (ephy_shell_get_session (shell));
+ g_assert (session != NULL);
if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL))
{
- url = "";
+ uris = empty_urls;
}
window = ephy_session_get_active_window (session);
@@ -65,15 +73,6 @@ ephy_activation_load_url (EphyDbus *ephy_dbus,
}
#endif
- if (url[0] == '\0')
- {
- flags |= EPHY_NEW_TAB_HOME_PAGE;
- }
- else
- {
- flags |= EPHY_NEW_TAB_OPEN_PAGE;
- }
-
if (strstr (options, "new-window") != NULL)
{
window = NULL;
@@ -85,8 +84,32 @@ ephy_activation_load_url (EphyDbus *ephy_dbus,
EPHY_NEW_TAB_JUMP;
}
- ephy_shell_new_tab_full (ephy_shell, window, NULL, url, flags,
- EPHY_EMBED_CHROME_ALL, FALSE, user_time);
+ for (i = 0; uris[i] != NULL; ++i)
+ {
+ const char *url = uris[i];
+ EphyNewTabFlags page_flags;
+
+ if (url[0] == '\0')
+ {
+ page_flags = EPHY_NEW_TAB_HOME_PAGE;
+ }
+ else
+ {
+ page_flags = EPHY_NEW_TAB_OPEN_PAGE;
+ }
+
+ tab = ephy_shell_new_tab_full (shell,window,
+ NULL, url,
+ flags | page_flags,
+ EPHY_EMBED_CHROME_ALL,
+ FALSE, user_time);
+
+ window = EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tab)));
+ }
+
+ g_object_unref (shell);
+
+ /* FIXME: do we have to g_strfreev (uris) ? */
return TRUE;
}
diff --git a/src/ephy-activation.h b/src/ephy-activation.h
index 030c9a8d7..600759329 100644
--- a/src/ephy-activation.h
+++ b/src/ephy-activation.h
@@ -26,8 +26,8 @@
G_BEGIN_DECLS
/* activation handlers */
-gboolean ephy_activation_load_url (EphyDbus *ephy_dbus,
- char *url,
+gboolean ephy_activation_load_uris (EphyDbus *ephy_dbus,
+ char **uris,
char *options,
guint startup_id,
GError **error);
diff --git a/src/ephy-main.c b/src/ephy-main.c
index 7ee41baae..be5954587 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -66,7 +66,7 @@ static gboolean private_instance = FALSE;
static char *session_filename = NULL;
static char *bookmark_url = NULL;
static char *bookmarks_file = NULL;
-static char **remaining_arguments = NULL;
+static char **extra_arguments = NULL;
static const GOptionEntry option_entries[] =
{
@@ -84,7 +84,7 @@ static const GOptionEntry option_entries[] =
N_("Add a bookmark"), N_("URL") },
{ "private-instance", 0, 0, G_OPTION_ARG_NONE, &private_instance,
N_("Start a private instance"), NULL },
- { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &remaining_arguments,
+ { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &extra_arguments,
"", "" },
{ NULL }
};
@@ -354,7 +354,7 @@ unref_proxy_reply_cb (DBusGProxy *proxy,
if (error != NULL)
{
g_warning ("An error occured while calling remote method: %s", error->message);
- g_error_free (error);
+ g_error_free (error);// FIXME???
}
g_object_unref (proxy);
@@ -370,48 +370,33 @@ open_urls (DBusGProxy *proxy,
guint32 user_time,
GError **error)
{
- const char *options = "new-window";
- int i;
+ static const char *empty_arguments[] = { "", NULL };
+ GString *options;
+
+ options = g_string_sized_new (64);
if (open_in_new_window)
{
- options = "new-window";
+ g_string_append (options, "new-window,");
}
- else if (open_in_new_tab)
+ if (open_in_new_tab)
{
- options = "new-tab";
+ g_string_append (options, "new-tab,");
}
- if (remaining_arguments == NULL)
+ org_gnome_Epiphany_load_uris_async
+ (proxy,
+ extra_arguments ? (const char**) extra_arguments : (const char**)empty_arguments,
+ options->str, user_time,
+ unref_proxy_reply_cb, NULL);
+
+ if (extra_arguments)
{
- /* Homepage or resume */
- org_gnome_Epiphany_load_url_async
- (proxy, "", options, user_time,
- unref_proxy_reply_cb, NULL /* FIXME! */);
+ g_strfreev (extra_arguments);
+ extra_arguments = NULL;
}
- else
- {
- for (i = 0; remaining_arguments[i] != NULL; ++i)
- {
- char *path;
-
- path = remaining_arguments[i];
- /* path = path_from_command_line_arg (args[i]); */
- g_object_ref (proxy);
-
- org_gnome_Epiphany_load_url_async
- (proxy, path, options, user_time,
- unref_proxy_reply_cb, NULL /* FIXME */);
-
- /* g_free (path); */
- }
-
- g_strfreev (remaining_arguments);
- remaining_arguments = NULL;
-
- ephy_object_idle_unref (proxy);
- }
+ g_string_free (options, TRUE);
return TRUE;
}