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




commit c299c9b97415663475b181455db6fae57f7f1664
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   | 17 +++++++++++++++++
 lib/ephy-web-app-utils.h   |  2 ++
 3 files changed, 22 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..d89bdca58 100644
--- a/lib/ephy-web-app-utils.c
+++ b/lib/ephy-web-app-utils.c
@@ -963,3 +963,20 @@ ephy_web_application_save (EphyWebApplication *app)
 
   return saved;
 }
+
+gboolean
+ephy_web_application_is_system (EphyWebApplication *app)
+{
+  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]