diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-main.c | 20 | ||||
-rw-r--r-- | src/ephy-shell.c | 98 | ||||
-rw-r--r-- | src/ephy-window.c | 36 |
3 files changed, 79 insertions, 75 deletions
diff --git a/src/ephy-main.c b/src/ephy-main.c index 542cc3c06..d94e301a1 100644 --- a/src/ephy-main.c +++ b/src/ephy-main.c @@ -21,6 +21,12 @@ #endif #include "ephy-shell.h" +#include "ephy-file-helpers.h" +#include "ephy-thread-helpers.h" +#include "ephy-state.h" +#include "ephy-debug.h" +#include "ephy-stock-icons.h" +#include "eel-gconf-extensions.h" #include <libgnomeui/gnome-ui-init.h> #include <gtk/gtkmain.h> @@ -28,6 +34,8 @@ #include <libgnome/gnome-program.h> #include <bonobo/bonobo-main.h> #include <glib/gi18n.h> +#include <glade/glade-init.h> +#include <libgnomevfs/gnome-vfs-init.h> static gboolean open_in_existing = FALSE; static gboolean open_in_new_tab = FALSE; @@ -143,6 +151,13 @@ main (int argc, char *argv[]) string_arg = bookmark_url; } + gnome_vfs_init (); + glade_gnome_init (); + ephy_debug_init (); + ephy_thread_helpers_init (); + ephy_file_helpers_init (); + ephy_stock_icons_init (); + eel_gconf_monitor_add ("/apps/epiphany/general"); bonobo_activate (); ephy_shell = ephy_shell_new (); @@ -167,5 +182,10 @@ main (int argc, char *argv[]) gtk_main (); } + eel_gconf_monitor_remove ("/apps/epiphany/general"); + ephy_state_save (); + ephy_file_helpers_shutdown (); + gnome_vfs_shutdown (); + return 0; } diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 6cdb6700f..a661ceceb 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -23,15 +23,12 @@ #endif #include "ephy-shell.h" -#include "ephy-state.h" #include "ephy-embed-shell.h" #include "eel-gconf-extensions.h" #include "ephy-prefs.h" +#include "ephy-file-helpers.h" #include "ephy-favicon-cache.h" -#include "ephy-stock-icons.h" #include "ephy-window.h" -#include "ephy-file-helpers.h" -#include "ephy-thread-helpers.h" #include "ephy-bookmarks-import.h" #include "ephy-bookmarks-editor.h" #include "ephy-history-window.h" @@ -51,9 +48,6 @@ #include <gtk/gtkmessagedialog.h> #include <dirent.h> #include <unistd.h> -#include <libgnomevfs/gnome-vfs-init.h> -#include <gtk/gtkicontheme.h> -#include <glade/glade-init.h> #ifdef ENABLE_NAUTILUS_VIEW @@ -170,6 +164,7 @@ ephy_shell_init (EphyShell *gs) gs->priv->history_window = NULL; gs->priv->toolbars_model = NULL; gs->priv->fs_toolbars_model = NULL; + gs->priv->extensions_manager = NULL; ephy_shell = gs; g_object_add_weak_pointer (G_OBJECT(ephy_shell), @@ -180,68 +175,6 @@ ephy_shell_init (EphyShell *gs) } 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 (); - ephy_thread_helpers_init (); - ephy_file_helpers_init (); - 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) - { - 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 */ - /* FIXME MultiHead: icon theme is per-display, not global */ - icon_theme = gtk_icon_theme_get_default (); - icon_info = gtk_icon_theme_lookup_icon (icon_theme, "web-browser", -1, 0); - - if (icon_info) - { - - icon_file = gtk_icon_info_get_filename (icon_info); - if (icon_file) - { - gtk_window_set_default_icon_from_file (icon_file, NULL); - } - - gtk_icon_info_free (icon_info); - } - else - { - g_warning ("Web browser gnome icon not found"); - } - - /* Instantiate extensions manager; this will load the extensions */ - gs->priv->extensions_manager = ephy_extensions_manager_new (); - - /* Instantiate internal extensions */ - gs->priv->session = - EPHY_SESSION (ephy_extensions_manager_add - (gs->priv->extensions_manager, EPHY_TYPE_SESSION)); -} - -static void open_urls (GNOME_EphyAutomation automation, const char **args, CORBA_Environment *ev, gboolean new_tab, gboolean existing_window, @@ -278,6 +211,8 @@ ephy_shell_startup (EphyShell *gs, GNOME_EphyAutomation automation; Bonobo_RegistrationResult result; + ephy_ensure_dir_exists (ephy_dot_dir ()); + #ifdef ENABLE_NAUTILUS_VIEW ephy_nautilus_view_init_factory (gs); #endif @@ -290,8 +225,6 @@ ephy_shell_startup (EphyShell *gs, switch (result) { case Bonobo_ACTIVATION_REG_SUCCESS: - init_services (gs, error); - if (*error != NULL) return TRUE; break; case Bonobo_ACTIVATION_REG_ALREADY_ACTIVE: break; @@ -423,10 +356,6 @@ ephy_shell_finalize (GObject *object) G_OBJECT_CLASS (parent_class)->finalize (object); - ephy_state_save (); - ephy_file_helpers_shutdown (); - gnome_vfs_shutdown (); - if (gs->priv->automation_factory) { bonobo_object_unref (gs->priv->automation_factory); @@ -613,6 +542,19 @@ ephy_shell_get_session (EphyShell *gs) { g_return_val_if_fail (EPHY_IS_SHELL (gs), NULL); + if (gs->priv->session == NULL) + { + EphyExtensionsManager *manager; + + manager = EPHY_EXTENSIONS_MANAGER + (ephy_shell_get_extensions_manager (gs)); + + /* Instantiate internal extensions */ + gs->priv->session = + EPHY_SESSION (ephy_extensions_manager_add + (manager, EPHY_TYPE_SESSION)); + } + return G_OBJECT (gs->priv->session); } @@ -667,6 +609,12 @@ ephy_shell_get_extensions_manager (EphyShell *es) { g_return_val_if_fail (EPHY_IS_SHELL (es), NULL); + if (es->priv->extensions_manager == NULL) + { + /* Instantiate extensions manager; this will load the extensions */ + es->priv->extensions_manager = ephy_extensions_manager_new (); + } + return G_OBJECT (es->priv->extensions_manager); } diff --git a/src/ephy-window.c b/src/ephy-window.c index c93689f54..854b2d9c8 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1451,6 +1451,40 @@ ephy_window_class_init (EphyWindowClass *klass) } static void +ensure_default_icon (void) +{ + static gboolean ephy_has_default_icon = FALSE; + GtkIconTheme *icon_theme; + GtkIconInfo *icon_info; + const char *icon_file; + + if (ephy_has_default_icon) return; + + /* FIXME listen on icon changes */ + /* FIXME MultiHead: icon theme is per-display, not global */ + icon_theme = gtk_icon_theme_get_default (); + icon_info = gtk_icon_theme_lookup_icon (icon_theme, "web-browser", -1, 0); + + if (icon_info) + { + + icon_file = gtk_icon_info_get_filename (icon_info); + if (icon_file) + { + gtk_window_set_default_icon_from_file (icon_file, NULL); + } + + gtk_icon_info_free (icon_info); + } + else + { + g_warning ("Web browser gnome icon not found"); + } + + ephy_has_default_icon = TRUE; +} + +static void ephy_window_init (EphyWindow *window) { EphyExtension *manager; @@ -1468,6 +1502,8 @@ ephy_window_init (EphyWindow *window) window->priv->is_fullscreen = FALSE; window->priv->has_size = FALSE; + ensure_default_icon (); + /* Setup the window and connect verbs */ setup_window (window); |