[epiphany] action-bar: Add a pages button



commit 9255fcf9ea6a1a5cf34a67ce53c9c2b10709084f
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Tue Nov 13 13:51:08 2018 +0100

    action-bar: Add a pages button
    
    This will be used to show the opened pages in narrow mode.

 src/ephy-action-bar.c           | 20 ++++++++++++++++++++
 src/resources/gtk/action-bar.ui | 25 +++++++++++++++++++++++++
 2 files changed, 45 insertions(+)
---
diff --git a/src/ephy-action-bar.c b/src/ephy-action-bar.c
index 41e3d6620..d3f028c38 100644
--- a/src/ephy-action-bar.c
+++ b/src/ephy-action-bar.c
@@ -20,6 +20,9 @@
  */
 
 #include "ephy-action-bar.h"
+#include "ephy-pages-popover.h"
+#include "ephy-settings.h"
+#include "ephy-shell.h"
 
 enum {
   PROP_0,
@@ -35,6 +38,8 @@ struct _EphyActionBar {
   EphyWindow *window;
   EphyActionBarStart *action_bar_start;
   EphyActionBarEnd *action_bar_end;
+  GtkMenuButton *pages_button;
+  EphyPagesPopover *pages_popover;
 };
 
 G_DEFINE_TYPE (EphyActionBar, ephy_action_bar, GTK_TYPE_REVEALER)
@@ -124,6 +129,12 @@ ephy_action_bar_class_init (EphyActionBarClass *klass)
   gtk_widget_class_bind_template_child (widget_class,
                                         EphyActionBar,
                                         action_bar_start);
+  gtk_widget_class_bind_template_child (widget_class,
+                                        EphyActionBar,
+                                        pages_button);
+  gtk_widget_class_bind_template_child (widget_class,
+                                        EphyActionBar,
+                                        pages_popover);
   gtk_widget_class_bind_template_child (widget_class,
                                         EphyActionBar,
                                         action_bar_end);
@@ -132,11 +143,20 @@ ephy_action_bar_class_init (EphyActionBarClass *klass)
 static void
 ephy_action_bar_init (EphyActionBar *action_bar)
 {
+  EphyEmbedShellMode mode;
+
   /* Ensure the types used by the template have been initialized. */
   EPHY_TYPE_ACTION_BAR_END;
   EPHY_TYPE_ACTION_BAR_START;
 
   gtk_widget_init_template (GTK_WIDGET (action_bar));
+
+  mode = ephy_embed_shell_get_mode (EPHY_EMBED_SHELL (ephy_shell_get_default ()));
+  gtk_widget_set_visible (GTK_WIDGET (action_bar->pages_button),
+                          mode != EPHY_EMBED_SHELL_MODE_APPLICATION);
+
+  ephy_pages_popover_set_adaptive_mode (action_bar->pages_popover,
+                                        EPHY_ADAPTIVE_MODE_NARROW);
 }
 
 EphyActionBar *
diff --git a/src/resources/gtk/action-bar.ui b/src/resources/gtk/action-bar.ui
index f11a9c879..80c7de82b 100644
--- a/src/resources/gtk/action-bar.ui
+++ b/src/resources/gtk/action-bar.ui
@@ -13,6 +13,28 @@
             <property name="pack-type">start</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkMenuButton" id="pages_button">
+            <property name="visible">True</property>
+            <property name="valign">center</property>
+            <!-- Translators: tooltip for the page switcher menu button -->
+            <property name="tooltip_text" translatable="yes">View open pages</property>
+            <property name="popover">pages_popover</property>
+            <style>
+              <class name="image-button"/>
+            </style>
+            <child>
+              <object class="GtkImage" id="bookmarks_image">
+                <property name="visible">True</property>
+                <property name="icon-name">view-paged-symbolic</property>
+                <property name="icon-size">1</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack-type">end</property>
+          </packing>
+        </child>
         <child>
           <object class="EphyActionBarEnd" id="action_bar_end">
             <property name="visible">True</property>
@@ -24,4 +46,7 @@
       </object>
     </child>
   </template>
+  <object class="EphyPagesPopover" id="pages_popover">
+    <property name="visible">True</property>
+  </object>
 </interface>


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