[epiphany/gnome-3-26] flatpak: Disable web app functionality



commit 77a09886ee78af0bc1adad9c1d8b43b8691f2901
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Thu Oct 5 19:25:18 2017 +0200

    flatpak: Disable web app functionality
    
    It can't possibly work

 embed/ephy-about-handler.c                     |    3 +-
 po/POTFILES.in                                 |    1 +
 src/ephy-header-bar.c                          |    8 +-
 src/resources/epiphany.gresource.xml           |    1 +
 src/resources/gtk/page-menu-popover-flatpak.ui |  186 ++++++++++++++++++++++++
 src/resources/gtk/page-menu-popover.ui         |    4 +-
 6 files changed, 199 insertions(+), 4 deletions(-)
---
diff --git a/embed/ephy-about-handler.c b/embed/ephy-about-handler.c
index 47a98e3..9126f5d 100644
--- a/embed/ephy-about-handler.c
+++ b/embed/ephy-about-handler.c
@@ -25,6 +25,7 @@
 #include "ephy-embed-prefs.h"
 #include "ephy-embed-utils.h"
 #include "ephy-file-helpers.h"
+#include "ephy-flatpak-utils.h"
 #include "ephy-history-service.h"
 #include "ephy-prefs.h"
 #include "ephy-settings.h"
@@ -620,7 +621,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"))
+  else if (!g_strcmp0 (path, "applications") && !ephy_is_running_inside_flatpak ())
     handled = ephy_about_handler_handle_applications (handler, request);
   else if (!g_strcmp0 (path, "overview"))
     handled = ephy_about_handler_handle_html_overview (handler, request);
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 5ee32e5..8ee9cd8 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -57,6 +57,7 @@ src/resources/gtk/encoding-dialog.ui
 src/resources/gtk/history-dialog.ui
 src/resources/gtk/menus.ui
 src/resources/gtk/page-menu-popover.ui
+src/resources/gtk/page-menu-popover-flatpak.ui
 src/resources/gtk/passwords-dialog.ui
 src/resources/gtk/prefs-dialog.ui
 src/resources/gtk/prefs-lang-dialog.ui
diff --git a/src/ephy-header-bar.c b/src/ephy-header-bar.c
index 7e4b0ef..a2ac439 100644
--- a/src/ephy-header-bar.c
+++ b/src/ephy-header-bar.c
@@ -34,6 +34,7 @@
 #include "ephy-embed-prefs.h"
 #include "ephy-embed-utils.h"
 #include "ephy-favicon-helpers.h"
+#include "ephy-flatpak-utils.h"
 #include "ephy-gui.h"
 #include "ephy-history-service.h"
 #include "ephy-location-entry.h"
@@ -726,7 +727,12 @@ ephy_header_bar_constructed (GObject *object)
                         gtk_image_new_from_icon_name ("open-menu-symbolic", GTK_ICON_SIZE_BUTTON));
   gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
   g_type_ensure (G_TYPE_THEMED_ICON);
-  builder = gtk_builder_new_from_resource ("/org/gnome/epiphany/gtk/page-menu-popover.ui");
+  /* FIXME: This is horrible, but it doesn't seem possible to hide a single menu item of an existing menu.
+   * Calling gtk_widget_hide() on the child menu item somehow hides the entire menu! */
+  if (ephy_is_running_inside_flatpak ())
+    builder = gtk_builder_new_from_resource ("/org/gnome/epiphany/gtk/page-menu-popover-flatpak.ui");
+  else
+    builder = gtk_builder_new_from_resource ("/org/gnome/epiphany/gtk/page-menu-popover.ui");
   page_menu_popover = GTK_WIDGET (gtk_builder_get_object (builder, "page-menu-popover"));
   header_bar->zoom_level_button = GTK_WIDGET (gtk_builder_get_object (builder, "zoom-level"));
   gtk_menu_button_set_popover (GTK_MENU_BUTTON (button), page_menu_popover);
diff --git a/src/resources/epiphany.gresource.xml b/src/resources/epiphany.gresource.xml
index 80c9e7d..1fdc99e 100644
--- a/src/resources/epiphany.gresource.xml
+++ b/src/resources/epiphany.gresource.xml
@@ -23,6 +23,7 @@
     <file preprocess="xml-stripblanks" compressed="true">gtk/history-dialog.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">gtk/menus.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">gtk/page-menu-popover.ui</file>
