aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-main.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-09-24 01:08:54 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-09-24 01:08:54 +0800
commit30930917e8ce020776e0096928aedfebe779bfd5 (patch)
treec888c0b43e0249264f098b3be4cbfbc876cceb25 /src/ephy-main.c
parent2e1474156400d308faf8836801ee87607d9632d7 (diff)
downloadgsoc2013-epiphany-30930917e8ce020776e0096928aedfebe779bfd5.tar
gsoc2013-epiphany-30930917e8ce020776e0096928aedfebe779bfd5.tar.gz
gsoc2013-epiphany-30930917e8ce020776e0096928aedfebe779bfd5.tar.bz2
gsoc2013-epiphany-30930917e8ce020776e0096928aedfebe779bfd5.tar.lz
gsoc2013-epiphany-30930917e8ce020776e0096928aedfebe779bfd5.tar.xz
gsoc2013-epiphany-30930917e8ce020776e0096928aedfebe779bfd5.tar.zst
gsoc2013-epiphany-30930917e8ce020776e0096928aedfebe779bfd5.zip
Refactor initialization/automation code. Now all the code used by the
2003-09-23 Marco Pesenti Gritti <marco@gnome.org> * src/ephy-automation.c: (ephy_automation_factory_new): * src/ephy-automation.h: * src/ephy-main.c: (main), (ephy_main_start): * src/ephy-shell.c: (ephy_shell_init), (ephy_shell_finalize): Refactor initialization/automation code. Now all the code used by the first instance is in ephy_shell, all the code used by other instances is in ephy_main. Unref the factory before quitting so we dont risk new automation object are created and used with a dead shell.
Diffstat (limited to 'src/ephy-main.c')
-rw-r--r--src/ephy-main.c65
1 files changed, 12 insertions, 53 deletions
diff --git a/src/ephy-main.c b/src/ephy-main.c
index 986588ed8..5edd4617c 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -29,15 +29,10 @@
#include <libbonoboui.h>
#include <libgnome/gnome-program.h>
#include <libgnomeui/gnome-ui-init.h>
-#include <libgnomeui/gnome-icon-theme.h>
#include <gtk/gtkwindow.h>
-#include <libgnomevfs/gnome-vfs-init.h>
-#include <glade/glade-init.h>
#define EPHY_FACTORY_OAFIID "OAFIID:GNOME_Epiphany_Automation_Factory"
-static gboolean
-ephy_main_automation_init (void);
static gint
ephy_main_translate_url_arguments (poptContext context, gchar ***urls);
static gboolean
@@ -59,7 +54,6 @@ static gboolean ephy_server_mode = FALSE;
static gboolean open_as_bookmarks_editor = FALSE; /* --bookmarks-editor */
static gboolean open_as_nautilus_view = FALSE;
-static BonoboObject *automation_object;
static gint n_urls;
static gchar **url;
static gboolean first_instance;
@@ -120,7 +114,7 @@ main (int argc, char *argv[])
poptContext context;
GValue context_as_value = { 0 };
GnomeProgram *program;
- char *file;
+ CORBA_Object factory;
#ifdef ENABLE_NLS
/* Initialize the i18n stuff */
@@ -148,38 +142,25 @@ main (int argc, char *argv[])
g_value_unset (&context_as_value);
- first_instance = ephy_main_automation_init ();
+ factory = bonobo_activation_activate_from_id
+ (EPHY_FACTORY_OAFIID,
+ Bonobo_ACTIVATION_FLAG_EXISTING_ONLY,
+ NULL, NULL);
- if (first_instance)
+ if (factory != NULL)
{
- GnomeIconTheme *icon_theme;
-
- gnome_vfs_init ();
-
- glade_gnome_init ();
+ first_instance = FALSE;
+ ephy_main_start (NULL);
+ }
+ else
+ {
+ first_instance = TRUE;
ephy_shell_new ();
- icon_theme = gnome_icon_theme_new ();
- file = gnome_icon_theme_lookup_icon (icon_theme, "web-browser",
- -1, NULL, NULL);
- g_object_unref (icon_theme);
-
- if (file)
- {
- gtk_window_set_default_icon_from_file (file, NULL);
- g_free (file);
- }
- else
- {
- g_warning ("Web browser gnome icon not found");
- }
-
g_idle_add ((GSourceFunc) ephy_main_start, NULL);
bonobo_main ();
-
- gnome_vfs_shutdown ();
}
return 0;
@@ -296,28 +277,6 @@ ephy_main_start (gpointer data)
return FALSE;
}
-static gboolean
-ephy_main_automation_init (void)
-{
- CORBA_Object factory;
-
- factory = bonobo_activation_activate_from_id
- (EPHY_FACTORY_OAFIID,
- Bonobo_ACTIVATION_FLAG_EXISTING_ONLY,
- NULL, NULL);
-
- if (!factory)
- {
- automation_object = ephy_automation_new ();
- return TRUE;
- }
- else
- {
- ephy_main_start (NULL);
- return FALSE;
- }
-}
-
/**
* translate_url_arguments: gather URL arguments and expand them fully
* with realpath if they're filenames