aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@src.gnome.org>2003-11-13 22:02:03 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-11-13 22:02:03 +0800
commitf96998042311fdbe13591635b4861f6e9db7c230 (patch)
treeed45fb5150f213180392d71f4563ac0d86eec9d7
parentf6bdfce7e16b98825598dc990efef0846efdb079 (diff)
downloadgsoc2013-epiphany-f96998042311fdbe13591635b4861f6e9db7c230.tar
gsoc2013-epiphany-f96998042311fdbe13591635b4861f6e9db7c230.tar.gz
gsoc2013-epiphany-f96998042311fdbe13591635b4861f6e9db7c230.tar.bz2
gsoc2013-epiphany-f96998042311fdbe13591635b4861f6e9db7c230.tar.lz
gsoc2013-epiphany-f96998042311fdbe13591635b4861f6e9db7c230.tar.xz
gsoc2013-epiphany-f96998042311fdbe13591635b4861f6e9db7c230.tar.zst
gsoc2013-epiphany-f96998042311fdbe13591635b4861f6e9db7c230.zip
ChangeLog
-rw-r--r--idl/EphyAutomation.idl8
-rw-r--r--src/ephy-automation.c32
-rw-r--r--src/ephy-automation.h8
-rw-r--r--src/ephy-main.c261
-rw-r--r--src/ephy-shell.c209
-rw-r--r--src/ephy-shell.h30
6 files changed, 279 insertions, 269 deletions
diff --git a/idl/EphyAutomation.idl b/idl/EphyAutomation.idl
index c0aab2f9e..83f0c1f92 100644
--- a/idl/EphyAutomation.idl
+++ b/idl/EphyAutomation.idl
@@ -4,11 +4,9 @@ module GNOME {
interface EphyAutomation : Bonobo::Unknown {
void loadurl (in string url,
- in boolean fullscreen,
- in boolean open_in_existing_tab,
- in boolean open_in_new_tab,
- in boolean open_in_new_window,
- in boolean raise);
+ in boolean fullscreen,
+ in boolean open_in_existing_tab,
+ in boolean open_in_new_tab);
void addBookmark (in string url);
diff --git a/src/ephy-automation.c b/src/ephy-automation.c
index 407e38b75..182e785bb 100644
--- a/src/ephy-automation.c
+++ b/src/ephy-automation.c
@@ -36,12 +36,10 @@ static void ephy_automation_class_init (EphyAutomationClass *klass);
static GObjectClass *parent_class = NULL;
-#define EPHY_FACTORY_OAFIID "OAFIID:GNOME_Epiphany_Automation_Factory"
-
static BonoboObject *
-ephy_automation_factory (BonoboGenericFactory *this_factory,
- const char *iid,
- gpointer user_data)
+ephy_automation_factory_cb (BonoboGenericFactory *this_factory,
+ const char *iid,
+ gpointer user_data)
{
return BONOBO_OBJECT (g_object_new (EPHY_TYPE_AUTOMATION, NULL));
}
@@ -50,38 +48,38 @@ BonoboGenericFactory *
ephy_automation_factory_new (void)
{
BonoboGenericFactory *factory;
+ GClosure *factory_closure;
- factory = bonobo_generic_factory_new (EPHY_FACTORY_OAFIID,
- ephy_automation_factory,
- NULL);
- if (factory == NULL)
- {
- g_warning ("Could not initialize EphyAutomation factory\n");
- }
+ factory = g_object_new (bonobo_generic_factory_get_type (), NULL);
+
+ factory_closure = g_cclosure_new
+ (G_CALLBACK (ephy_automation_factory_cb), NULL, NULL);
+
+ bonobo_generic_factory_construct_noreg
+ (factory, AUTOMATION_FACTORY_IID, factory_closure);
return factory;
}
static void
impl_ephy_automation_loadurl (PortableServer_Servant _servant,
- const CORBA_char * url,
+ const CORBA_char *url,
const CORBA_boolean fullscreen,
const CORBA_boolean open_in_existing_tab,
- const CORBA_boolean open_in_new_window,
const CORBA_boolean open_in_new_tab,
- const CORBA_boolean raise,
- CORBA_Environment * ev)
+ CORBA_Environment *ev)
{
EphyNewTabFlags flags = 0;
EphyWindow *window;
EphySession *session;
session = EPHY_SESSION (ephy_shell_get_session (ephy_shell));
+ g_return_if_fail (session != NULL);
if (ephy_session_autoresume (session) && *url == '\0')
{
/* no need to open the homepage,
- * we did already open session windows */
+ * we did already open session windows */
return;
}
diff --git a/src/ephy-automation.h b/src/ephy-automation.h
index 5a730290e..319aa8b18 100644
--- a/src/ephy-automation.h
+++ b/src/ephy-automation.h
@@ -32,11 +32,15 @@ G_BEGIN_DECLS
#define EPHY_IS_AUTOMATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_AUTOMATION))
#define EPHY_AUTOMATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_AUTOMATION, EphyAutomationClass))
-typedef struct {
+#define AUTOMATION_FACTORY_IID "OAFIID:GNOME_Epiphany_Automation_Factory"
+
+typedef struct
+{
BonoboObject parent;
} EphyAutomation;
-typedef struct {
+typedef struct
+{
BonoboObjectClass parent_class;
POA_GNOME_EphyAutomation__epv epv;
diff --git a/src/ephy-main.c b/src/ephy-main.c
index 80627736c..542cc3c06 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -21,60 +21,32 @@
#endif
#include "ephy-shell.h"
-#include "ephy-automation.h"
-#include "ephy-window.h"
-#include "ephy-file-helpers.h"
-#include "EphyAutomation.h"
#include <libgnomeui/gnome-ui-init.h>
+#include <gtk/gtkmain.h>
#include <gtk/gtkmessagedialog.h>
#include <libgnome/gnome-program.h>
#include <bonobo/bonobo-main.h>
+#include <glib/gi18n.h>
-#define EPHY_FACTORY_OAFIID "OAFIID:GNOME_Epiphany_Automation_Factory"
-
-static gint
-ephy_main_translate_url_arguments (poptContext context, gchar ***urls);
-static gboolean
-ephy_main_start (gpointer data);
-
-GnomeProgram *program;
-CORBA_Environment corba_env; /* Global for downloader */
-static gboolean open_in_existing = FALSE; /* load in existing window? */
-static gboolean open_in_new_tab = FALSE; /* force open in a new tab? */
-static gboolean noraise = FALSE; /* no raise */
-static gboolean open_in_new_window = FALSE; /* force open in a new window? */
-static gboolean open_fullscreen = FALSE; /* open ephy in full screen ? */
-static gchar *session_filename = NULL; /* the session filename */
-static gchar *bookmark_url = NULL; /* the temp bookmark to add */
-static gchar *bookmarks_file = NULL; /* the bookmarks file to import */
-static gboolean open_as_bookmarks_editor = FALSE; /* --bookmarks-editor */
+static gboolean open_in_existing = FALSE;
+static gboolean open_in_new_tab = FALSE;
+static gboolean open_fullscreen = FALSE;
+static gboolean open_as_bookmarks_editor = FALSE;
static gboolean open_as_nautilus_view = FALSE;
-static gint n_urls;
-static gchar **url;
-static gboolean first_instance;
+static const char *session_filename = NULL;
+static const char *bookmark_url = NULL;
+static const char *bookmarks_file = NULL;
-/* command line argument parsing structure */
static struct poptOption popt_options[] =
{
- { NULL, '\0', POPT_ARG_INCLUDE_TABLE, &bonobo_activation_popt_options, 0, NULL,
- NULL },
{ "new-tab", 'n', POPT_ARG_NONE, &open_in_new_tab, 0,
N_("Open a new tab in an existing Epiphany window"),
NULL },
- { "new-window", 'w', POPT_ARG_NONE, &open_in_new_window, 0,
- N_("Open a new window in an existing Epiphany process"),
- NULL },
- { "noraise", '\0', POPT_ARG_NONE, &noraise, 0,
- N_("Do not raise the window when opening a page in an existing Epiphany process"),
- NULL },
{ "fullscreen", 'f', POPT_ARG_NONE, &open_fullscreen, 0,
N_("Run Epiphany in full screen mode"),
NULL },
- { "existing", 'x', POPT_ARG_NONE, &open_in_existing, 0,
- N_("Attempt to load URL in existing Epiphany window"),
- NULL },
{ "load-session", 'l', POPT_ARG_STRING, &session_filename, 0,
N_("Load the given session file"),
N_("FILE") },
@@ -90,18 +62,26 @@ static struct poptOption popt_options[] =
{ "bookmarks-editor", 'b', POPT_ARG_NONE, &open_as_bookmarks_editor, 0,
N_("Launch the bookmarks editor"),
NULL },
-
- /* terminator, must be last */
{ NULL, 0, 0, NULL, 0, NULL, NULL }
};
+static void
+shell_weak_notify (gpointer data,
+ GObject *where_the_object_was)
+{
+ gtk_main_quit ();
+}
+
int
main (int argc, char *argv[])
{
poptContext context;
GValue context_as_value = { 0 };
GnomeProgram *program;
- CORBA_Object factory;
+ EphyShellStartupFlags startup_flags;
+ const char **args, *string_arg;
+ gboolean new_instance;
+ GError *err = NULL;
#ifdef ENABLE_NLS
/* Initialize the i18n stuff */
@@ -109,8 +89,8 @@ main (int argc, char *argv[])
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE);
#endif
- g_set_application_name (_("Epiphany Web Browser"));
+ g_set_application_name (_("Epiphany Web Browser"));
program = gnome_program_init (PACKAGE, VERSION,
LIBGNOMEUI_MODULE, argc, argv,
GNOME_PARAM_POPT_TABLE, popt_options,
@@ -121,188 +101,71 @@ main (int argc, char *argv[])
g_object_get_property (G_OBJECT (program),
GNOME_PARAM_POPT_CONTEXT,
g_value_init (&context_as_value, G_TYPE_POINTER));
-
context = g_value_get_pointer (&context_as_value);
+ args = poptGetArgs (context);
+ poptFreeContext (context);
- /* load arguments that aren't regular options (urls to load) */
- n_urls = ephy_main_translate_url_arguments (context, &url);
-
- g_value_unset (&context_as_value);
-
- factory = bonobo_activation_activate_from_id
- (EPHY_FACTORY_OAFIID,
- Bonobo_ACTIVATION_FLAG_EXISTING_ONLY,
- NULL, NULL);
-
- if (factory != NULL)
+ startup_flags = 0;
+ string_arg = NULL;
+ if (open_in_new_tab)
{
- first_instance = FALSE;
- ephy_main_start (NULL);
+ startup_flags |= EPHY_SHELL_STARTUP_TABS;
}
- else
+ else if (open_fullscreen)
{
- first_instance = TRUE;
-
- ephy_shell_new ();
-
- g_idle_add ((GSourceFunc) ephy_main_start, NULL);
-
- bonobo_main ();
+ startup_flags |= EPHY_SHELL_STARTUP_FULLSCREEN;
}
-
- return 0;
-}
-
-static gboolean
-ephy_main_start (gpointer data)
-{
- GNOME_EphyAutomation gaserver;
- int i;
-
- CORBA_exception_init (&corba_env);
-
- gaserver = bonobo_activation_activate_from_id ("OAFIID:GNOME_Epiphany_Automation",
- 0, NULL, &corba_env);
-
- if (gaserver == NULL)
+ else if (open_in_existing)
{
- GtkWidget *dialog;
- dialog = gtk_message_dialog_new
- (NULL,
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("Epiphany can't be used now. "
- "Running the command \"bonobo-slay\" "
- "from the console may fix the problem. If not, "
- "you can try rebooting the computer or "
- "installing Epiphany again.\n\n"
- "Bonobo couldn't locate the GNOME_Epiphany_Automation.server."));
- gtk_dialog_run (GTK_DIALOG (dialog));
-
+ startup_flags |= EPHY_SHELL_STARTUP_EXISTING_WINDOW;
}
- /* Launch the bookmarks editor */
else if (open_as_bookmarks_editor)
{
- GNOME_EphyAutomation_openBookmarksEditor
- (gaserver, &corba_env);
- }
- /* load the session if requested */
- else if (session_filename)
- {
- GNOME_EphyAutomation_loadSession
- (gaserver, session_filename, &corba_env);
- }
- /* if we're given a bookmarks file to import... */
- else if (bookmarks_file != NULL)
- {
- GNOME_EphyAutomation_importBookmarks
- (gaserver, bookmarks_file, &corba_env);
+ startup_flags |= EPHY_SHELL_STARTUP_BOOKMARKS_EDITOR;
}
- /* if found and we're given a bookmark to add... */
- else if (bookmark_url != NULL)
+ else if (open_as_nautilus_view)
{
- GNOME_EphyAutomation_addBookmark
- (gaserver, bookmark_url, &corba_env);
+ startup_flags |= EPHY_SHELL_STARTUP_NAUTILUS_VIEW;
}
- /* provided with urls? */
- else if (!open_as_nautilus_view)
+ else if (session_filename != NULL)
{
- /* open all of the urls */
- for (i = 0; i < n_urls; i++)
- {
- GNOME_EphyAutomation_loadurl
- (gaserver, url[i],
- open_fullscreen,
- open_in_existing,
- open_in_new_window,
- open_in_new_tab,
- !noraise,
- &corba_env);
- }
+ startup_flags |= EPHY_SHELL_STARTUP_SESSION;
+ string_arg = session_filename;
}
-
- /* Unref so it will exit if no more used
- * If started with --nautilus-view, only exit when the
- * last view has been destroyed.
- */
- if (first_instance && !open_as_nautilus_view)
+ else if (bookmarks_file != NULL)
{
- g_object_unref (G_OBJECT(ephy_shell));
+ startup_flags |= EPHY_SHELL_STARTUP_IMPORT_BOOKMARKS;
+ string_arg = bookmarks_file;
}
-
- if (gaserver)
+ else if (bookmark_url != NULL)
{
- bonobo_object_release_unref (gaserver, &corba_env);
+ startup_flags |= EPHY_SHELL_STARTUP_ADD_BOOKMARK;
+ string_arg = bookmark_url;
}
- CORBA_exception_free (&corba_env);
-
- gdk_notify_startup_complete ();
+ bonobo_activate ();
- return FALSE;
-}
-
-/* dummy argument to open a default window */
-static gint
-ephy_main_dummy_url_argument (gchar ***urls)
-{
- *urls = g_new0 (gchar *, 2);
+ ephy_shell = ephy_shell_new ();
+ new_instance = ephy_shell_startup (ephy_shell, startup_flags,
+ args, string_arg, &err);
- (*urls)[0] = g_strdup ("");
- (*urls)[1] = NULL;
-
- return 1;
-}
-
-/**
- * translate_url_arguments: gather URL arguments and expand them fully
- * with realpath if they're filenames
- */
-static gint
-ephy_main_translate_url_arguments (poptContext context, gchar ***urls)
-{
- gchar buffer[PATH_MAX];
- gchar **args;
- gint i, n;
-
- /* any context remaining? */
- if (context == NULL)
- {
- return ephy_main_dummy_url_argument (urls);
- }
-
- /* get the args and check */
- args = (gchar **) poptGetArgs (context);
- if (args == NULL)
- {
- poptFreeContext (context);
- return ephy_main_dummy_url_argument (urls);
- }
+ if (err != NULL)
+ {
+ GtkWidget *dialog;
- /* count args */
- for (n = 0; args[n] != NULL; n++)
- /* nothing */;
+ dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+ GTK_BUTTONS_CLOSE,
+ GTK_MESSAGE_ERROR, err->message);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ }
+ else if (new_instance)
+ {
+ g_object_unref (ephy_shell);
- /* allocate pointer array */
- *urls = g_new0 (gchar *, n + 1);
+ g_object_weak_ref (G_OBJECT (ephy_shell), shell_weak_notify, NULL);
- /* translate each one */
- for (i = 0; i < n; i++)
- {
- /* try to expand as files */
- if (realpath (args[i], buffer) != NULL)
- {
- (*urls)[i] = g_strconcat ("file://", buffer, NULL);
- }
- else
- {
- (*urls)[i] = g_strdup (args[i]);
- }
- }
- poptFreeContext (context);
- (*urls)[i] = NULL;
+ gtk_main ();
+ }
- /* return the number of urls */
- return n;
+ return 0;
}
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 2a10315c6..6cdb6700f 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -64,6 +64,8 @@
#endif
+#define AUTOMATION_IID "OAFIID:GNOME_Epiphany_Automation"
+
#define EPHY_SHELL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_SHELL, EphyShellPrivate))
struct EphyShellPrivate
@@ -85,8 +87,6 @@ static void
ephy_shell_init (EphyShell *gs);
static void
ephy_shell_finalize (GObject *object);
-static void
-ephy_init_services (EphyShell *gs);
#ifdef ENABLE_NAUTILUS_VIEW
@@ -103,6 +103,19 @@ static GObjectClass *parent_class = NULL;
EphyShell *ephy_shell;
+GQuark
+ephy_shell_error_quark (void)
+{
+ static GQuark q = 0;
+
+ if (q == 0)
+ {
+ q = g_quark_from_static_string ("ephy-shell-error-quark");
+ }
+
+ return q;
+}
+
GType
ephy_shell_get_type (void)
{
@@ -147,11 +160,7 @@ ephy_shell_class_init (EphyShellClass *klass)
static void
ephy_shell_init (EphyShell *gs)
{
- EphyEmbedSingle *single;
EphyShell **ptr = &ephy_shell;
- GtkIconTheme *icon_theme;
- GtkIconInfo *icon_info;
- const char *icon_file;
gs->priv = EPHY_SHELL_GET_PRIVATE (gs);
@@ -166,6 +175,18 @@ ephy_shell_init (EphyShell *gs)
g_object_add_weak_pointer (G_OBJECT(ephy_shell),
(gpointer *)ptr);
+ /* Instantiate the automation factory */
+ gs->priv->automation_factory = ephy_automation_factory_new ();
+}
+
+static void
+init_services (EphyShell *gs, GError **error)
+{
+ GtkIconTheme *icon_theme;
+ GtkIconInfo *icon_info;
+ const char *icon_file;
+ EphyEmbedSingle *single;
+
gnome_vfs_init ();
glade_gnome_init ();
ephy_debug_init ();
@@ -174,27 +195,20 @@ ephy_shell_init (EphyShell *gs)
ephy_stock_icons_init ();
ephy_ensure_dir_exists (ephy_dot_dir ());
+ /* preload the prefs */
+ /* it also enables notifiers support */
+ eel_gconf_monitor_add ("/apps/epiphany");
+ eel_gconf_monitor_add ("/system/proxy");
+
/* This ensures mozilla is fired up */
single = ephy_embed_shell_get_embed_single (EPHY_EMBED_SHELL (gs));
- if (single != NULL)
- {
- ephy_init_services (gs);
- }
- else
+ if (single == NULL)
{
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new
- (NULL,
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("Epiphany can't be used now. "
- "Mozilla initialization failed. Check your "
- "MOZILLA_FIVE_HOME environmental variable."));
- gtk_dialog_run (GTK_DIALOG (dialog));
-
- exit (0);
+ g_set_error (error, EPHY_SHELL_ERROR,
+ EPHY_SHELL_ERROR_MOZILLA_REG_FAILED,
+ _("Epiphany can't be used now. "
+ "Mozilla initialization failed. Check your "
+ "MOZILLA_FIVE_HOME environmental variable."));
}
/* FIXME listen on icon changes */
@@ -225,9 +239,132 @@ ephy_shell_init (EphyShell *gs)
gs->priv->session =
EPHY_SESSION (ephy_extensions_manager_add
(gs->priv->extensions_manager, EPHY_TYPE_SESSION));
+}
- /* Instantiate the automation factory */
- gs->priv->automation_factory = ephy_automation_factory_new ();
+static void
+open_urls (GNOME_EphyAutomation automation,
+ const char **args, CORBA_Environment *ev,
+ gboolean new_tab, gboolean existing_window,
+ gboolean fullscreen)
+{
+ int i;
+
+ if (args == NULL)
+ {
+ /* Homepage or resume */
+ GNOME_EphyAutomation_loadurl
+ (automation, "", fullscreen,
+ existing_window, new_tab, ev);
+ }
+ else
+ {
+ for (i = 0; args[i] != NULL; i++)
+ {
+ GNOME_EphyAutomation_loadurl
+ (automation, args[i], fullscreen,
+ existing_window, new_tab, ev);
+ }
+ }
+}
+
+gboolean
+ephy_shell_startup (EphyShell *gs,
+ EphyShellStartupFlags flags,
+ const char **args,
+ const char *string_arg,
+ GError **error)
+{
+ CORBA_Environment ev;
+ GNOME_EphyAutomation automation;
+ Bonobo_RegistrationResult result;
+
+#ifdef ENABLE_NAUTILUS_VIEW
+ ephy_nautilus_view_init_factory (gs);
+#endif
+
+ CORBA_exception_init (&ev);
+
+ result = bonobo_activation_register_active_server
+ (AUTOMATION_FACTORY_IID, BONOBO_OBJREF (gs->priv->automation_factory), NULL);
+
+ switch (result)
+ {
+ case Bonobo_ACTIVATION_REG_SUCCESS:
+ init_services (gs, error);
+ if (*error != NULL) return TRUE;
+ break;
+ case Bonobo_ACTIVATION_REG_ALREADY_ACTIVE:
+ break;
+ case Bonobo_ACTIVATION_REG_NOT_LISTED:
+ g_set_error (error, EPHY_SHELL_ERROR,
+ EPHY_SHELL_ERROR_MISSING_SERVER,
+ _("Bonobo couldn't locate the GNOME_Epiphany_Automation.server "
+ "file. You can use bonobo-activation-sysconf to configure "
+ "the search path for bonobo server files."));
+ break;
+ case Bonobo_ACTIVATION_REG_ERROR:
+ g_set_error (error, EPHY_SHELL_ERROR,
+ EPHY_SHELL_ERROR_FACTORY_REG_FAILED,
+ _("Epiphany can't be used now, due to an unexpected error "
+ "from Bonobo when attempting to register the automation "
+ "server"));
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ if (result == Bonobo_ACTIVATION_REG_SUCCESS ||
+ result == Bonobo_ACTIVATION_REG_ALREADY_ACTIVE)
+ {
+ automation = bonobo_activation_activate_from_id (AUTOMATION_IID,
+ 0, NULL, &ev);
+ if (CORBA_Object_is_nil (automation, &ev))
+ {
+ g_set_error (error, EPHY_SHELL_ERROR,
+ EPHY_SHELL_ERROR_OBJECT_REG_FAILED,
+ _("Epiphany can't be used now, due to an unexpected error "
+ "from Bonobo when attempting to locate the automation "
+ "object."));
+ automation = NULL;
+ }
+ else if (flags & EPHY_SHELL_STARTUP_BOOKMARKS_EDITOR)
+ {
+ GNOME_EphyAutomation_openBookmarksEditor
+ (automation, &ev);
+ }
+ else if (flags & EPHY_SHELL_STARTUP_SESSION)
+ {
+ GNOME_EphyAutomation_loadSession
+ (automation, string_arg, &ev);
+ }
+ else if (flags & EPHY_SHELL_STARTUP_IMPORT_BOOKMARKS)
+ {
+ GNOME_EphyAutomation_importBookmarks
+ (automation, string_arg, &ev);
+ }
+ else if (flags & EPHY_SHELL_STARTUP_ADD_BOOKMARK)
+ {
+ GNOME_EphyAutomation_addBookmark
+ (automation, string_arg, &ev);
+ }
+ else
+ {
+ open_urls (automation, args, &ev,
+ flags & EPHY_SHELL_STARTUP_TABS,
+ flags & EPHY_SHELL_STARTUP_EXISTING_WINDOW,
+ flags & EPHY_SHELL_STARTUP_FULLSCREEN);
+ }
+
+ if (automation)
+ {
+ bonobo_object_release_unref (automation, &ev);
+ }
+ }
+
+ CORBA_exception_free (&ev);
+ gdk_notify_startup_complete ();
+
+ return !(result == Bonobo_ACTIVATION_REG_ALREADY_ACTIVE);
}
static void
@@ -296,10 +433,6 @@ ephy_shell_finalize (GObject *object)
}
LOG ("Ephy shell finalized")
-
- bonobo_main_quit ();
-
- LOG ("Bonobo quit done")
}
EphyShell *
@@ -309,22 +442,6 @@ ephy_shell_new (void)
}
static void
-ephy_init_services (EphyShell *gs)
-{
- /* preload the prefs */
- /* it also enables notifiers support */
- eel_gconf_monitor_add ("/apps/epiphany");
- eel_gconf_monitor_add ("/system/proxy");
-
-#ifdef ENABLE_NAUTILUS_VIEW
-
- ephy_nautilus_view_init_factory (gs);
-
-#endif
-
-}
-
-static void
load_homepage (EphyEmbed *embed)
{
char *home;
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index 98e8d634b..32a01a48c 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -49,6 +49,28 @@ typedef struct EphyShellPrivate EphyShellPrivate;
extern EphyShell *ephy_shell;
+#define EPHY_SHELL_ERROR ephy_shell_error_quark ()
+
+typedef enum
+{
+ EPHY_SHELL_ERROR_MISSING_SERVER,
+ EPHY_SHELL_ERROR_OBJECT_REG_FAILED,
+ EPHY_SHELL_ERROR_FACTORY_REG_FAILED,
+ EPHY_SHELL_ERROR_MOZILLA_REG_FAILED
+} EphyShellError;
+
+typedef enum
+{
+ EPHY_SHELL_STARTUP_TABS = 1 << 0,
+ EPHY_SHELL_STARTUP_EXISTING_WINDOW = 1 << 2,
+ EPHY_SHELL_STARTUP_FULLSCREEN = 1 << 3,
+ EPHY_SHELL_STARTUP_BOOKMARKS_EDITOR = 1 << 4,
+ EPHY_SHELL_STARTUP_NAUTILUS_VIEW = 1 << 5,
+ EPHY_SHELL_STARTUP_SESSION = 1 << 6,
+ EPHY_SHELL_STARTUP_IMPORT_BOOKMARKS = 1 << 7,
+ EPHY_SHELL_STARTUP_ADD_BOOKMARK = 1 << 8
+} EphyShellStartupFlags;
+
typedef enum
{
/* Page types */
@@ -79,10 +101,18 @@ struct EphyShellClass
EphyEmbedShellClass parent_class;
};
+GQuark ephy_shell_error_quark (void);
+
GType ephy_shell_get_type (void);
EphyShell *ephy_shell_new (void);
+gboolean ephy_shell_startup (EphyShell *gs,
+ EphyShellStartupFlags flags,
+ const char **args,
+ const char *string_arg,
+ GError **error);
+
EphyWindow *ephy_shell_get_active_window (EphyShell *gs);
EphyTab *ephy_shell_new_tab (EphyShell *shell,