aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-activation.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-02-02 21:31:32 +0800
committerChristian Persch <chpe@src.gnome.org>2006-02-02 21:31:32 +0800
commit4d8b2c6114da0d8b629215a2ca690411d1d71949 (patch)
tree64ed27dc4ebd81a958dea41f97e92e2926ad56b3 /src/ephy-activation.c
parentcbecc0e54beb04ea9b2094058331237f5362ff48 (diff)
downloadgsoc2013-epiphany-4d8b2c6114da0d8b629215a2ca690411d1d71949.tar
gsoc2013-epiphany-4d8b2c6114da0d8b629215a2ca690411d1d71949.tar.gz
gsoc2013-epiphany-4d8b2c6114da0d8b629215a2ca690411d1d71949.tar.bz2
gsoc2013-epiphany-4d8b2c6114da0d8b629215a2ca690411d1d71949.tar.lz
gsoc2013-epiphany-4d8b2c6114da0d8b629215a2ca690411d1d71949.tar.xz
gsoc2013-epiphany-4d8b2c6114da0d8b629215a2ca690411d1d71949.tar.zst
gsoc2013-epiphany-4d8b2c6114da0d8b629215a2ca690411d1d71949.zip
Queue commands received from the main and remote instances, and process
2006-02-02 Christian Persch <chpe@cvs.gnome.org> * src/ephy-session.c: (save_yourself_cb), (die_cb), (session_command_free), (session_command_find), (resume_dialog_response_cb), (resume_dialog_weak_ref_cb), (session_command_autoresume), (session_command_open_bookmarks_editor), (session_command_open_uris), (session_command_dispatch), (session_command_queue_next), (session_command_queue_clear), (ephy_session_init), (ephy_session_dispose), (ephy_session_finalize), (ephy_session_close), (ephy_session_load), (ephy_session_get_active_window), (ephy_session_queue_command): * src/ephy-session.h: * src/ephy-main.c: (unref_proxy_reply_cb), (open_urls), (call_dbus_proxy), (queue_commands), (main): Queue commands received from the main and remote instances, and process them after autoresume has completed. Bug #328286. * data/epiphany-service.xml: * lib/ephy-file-helpers.c: (ephy_file_helpers_init): * lib/ephy-file-helpers.h: * src/ephy-activation.c: (session_queue_command), (ephy_activation_load_uri_list), (ephy_activation_load_session), (ephy_activation_open_bookmarks_editor): * src/ephy-activation.h: * src/ephy-dbus.c: * src/ephy-dbus.h: * src/epiphany.defs:
Diffstat (limited to 'src/ephy-activation.c')
-rw-r--r--src/ephy-activation.c119
1 files changed, 31 insertions, 88 deletions
diff --git a/src/ephy-activation.c b/src/ephy-activation.c
index 8ad478748..c5b01d386 100644
--- a/src/ephy-activation.c
+++ b/src/ephy-activation.c
@@ -25,108 +25,57 @@
#include "ephy-shell.h"
#include "ephy-session.h"
#include "ephy-prefs.h"
-#include "ephy-gui.h"
#include "eel-gconf-extensions.h"
#include "ephy-debug.h"
-#include <string.h>
-
-gboolean
-ephy_activation_load_uris (EphyDbus *ephy_dbus,
- char **uris,
- char *options,
- guint startup_id,
- GError **error)
+static gboolean
+session_queue_command (EphySessionCommand command,
+ char *arg,
+ char **args,
+ guint startup_id,
+ GError **error)
{
EphyShell *shell;
EphySession *session;
- EphyNewTabFlags flags = 0;
- EphyWindow *window;
- EphyTab *tab;
- static char *empty_urls[] = { "", NULL };
- guint32 user_time = (guint32) startup_id;
- guint i;
-
- g_return_val_if_fail (uris != NULL && options != 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))
- {
- uris = empty_urls;
- }
-
- window = ephy_session_get_active_window (session);
-
-#if 0
- if (open_in_existing_tab && window != NULL)
- {
- ephy_gui_window_update_user_time (GTK_WIDGET (window),
- user_time);
- ephy_window_load_url (window, url);
- return TRUE;
- }
-#endif
-
- if (strstr (options, "new-window") != NULL)
- {
- window = NULL;
- flags |= EPHY_NEW_TAB_IN_NEW_WINDOW;
- }
- else if (strstr (options, "new-tab") != NULL)
- {
- flags |= EPHY_NEW_TAB_IN_EXISTING_WINDOW |
- EPHY_NEW_TAB_JUMP;
- }
-
- for (i = 0; uris[i] != NULL; ++i)
+ if (shell == NULL)
{
- 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_set_error (error,
+ g_quark_from_static_string ("ephy-activation-error"),
+ 0,
+ "Shutting down." /* FIXME i18n & better string */);
+ return FALSE;
}
- g_object_unref (shell);
+ session = EPHY_SESSION (ephy_shell_get_session (ephy_shell_get_default()));
+ g_assert (session != NULL);
- /* FIXME: do we have to g_strfreev (uris) ? */
+ ephy_session_queue_command (session, command, arg, args,
+ (guint32) startup_id, FALSE);
return TRUE;
}
gboolean
+ephy_activation_load_uri_list (EphyDbus *ephy_dbus,
+ char **uris,
+ char *options,
+ guint startup_id,
+ GError **error)
+{
+ return session_queue_command (EPHY_SESSION_CMD_OPEN_URIS,
+ options, uris, startup_id, error);
+}
+
+gboolean
ephy_activation_load_session (EphyDbus *ephy_dbus,
char *session_name,
guint startup_id,
GError **error)
{
- EphySession *session;
- guint32 user_time = (guint32) startup_id;
-
- session = EPHY_SESSION (ephy_shell_get_session (ephy_shell));
- ephy_session_load (session, session_name, user_time);
-
- return TRUE;
+ return session_queue_command (EPHY_SESSION_CMD_LOAD_SESSION,
+ session_name, NULL, startup_id, error);
}
gboolean
@@ -134,9 +83,6 @@ ephy_activation_open_bookmarks_editor (EphyDbus *ephy_dbus,
guint startup_id,
GError **error)
{
- GtkWidget *editor;
- guint32 user_time = (guint32) startup_id;
-
if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING))
{
g_set_error (error,
@@ -147,9 +93,6 @@ ephy_activation_open_bookmarks_editor (EphyDbus *ephy_dbus,
return FALSE;
}
- editor = ephy_shell_get_bookmarks_editor (ephy_shell);
- ephy_gui_window_update_user_time (editor, user_time);
- gtk_window_present (GTK_WINDOW (editor));
-
- return TRUE;
+ return session_queue_command (EPHY_SESSION_CMD_OPEN_BOOKMARKS_EDITOR,
+ NULL, NULL, startup_id, error);
}