[epiphany/mwleeds/webapp-dbus-api: 5/5] Very WIP
- From: Phaedrus Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/mwleeds/webapp-dbus-api: 5/5] Very WIP
- Date: Fri, 17 Dec 2021 03:33:20 +0000 (UTC)
commit 5529dd14550b080ce2dc48751c8bc428d8faf2c9
Author: Phaedrus Leeds <mwleeds protonmail com>
Date: Thu Dec 16 19:32:36 2021 -0800
Very WIP
embed/ephy-about-handler.c | 2 +-
lib/ephy-file-helpers.c | 8 ++++----
lib/ephy-flatpak-utils.c | 14 ++++++++++++++
lib/ephy-flatpak-utils.h | 1 +
src/window-commands.c | 8 +-------
5 files changed, 21 insertions(+), 12 deletions(-)
---
diff --git a/embed/ephy-about-handler.c b/embed/ephy-about-handler.c
index 4e570d473..a93db09c2 100644
--- a/embed/ephy-about-handler.c
+++ b/embed/ephy-about-handler.c
@@ -584,7 +584,7 @@ ephy_about_handler_handle_request (EphyAboutHandler *handler,
handled = ephy_about_handler_handle_memory (handler, request);
else if (!g_strcmp0 (path, "epiphany"))
handled = ephy_about_handler_handle_epiphany (handler, request);
- else if (!g_strcmp0 (path, "applications") && !ephy_is_running_inside_sandbox ())
+ else if (!g_strcmp0 (path, "applications") && !ephy_can_install_web_apps ())
handled = ephy_about_handler_handle_applications (handler, request);
else if (!g_strcmp0 (path, "newtab"))
handled = ephy_about_handler_handle_newtab (handler, request);
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
index d1ad88e26..190f655d7 100644
--- a/lib/ephy-file-helpers.c
+++ b/lib/ephy-file-helpers.c
@@ -554,7 +554,7 @@ launch_application (GAppInfo *app,
/* This is impossible to implement inside sandbox. Higher layers must
* ensure we don't get here.
*/
- g_assert (!ephy_is_running_inside_sandbox ());
+ /* g_assert (!ephy_is_running_inside_sandbox ()); */
display = gdk_display_get_default ();
screen = gdk_screen_get_default ();
@@ -590,10 +590,10 @@ ephy_file_launch_desktop_file (const char *filename,
/* This is impossible to implement inside sandbox. Higher layers must
* ensure we don't get here.
*/
- g_assert (tag == EPHY_FILE_HELPERS_I_UNDERSTAND_I_MUST_NOT_USE_THIS_FUNCTION_UNDER_FLATPAK);
- g_assert (!ephy_is_running_inside_sandbox ());
+ //g_assert (tag == EPHY_FILE_HELPERS_I_UNDERSTAND_I_MUST_NOT_USE_THIS_FUNCTION_UNDER_FLATPAK);
+ //g_assert (!ephy_is_running_inside_sandbox ());
- app = g_desktop_app_info_new (filename);
+ app = g_desktop_app_info_new_from_filename (filename);
return launch_application (G_APP_INFO (app), NULL, user_time);
}
diff --git a/lib/ephy-flatpak-utils.c b/lib/ephy-flatpak-utils.c
index 6fc9a5dec..568dbcde9 100644
--- a/lib/ephy-flatpak-utils.c
+++ b/lib/ephy-flatpak-utils.c
@@ -140,3 +140,17 @@ ephy_open_uri_via_flatpak_portal (const char *uri)
{
ephy_open_uri (uri, FALSE);
}
+
+gboolean
+ephy_can_install_web_apps (void)
+{
+ if (!ephy_is_running_inside_sandbox ())
+ return TRUE;
+
+#if USE_LIBPORTAL
+ //TODO bump version requirement of libportal and also check that the portal is available
+ return TRUE;
+#else
+ return FALSE;
+#endif
+}
diff --git a/lib/ephy-flatpak-utils.h b/lib/ephy-flatpak-utils.h
index 15b85ac9b..289663efb 100644
--- a/lib/ephy-flatpak-utils.h
+++ b/lib/ephy-flatpak-utils.h
@@ -30,3 +30,4 @@ void ephy_open_uri_via_flatpak_portal (const char *uri);
void ephy_open_directory_via_flatpak_portal (const char *uri);
+gboolean ephy_can_install_web_apps (void);
diff --git a/src/window-commands.c b/src/window-commands.c
index 07ed22cea..fd84319d9 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -76,13 +76,7 @@ window_cmd_new_window (GSimpleAction *action,
EphyWindow *new_window;
EphyShell *shell = ephy_shell_get_default ();
- if (ephy_embed_shell_get_mode (EPHY_EMBED_SHELL (shell)) == EPHY_EMBED_SHELL_MODE_INCOGNITO) {
- ephy_open_default_instance_window ();
- return;
- }
-
- new_window = ephy_window_new ();
- ephy_link_open (EPHY_LINK (new_window), NULL, NULL, EPHY_LINK_HOME_PAGE);
+ ephy_file_launch_desktop_file
("/var/home/mwleeds/.var/app/org.gnome.Epiphany.Devel/data/org.gnome.Epiphany.WebApp-reddit-27aa67d11878da3049675f218f9822318d27bf67/org.gnome.Epiphany.WebApp-reddit-27aa67d11878da3049675f218f9822318d27bf67.desktop",
gtk_get_current_event_time (), EPHY_FILE_HELPERS_I_UNDERSTAND_I_MUST_NOT_USE_THIS_FUNCTION_UNDER_FLATPAK);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]