[epiphany/wip/exalm/tabs: 2/6] Merge TabHeaderBar into PagesView




commit cfee657b63037db719c8e16c50de2c1fca68d7ff
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Sep 8 20:19:05 2020 +0500

    Merge TabHeaderBar into PagesView
    
    This change does regress the UI a little by introducing a duplicate header
    bar in the pages view. This will be fixed in the next commit, otherwise the
    change would be very massive.

 src/ephy-pages-view.c           |  5 +--
 src/ephy-pages-view.h           |  2 +-
 src/ephy-tab-header-bar.c       | 86 -----------------------------------------
 src/ephy-tab-header-bar.h       | 35 -----------------
 src/ephy-window.c               | 23 +----------
 src/meson.build                 |  1 -
 src/resources/gtk/pages-view.ui | 62 +++++++++++++++++++++++------
 7 files changed, 55 insertions(+), 159 deletions(-)
---
diff --git a/src/ephy-pages-view.c b/src/ephy-pages-view.c
index 13485f816..94a7ad7d3 100644
--- a/src/ephy-pages-view.c
+++ b/src/ephy-pages-view.c
@@ -29,16 +29,15 @@
 #include "ephy-window.h"
 
 struct _EphyPagesView {
-  GtkScrolledWindow parent_instance;
+  GtkBox parent_instance;
 
   GtkListBox *list_box;
 
   GListStore *list_store;
   EphyNotebook *notebook;
-  EphyAdaptiveMode adaptive_mode;
 };
 
-G_DEFINE_TYPE (EphyPagesView, ephy_pages_view, GTK_TYPE_SCROLLED_WINDOW)
+G_DEFINE_TYPE (EphyPagesView, ephy_pages_view, GTK_TYPE_BOX)
 
 static void
 drop_notebook (EphyPagesView *self)
diff --git a/src/ephy-pages-view.h b/src/ephy-pages-view.h
index fe8cd91ce..db910d1b8 100644
--- a/src/ephy-pages-view.h
+++ b/src/ephy-pages-view.h
@@ -29,7 +29,7 @@ G_BEGIN_DECLS
 
 #define EPHY_TYPE_PAGES_VIEW (ephy_pages_view_get_type ())
 
-G_DECLARE_FINAL_TYPE (EphyPagesView, ephy_pages_view, EPHY, PAGES_VIEW, GtkScrolledWindow)
+G_DECLARE_FINAL_TYPE (EphyPagesView, ephy_pages_view, EPHY, PAGES_VIEW, GtkBox)
 
 EphyPagesView *ephy_pages_view_new               (void);
 
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 57af66537..3adb2275d 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -52,7 +52,6 @@
 #include "ephy-session.h"
 #include "ephy-settings.h"
 #include "ephy-shell.h"
-#include "ephy-tab-header-bar.h"
 #include "ephy-title-box.h"
 #include "ephy-title-widget.h"
 #include "ephy-type-builtins.h"
@@ -3560,33 +3559,13 @@ title_widget_lock_clicked_cb (EphyTitleWidget *title_widget,
 static GtkWidget *
 setup_header_bar (EphyWindow *window)
 {
-  GtkWidget *title_bar;
   GtkWidget *header_bar;
-  GtkWidget *tab_header_bar;
-  GtkWidget *header_deck;
   EphyTitleWidget *title_widget;
-  HdySwipeGroup *swipe_group;
 
-  title_bar = hdy_title_bar_new ();
   header_bar = ephy_header_bar_new (window);
-  tab_header_bar = ephy_tab_header_bar_new ();
-  header_deck = hdy_deck_new ();
-  hdy_deck_set_can_swipe_back (HDY_DECK (header_deck), TRUE);
 
-  gtk_container_add (GTK_CONTAINER (title_bar), header_deck);
-  gtk_container_add (GTK_CONTAINER (header_deck), header_bar);
-  gtk_container_add (GTK_CONTAINER (header_deck), tab_header_bar);
-
-  hdy_deck_set_visible_child (HDY_DECK (header_deck), header_bar);
-
-  swipe_group = hdy_swipe_group_new ();
-  hdy_swipe_group_add_swipeable (swipe_group, HDY_SWIPEABLE (header_deck));
-  hdy_swipe_group_add_swipeable (swipe_group, HDY_SWIPEABLE (window->main_deck));
-
-  dzl_application_window_set_titlebar (DZL_APPLICATION_WINDOW (window), title_bar);
-  gtk_widget_show (title_bar);
+  dzl_application_window_set_titlebar (DZL_APPLICATION_WINDOW (window), header_bar);
   gtk_widget_show (header_bar);
-  gtk_widget_show (header_deck);
 
   title_widget = ephy_header_bar_get_title_widget (EPHY_HEADER_BAR (header_bar));
   g_signal_connect (title_widget, "lock-clicked",
diff --git a/src/meson.build b/src/meson.build
index 4a78dd75e..7886d6f14 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -44,7 +44,6 @@ libephymain_sources = [
   'ephy-session.c',
   'ephy-shell.c',
   'ephy-suggestion-model.c',
-  'ephy-tab-header-bar.c',
   'ephy-tab-label.c',
   'ephy-web-extension-dialog.c',
   'ephy-window.c',
diff --git a/src/resources/gtk/pages-view.ui b/src/resources/gtk/pages-view.ui
index cb97d1979..89de56f3e 100644
--- a/src/resources/gtk/pages-view.ui
+++ b/src/resources/gtk/pages-view.ui
@@ -1,19 +1,59 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.16 -->
-  <template class="EphyPagesView" parent="GtkScrolledWindow">
-    <property name="hscrollbar_policy">never</property>
-    <property name="propagate_natural_height">True</property>
-    <property name="visible">True</property>
+  <template class="EphyPagesView" parent="GtkBox">
+    <property name="orientation">vertical</property>
     <child>
-      <object class="GtkListBox" id="list_box">
-        <property name="selection_mode">single</property>
+      <object class="HdyHeaderBar">
         <property name="visible">True</property>
-        <property name="width_request">300</property>
-        <signal name="row-activated" handler="row_activated_cb" swapped="true"/>
-        <style>
-          <class name="transparent"/>
-        </style>
+        <property name="show-close-button">True</property>
+        <property name="title" translatable="yes">Tabs</property>
+        <property name="has-subtitle">False</property>
+        <child>
+          <object class="GtkButton">
+            <property name="visible">True</property>
+            <property name="action-name">win.content</property>
+            <child>
+              <object class="GtkImage">
+                <property name="visible">True</property>
+                <property name="icon-name">go-previous-symbolic</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkButton">
+            <property name="visible">True</property>
+            <property name="action-name">win.new-tab</property>
+            <child>
+              <object class="GtkImage">
+                <property name="visible">True</property>
+                <property name="icon-name">tab-new-symbolic</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="pack-type">end</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkScrolledWindow">
+        <property name="visible">True</property>
+        <property name="hscrollbar_policy">never</property>
+        <property name="vexpand">True</property>
+        <child>
+          <object class="GtkListBox" id="list_box">
+            <property name="selection_mode">single</property>
+            <property name="visible">True</property>
+            <property name="width_request">300</property>
+            <signal name="row-activated" handler="row_activated_cb" swapped="true"/>
+            <style>
+              <class name="transparent"/>
+            </style>
+          </object>
+        </child>
       </object>
     </child>
   </template>


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