[epiphany/wip/exalm/tabs: 21/33] Merge TabHeaderBar into PagesView




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

    Merge TabHeaderBar into PagesView

 src/ephy-pages-view.c           |  4 +-
 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(+), 158 deletions(-)
---
diff --git a/src/ephy-pages-view.c b/src/ephy-pages-view.c
index 8ac9d424d..63dd0ab65 100644
--- a/src/ephy-pages-view.c
+++ b/src/ephy-pages-view.c
@@ -28,7 +28,7 @@
 #include "ephy-window.h"
 
 struct _EphyPagesView {
-  GtkScrolledWindow parent_instance;
+  GtkBox parent_instance;
 
   GtkListBox *list_box;
 
@@ -36,7 +36,7 @@ struct _EphyPagesView {
   EphyTabView *tab_view;
 };
 
-G_DEFINE_TYPE (EphyPagesView, ephy_pages_view, GTK_TYPE_SCROLLED_WINDOW)
+G_DEFINE_TYPE (EphyPagesView, ephy_pages_view, GTK_TYPE_BOX)
 
 static void
 drop_tab_view (EphyPagesView *self)
diff --git a/src/ephy-pages-view.h b/src/ephy-pages-view.h
index 47f137b44..6c05b0a7a 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 4dab4fc43..1a2b7abad 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -51,7 +51,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"
@@ -3474,33 +3473,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 0b50573b1..43fe49425 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -39,7 +39,6 @@ libephymain_sources = [
   'ephy-shell.c',
   'ephy-suggestion-model.c',
   'ephy-tab-view.c',
-  'ephy-tab-header-bar.c',
   'ephy-window.c',
   'popup-commands.c',
   'preferences/clear-data-view.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]