+    <file preprocess="xml-stripblanks" compressed="true">gtk/page-menu-popover-flatpak.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">gtk/passwords-dialog.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">gtk/prefs-dialog.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">gtk/prefs-lang-dialog.ui</file>
diff --git a/src/resources/gtk/page-menu-popover-flatpak.ui b/src/resources/gtk/page-menu-popover-flatpak.ui
new file mode 100644
index 0000000..5160f58
--- /dev/null
+++ b/src/resources/gtk/page-menu-popover-flatpak.ui
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkPopoverMenu" id="page-menu-popover">
+    <child>
+      <object class="GtkBox">
+        <property name="can_focus">False</property>
+        <property name="border_width">12</property>
+        <property name="orientation">vertical</property>
+        <property name="visible">True</property>
+        <child>
+          <object class="GtkBox" id="zoom-box">
+            <property name="visible">True</property>
+            <property name="orientation">horizontal</property>
+            <property name="homogeneous">True</property>
+            <property name="margin-bottom">6</property>
+            <style>
+                <class name="linked"/>
+            </style>
+            <child>
+              <object class="GtkModelButton">
+                <property name="text" translatable="yes">Zoom Out</property>
+                <property name="action-name">win.zoom-out</property>
+                <property name="iconic">True</property>
+                <property name="centered">True</property>
+                <property name="icon">zoom_out</property>
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkModelButton" id="zoom-level">
+                <property name="text">100%</property>
+                <property name="action-name">win.zoom-normal</property>
+                <property name="iconic">True</property>
+                <property name="xalign">0.5</property>
+                <property name="centered">True</property>
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkModelButton">
+                <property name="text" translatable="yes">Zoom In</property>
+                <property name="action-name">win.zoom-in</property>
+                <property name="iconic">True</property>
+                <property name="centered">True</property>
+                <property name="icon">zoom_in</property>
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="orientation">horizontal</property>
+            <property name="spacing">6</property>
+            <property name="homogeneous">True</property>
+            <property name="margin-bottom">6</property>
+            <child>
+              <object class="GtkModelButton">
+                <property name="text" translatable="yes">Zoom Out</property>
+                <property name="action-name">win.print</property>
+                <property name="iconic">True</property>
+                <property name="centered">True</property>
+                <property name="icon">print</property>
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkModelButton">
+                <property name="text" translatable="yes">Zoom Out</property>
+                <property name="action-name">win.find</property>
+                <property name="iconic">True</property>
+                <property name="centered">True</property>
+                <property name="icon">find</property>
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkModelButton">
+                <property name="text" translatable="yes">Zoom In</property>
+                <property name="action-name">win.fullscreen</property>
+                <property name="iconic">True</property>
+                <property name="centered">True</property>
+                <property name="icon">fullscreen</property>
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkSeparator">
+            <property name="orientation">horizontal</property>
+            <property name="margin-top">6</property>
+            <property name="margin-bottom">6</property>
+            <property name="visible">True</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="can_focus">True</property>
+            <property name="text" translatable="yes">_New Tab</property>
+            <property name="action-name">win.new-tab</property>
+            <property name="visible">True</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="can_focus">True</property>
+            <property name="text" translatable="yes">New _Window</property>
+            <property name="action-name">app.new-window</property>
+            <property name="visible">True</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="can_focus">True</property>
+            <property name="text" translatable="yes">New _Incognito Window</property>
+            <property name="action-name">app.new-incognito</property>
+            <property name="visible">True</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkSeparator">
+            <property name="orientation">horizontal</property>
+            <property name="margin-top">6</property>
+            <property name="margin-bottom">6</property>
+            <property name="visible">True</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkModelButton">
+            <property name="can_focus">True</property>
+            <property name="text" translatable="yes">Text _Encoding</property>
+            <property name="action-name">win.encoding</property>
+            <property name="visible">True</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+    <object class="GThemedIcon" id="zoom_out">
+    <property name="name">zoom-out-symbolic</property>
+  </object>
+  <object class="GThemedIcon" id="zoom_in">
+    <property name="name">zoom-in-symbolic</property>
+  </object>
+  <object class="GThemedIcon" id="print">
+    <property name="name">document-print-symbolic</property>
+  </object>
+  <object class="GThemedIcon" id="find">
+    <property name="name">system-search-symbolic</property>
+  </object>
+  <object class="GThemedIcon" id="fullscreen">
+    <property name="name">view-fullscreen-symbolic</property>
+  </object>
+</interface>
diff --git a/src/resources/gtk/page-menu-popover.ui b/src/resources/gtk/page-menu-popover.ui
index 284d202..651ae41 100644
--- a/src/resources/gtk/page-menu-popover.ui
+++ b/src/resources/gtk/page-menu-popover.ui
@@ -166,7 +166,7 @@
           </object>
         </child>
         <child>
-          <object class="GtkSeparator">
+          <object class="GtkSeparator" id="save-as-application-separator">
             <property name="orientation">horizontal</property>
             <property name="margin-top">6</property>
             <property name="margin-bottom">6</property>
@@ -174,7 +174,7 @@
           </object>
         </child>
         <child>
-          <object class="GtkModelButton">
+          <object class="GtkModelButton" id="save-as-application-button">
             <property name="can_focus">True</property>
             <property name="text" translatable="yes">Install Site as Web _Application…</property>
             <property name="action-name">win.save-as-application</property>


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