[epiphany] Allow running system web apps outside GNOME
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Allow running system web apps outside GNOME
- Date: Mon, 20 Jun 2016 16:16:34 +0000 (UTC)
commit 857805ad6e8c0ed09452b9809600bcda3c484575
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Wed Jun 1 07:08:48 2016 -0500
Allow running system web apps outside GNOME
Expect system web apps to pass the desktop file path via the command
line using the existing --application-mode flag, rather than requiring
that Epiphany be started via Gio. This allows Epiphany to compete with
Electron as a choice for running web apps that work outside GNOME. It
also breaks any existing system web apps, but that's probably fine as
this feature is new in 3.20 and I'm not aware of anybody using it yet.
Note this "API" is subject to change prior to the 3.22.0 release.
https://bugzilla.gnome.org/show_bug.cgi?id=767101
src/ephy-main.c | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/src/ephy-main.c b/src/ephy-main.c
index ae0dd1b..7e9ab88 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -54,9 +54,21 @@ static char *application_to_delete = NULL;
static gboolean private_instance = FALSE;
static gboolean incognito_mode = FALSE;
static gboolean application_mode = FALSE;
+static char *desktop_file_path = NULL;
static char *profile_directory = NULL;
static gboolean
+application_mode_cb (const gchar *option_name,
+ const gchar *value,
+ gpointer data,
+ GError **error)
+{
+ application_mode = TRUE;
+ desktop_file_path = g_strdup (value);
+ return TRUE;
+}
+
+static gboolean
option_version_cb (const gchar *option_name,
const gchar *value,
gpointer data,
@@ -86,7 +98,8 @@ static const GOptionEntry option_entries[] =
N_("Start an instance in incognito mode"), NULL },
{ "netbank-mode", 0, 0, G_OPTION_ARG_NONE, &incognito_mode,
N_("Start an instance in netbank mode"), NULL },
- { "application-mode", 'a', 0, G_OPTION_ARG_NONE, &application_mode,
+ { "application-mode", 'a', G_OPTION_FLAG_FILENAME | G_OPTION_FLAG_OPTIONAL_ARG,
+ G_OPTION_ARG_CALLBACK, application_mode_cb,
N_("Start the browser in application mode"), NULL },
{ "profile", 0, 0, G_OPTION_ARG_STRING, &profile_directory,
N_("Profile directory to use in the private instance"), N_("DIR") },
@@ -346,18 +359,21 @@ main (int argc,
}
if (application_mode && !profile_directory) {
- const char *desktop_file_path = g_getenv ("GIO_LAUNCHED_DESKTOP_FILE");
-
if (desktop_file_path) {
desktop_info = g_desktop_app_info_new_from_filename (desktop_file_path);
if (desktop_info)
profile_directory = ephy_web_application_ensure_for_app_info (G_APP_INFO (desktop_info));
+
+ if (!profile_directory) {
+ g_print ("Invalid desktop file passed to --application-mode\n");
+ exit (1);
+ }
}
}
if (application_mode && profile_directory == NULL) {
- g_print ("--profile must be used when --application-mode is requested\n");
+ g_print ("--profile must be used when --application-mode is requested without desktop file path\n");
exit (1);
}
@@ -480,6 +496,7 @@ main (int argc,
/* Shutdown */
g_object_unref (ephy_shell);
+ g_free (desktop_file_path);
g_free (profile_directory);
if (notify_is_initted ())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]