diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2006-01-25 02:15:50 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2006-01-25 02:15:50 +0800 |
commit | e10ccbd38205bdf451f68932aacfc7f5e3f70dea (patch) | |
tree | 9ddf7bb9028a60dfcd64cff29ccf3005269a79a5 | |
parent | 21086fc06ec3d08e3c5609cc53383e7c18fd2175 (diff) | |
download | gsoc2013-epiphany-e10ccbd38205bdf451f68932aacfc7f5e3f70dea.tar gsoc2013-epiphany-e10ccbd38205bdf451f68932aacfc7f5e3f70dea.tar.gz gsoc2013-epiphany-e10ccbd38205bdf451f68932aacfc7f5e3f70dea.tar.bz2 gsoc2013-epiphany-e10ccbd38205bdf451f68932aacfc7f5e3f70dea.tar.lz gsoc2013-epiphany-e10ccbd38205bdf451f68932aacfc7f5e3f70dea.tar.xz gsoc2013-epiphany-e10ccbd38205bdf451f68932aacfc7f5e3f70dea.tar.zst gsoc2013-epiphany-e10ccbd38205bdf451f68932aacfc7f5e3f70dea.zip |
Run the main loop until the reply is received when activating a running
2006-01-24 Christian Persch <chpe@cvs.gnome.org>
* lib/ephy-file-helpers.c: (ephy_dot_dir),
(ephy_file_helpers_init):
* lib/ephy-file-helpers.h:
* src/ephy-dbus.c:
* src/ephy-main.c: (unref_proxy_reply_cb), (open_urls), (main):
Run the main loop until the reply is received when
activating a running instance. Fixes URL opening with
two concurrently starting instance.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | lib/ephy-file-helpers.c | 49 | ||||
-rw-r--r-- | lib/ephy-file-helpers.h | 7 | ||||
-rw-r--r-- | src/ephy-dbus.c | 1 | ||||
-rw-r--r-- | src/ephy-main.c | 21 |
5 files changed, 67 insertions, 23 deletions
@@ -1,5 +1,17 @@ 2006-01-24 Christian Persch <chpe@cvs.gnome.org> + * lib/ephy-file-helpers.c: (ephy_dot_dir), + (ephy_file_helpers_init): + * lib/ephy-file-helpers.h: + * src/ephy-dbus.c: + * src/ephy-main.c: (unref_proxy_reply_cb), (open_urls), (main): + + Run the main loop until the reply is received when + activating a running instance. Fixes URL opening with + two concurrently starting instance. + +2006-01-24 Christian Persch <chpe@cvs.gnome.org> + * src/ephy-dbus.c: (ephy_dbus_connect_to_session_bus): Use DBUS_NAME_FLAG_DO_NOT_QUEUE when requesting the name, diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c index c9c62d043..6e024c260 100644 --- a/lib/ephy-file-helpers.c +++ b/lib/ephy-file-helpers.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2002 Jorn Baayen * Copyright (C) 2003, 2004 Marco Pesenti Gritti - * Copyright (C) 2004 Christian Persch + * Copyright (C) 2004, 2005, 2006 Christian Persch * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,10 +28,6 @@ #include "eel-gconf-extensions.h" #include "ephy-debug.h" -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/stat.h> #include <glib.h> #include <glib/gi18n.h> #include <libgnome/gnome-init.h> @@ -49,6 +45,11 @@ #include <gdk/gdk.h> #include <gdk/gdkx.h> +#include <string.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/stat.h> + #define EPHY_UUID "0d82d98f-7079-401c-abff-203fcde1ece3" #define EPHY_UUID_ENVVAR "EPHY_UNIQUE" #define EPHY_UUID_ENVSTRING EPHY_UUID_ENVVAR "=" EPHY_UUID @@ -59,6 +60,7 @@ static GHashTable *files = NULL; static GHashTable *mime_table = NULL; +static gboolean have_private_profile = FALSE; static char *dot_dir = NULL; static char *tmp_dir = NULL; static GList *del_on_exit = NULL; @@ -251,19 +253,12 @@ ephy_file (const char *filename) const char * ephy_dot_dir (void) { - if (dot_dir == NULL) - { - dot_dir = g_build_filename (g_get_home_dir (), - GNOME_DOT_GNOME, - "epiphany", - NULL); - } - return dot_dir; } gboolean -ephy_file_helpers_init (GError **error) +ephy_file_helpers_init (gboolean private_profile, + GError **error) { const char *uuid; @@ -285,6 +280,32 @@ ephy_file_helpers_init (GError **error) (GDestroyNotify) g_free, (GDestroyNotify) g_free); + have_private_profile = private_profile; + + if (private_profile) + { + if (ephy_file_tmp_dir () == NULL) + { + g_set_error (error, + EPHY_FILE_HELPERS_ERROR_QUARK, + 0, + _("Could not create a temporary directory in “%s”."), + g_get_tmp_dir ()); + return FALSE; + } + + dot_dir = g_build_filename (ephy_file_tmp_dir (), + "epiphany", + NULL); + } + else + { + dot_dir = g_build_filename (g_get_home_dir (), + GNOME_DOT_GNOME, + "epiphany", + NULL); + } + return ephy_ensure_dir_exists (ephy_dot_dir (), error); } diff --git a/lib/ephy-file-helpers.h b/lib/ephy-file-helpers.h index 189cc17e2..505e609c6 100644 --- a/lib/ephy-file-helpers.h +++ b/lib/ephy-file-helpers.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2002 Jorn Baayen * Copyright (C) 2003, 2004 Marco Pesenti Gritti - * Copyright (C) 2004 Christian Persch + * Copyright (C) 2004, 2005, 2006 Christian Persch * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,12 +43,13 @@ typedef struct _EphyFileMonitor EphyFileMonitor; typedef void (* EphyFileMonitorFunc) (EphyFileMonitor*, const char*, GnomeVFSMonitorEventType, gpointer); typedef gboolean (* EphyFileMonitorDelayFunc) (EphyFileMonitor*, gpointer); +gboolean ephy_file_helpers_init (gboolean private_profile, + GError **error); + const char *ephy_file (const char *filename); const char *ephy_dot_dir (void); -gboolean ephy_file_helpers_init (GError **error); - void ephy_file_helpers_shutdown (void); char *ephy_file_downloads_dir (void); diff --git a/src/ephy-dbus.c b/src/ephy-dbus.c index 214a8452e..7f58fb6f6 100644 --- a/src/ephy-dbus.c +++ b/src/ephy-dbus.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2004, 2005 Jean-François Rameau + * Copyright (C) 2006 Christian Persch * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/ephy-main.c b/src/ephy-main.c index 39905ce41..63a2b9b2f 100644 --- a/src/ephy-main.c +++ b/src/ephy-main.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2000-2002 Marco Pesenti Gritti + * Copyright (C) 2006 Christian Persch * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,6 +60,7 @@ static GQuark startup_error_quark = 0; static gboolean open_in_new_tab = FALSE; static gboolean open_in_new_window = FALSE; static gboolean open_as_bookmarks_editor = FALSE; +static gboolean private_instance = FALSE; //static gboolean reload_plugins = FALSE; static char *session_filename = NULL; @@ -80,6 +82,8 @@ static const GOptionEntry option_entries[] = N_("Load the given session file"), N_("FILE") }, { "add-bookmark", 't', 0, G_OPTION_ARG_STRING, &bookmark_url, 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, "", "" }, { NULL } @@ -345,6 +349,11 @@ unref_proxy_reply_cb (DBusGProxy *proxy, } g_object_unref (proxy); + + if (!_ephy_dbus_is_name_owner () && gtk_main_level ()) + { + gtk_main_quit (); + } } static gboolean @@ -391,6 +400,7 @@ open_urls (DBusGProxy *proxy, } g_strfreev (remaining_arguments); + remaining_arguments = NULL; } return TRUE; @@ -578,7 +588,6 @@ main (int argc, { _ephy_dbus_release (); - gdk_notify_startup_complete (); show_error_message (&error); exit (1); @@ -601,6 +610,8 @@ main (int argc, if (proxy != NULL && call_dbus_proxy (proxy, user_time, &error)) { + gtk_main (); + _ephy_dbus_release (); gdk_notify_startup_complete (); @@ -609,7 +620,6 @@ main (int argc, _ephy_dbus_release (); - gdk_notify_startup_complete (); show_error_message (&error); exit (1); @@ -617,11 +627,10 @@ main (int argc, /* We're not remoting; start our services */ - if (!ephy_file_helpers_init (&error)) + if (!ephy_file_helpers_init (FALSE, &error)) { _ephy_dbus_release (); - gdk_notify_startup_complete (); show_error_message (&error); exit (1); @@ -651,9 +660,9 @@ main (int argc, g_object_unref (ephy_shell_get_default ()); + ephy_file_helpers_shutdown (); _ephy_dbus_release (); - gdk_notify_startup_complete (); show_error_message (&error); exit (1); @@ -667,9 +676,9 @@ main (int argc, { g_object_unref (ephy_shell_get_default ()); + ephy_file_helpers_shutdown (); _ephy_dbus_release (); - gdk_notify_startup_complete (); show_error_message (&error); exit (1); |