[epiphany/wip/exalm/webapps: 2/2] Skip system web apps for about:applications




commit 1691d800c8a44e0bea9cff5d6be7ac88a9b9927a
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Fri Sep 25 16:14:18 2020 +0500

    Skip system web apps for about:applications
    
    They cannot be deleted as we don't control their desktop file. Don't show
    them at all.

 embed/ephy-about-handler.c |  3 +++
 lib/ephy-web-app-utils.c   | 18 ++++++++++++++++++
 lib/ephy-web-app-utils.h   |  2 ++
 3 files changed, 23 insertions(+)
---
diff --git a/embed/ephy-about-handler.c b/embed/ephy-about-handler.c
index 029aa64c6..597a1654e 100644
--- a/embed/ephy-about-handler.c
+++ b/embed/ephy-about-handler.c
@@ -264,6 +264,9 @@ handle_applications_finished_cb (EphyAboutHandler       *handler,
     for (p = applications; p; p = p->next) {
       EphyWebApplication *app = (EphyWebApplication *)p->data;
 
+      if (ephy_web_application_is_system (app))
+        continue;
+
       g_string_append_printf (data_str,
                               "<tbody><tr id =\"%s\">"
                               "<td class=\"icon\"><img width=64 height=64 src=\"file://%s\"></img></td>"
diff --git a/lib/ephy-web-app-utils.c b/lib/ephy-web-app-utils.c
index 086d794b7..979856f21 100644
--- a/lib/ephy-web-app-utils.c
+++ b/lib/ephy-web-app-utils.c
@@ -963,3 +963,21 @@ ephy_web_application_save (EphyWebApplication *app)
 
   return saved;
 }
+
+gboolean
+ephy_web_application_is_system (EphyWebApplication *app)
+{
+  GSettings *settings;
+  GSettings *web_app_settings;
+  g_autofree char *profile_directory = NULL;
+  g_autofree char *name = NULL;
+  g_autofree char *path = NULL;
+
+  profile_directory = ephy_web_application_get_profile_directory (app->id);
+  name = g_path_get_basename (profile_directory);
+
+  path = g_build_path ("/", "/org/gnome/epiphany/web-apps/", name, "webapp/", NULL);
+  web_app_settings = g_settings_new_with_path (EPHY_PREFS_WEB_APP_SCHEMA, path);
+
+  return g_settings_get_boolean (web_app_settings, EPHY_PREFS_WEB_APP_SYSTEM);
+}
diff --git a/lib/ephy-web-app-utils.h b/lib/ephy-web-app-utils.h
index 0044abf94..3d68263e6 100644
--- a/lib/ephy-web-app-utils.h
+++ b/lib/ephy-web-app-utils.h
@@ -77,4 +77,6 @@ gboolean            ephy_web_application_is_uri_allowed (const char *uri);
 
 gboolean            ephy_web_application_save (EphyWebApplication *app);
 
+gboolean            ephy_web_application_is_system (EphyWebApplication *app);
+
 G_END_DECLS


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]