From 8415cf6da16201127aadb7853e3969ed824de919 Mon Sep 17 00:00:00 2001 From: Claudio Saavedra Date: Tue, 21 Jun 2011 01:17:06 +0300 Subject: Implement GtkApplication based activation and uniqueness This replaces the existing dbus-glib activation and uniqueness code. The changes are kept to the minimum necessary to make all the features work, but there are still some optimizations possible (like doing most of the initialization in ephy_application_startup() when we know we are not remoting). These changes are left for later to avoid making this patch huge. Command-line parameter parsing is done in the main method and parameters are passed to the application through a EphyApplicationStartupContext structure, which is later passed as a GVariant to the primare instance. This way we avoid moving the GOption code out of the place where it's intended to run: in the main() method. Based in work by Alexandre Mazari. https://bugzilla.gnome.org/show_bug.cgi?id=637334 --- src/ephy-shell.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/ephy-shell.c') diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 6a246ee76..7c6f6d6c8 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -72,6 +72,7 @@ struct _EphyShellPrivate EggToolbarsModel *toolbars_model; EggToolbarsModel *fs_toolbars_model; EphyExtensionsManager *extensions_manager; + EphyApplication *application; #ifdef ENABLE_NETWORK_MANAGER EphyNetworkManager *nm_proxy; #endif @@ -212,6 +213,8 @@ ephy_shell_init (EphyShell *shell) ephy_shell = shell; g_object_add_weak_pointer (G_OBJECT(ephy_shell), (gpointer *)ptr); + + shell->priv->application = ephy_application_new (); } static void @@ -304,6 +307,13 @@ ephy_shell_dispose (GObject *object) } #endif /* ENABLE_NETWORK_MANAGER */ + if (priv->application != NULL) + { + LOG ("Unref application"); + g_object_unref (priv->application); + priv->application = NULL; + } + G_OBJECT_CLASS (ephy_shell_parent_class)->dispose (object); } @@ -805,6 +815,22 @@ ephy_shell_get_prefs_dialog (EphyShell *shell) return shell->priv->prefs_dialog; } +/** + * ephy_shell_get_application: + * @shell: A #EphyApplication + * + * Gets the #EphyApplication for @shell + * + * Returns: (transfer none): a #EphyApplication + **/ +EphyApplication * +ephy_shell_get_application (EphyShell *shell) +{ + g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL); + + return shell->priv->application; +} + void _ephy_shell_create_instance (void) { -- cgit v1.2.3