aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-shell.c
diff options
context:
space:
mode:
authorGiovanni Campagna <gcampagna@src.gnome.org>2013-08-18 21:17:23 +0800
committerGiovanni Campagna <gcampagn@redhat.com>2013-08-29 22:09:41 +0800
commit77df45f51f70243aaad5ec88b816c881cfdb2dbe (patch)
treebba0f0b9ebb6c90390d4f68a8b041507c5fc4f7e /src/ephy-shell.c
parentfa9ed211b6457537492162d71d552ad5fee9c835 (diff)
downloadgsoc2013-epiphany-77df45f51f70243aaad5ec88b816c881cfdb2dbe.tar
gsoc2013-epiphany-77df45f51f70243aaad5ec88b816c881cfdb2dbe.tar.gz
gsoc2013-epiphany-77df45f51f70243aaad5ec88b816c881cfdb2dbe.tar.bz2
gsoc2013-epiphany-77df45f51f70243aaad5ec88b816c881cfdb2dbe.tar.lz
gsoc2013-epiphany-77df45f51f70243aaad5ec88b816c881cfdb2dbe.tar.xz
gsoc2013-epiphany-77df45f51f70243aaad5ec88b816c881cfdb2dbe.tar.zst
gsoc2013-epiphany-77df45f51f70243aaad5ec88b816c881cfdb2dbe.zip
EphyShell: add support for starting without windows
To launch epiphany as a DBus service, we need to be able to launch without opening windows, and then use the GApplication inactivity timeout to manage our lifetime. https://bugzilla.gnome.org/show_bug.cgi?id=694943
Diffstat (limited to 'src/ephy-shell.c')
-rw-r--r--src/ephy-shell.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index f514c6398..9e91bc7b0 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -296,21 +296,38 @@ session_load_cb (GObject *object,
}
static void
+ephy_shell_start_headless (EphyShell *shell)
+{
+ /* A bit of a hack: because we don't pass IS_SERVICE to GApplication
+ (because otherwise we would need a separate launcher binary), we
+ don't get the 10 seconds timeout for the first DBus call.
+ So just hold/release to get the inactivity timeout started instead.
+ */
+
+ g_application_hold (G_APPLICATION (shell));
+ g_application_release (G_APPLICATION (shell));
+ ephy_shell_startup_continue (shell);
+}
+
+static void
ephy_shell_activate (GApplication *application)
{
EphyShell *shell = EPHY_SHELL (application);
/*
* We get here on each new instance (remote or not). Autoresume the
- * session unless we are in application mode and queue the
+ * session unless we are in application or headless mode and queue the
* commands.
*/
if (ephy_embed_shell_get_mode (EPHY_EMBED_SHELL (shell)) != EPHY_EMBED_SHELL_MODE_APPLICATION) {
EphyShellStartupContext *ctx;
ctx = shell->priv->startup_context;
- ephy_session_resume (ephy_shell_get_session (shell),
- ctx->user_time, NULL, session_load_cb, shell);
+ if (ctx->startup_flags != EPHY_STARTUP_OPEN_NOTHING)
+ ephy_session_resume (ephy_shell_get_session (shell),
+ ctx->user_time, NULL, session_load_cb, shell);
+ else
+ ephy_shell_start_headless (shell);
} else
ephy_shell_startup_continue (shell);
}
@@ -597,6 +614,8 @@ ephy_shell_init (EphyShell *shell)
webkit_web_context_set_favicon_database_directory (web_context, favicon_db_path);
g_free (favicon_db_path);
#endif
+
+ g_application_set_inactivity_timeout (G_APPLICATION (shell), 60 * 1000);
}
static void