[console/wip/exalm/tab-overview] Port to AdwTabOverview




commit 94d0845788852eb1b7ba46575a86aed8f553c2df
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Wed Aug 17 00:02:19 2022 +0400

    Port to AdwTabOverview

 build-aux/flatpak/org.gnome.Console.Devel.json     |  33 +
 src/icons/scalable/status/tab-counter-symbolic.svg |  69 --
 .../scalable/status/tab-overflow-symbolic.svg      |  41 --
 .../status/tab-switcher-collapse-symbolic.svg      |  61 --
 src/kgx-pages.c                                    |  14 +
 src/kgx-pages.h                                    |   1 +
 src/kgx-tab-button.c                               | 299 ---------
 src/kgx-tab-button.h                               |  35 -
 src/kgx-tab-button.ui                              |  28 -
 src/kgx-tab-switcher-row.c                         | 399 ------------
 src/kgx-tab-switcher-row.h                         |  39 --
 src/kgx-tab-switcher-row.ui                        |  82 ---
 src/kgx-tab-switcher.c                             | 705 ---------------------
 src/kgx-tab-switcher.h                             |  44 --
 src/kgx-tab-switcher.ui                            |  75 ---
 src/kgx-window.c                                   |  22 +-
 src/kgx-window.h                                   |   2 +-
 src/kgx-window.ui                                  |  14 +-
 src/kgx.gresource.xml.in                           |   6 -
 src/meson.build                                    |   6 -
 src/style.css                                      |  82 +--
 21 files changed, 80 insertions(+), 1977 deletions(-)
---
diff --git a/build-aux/flatpak/org.gnome.Console.Devel.json b/build-aux/flatpak/org.gnome.Console.Devel.json
index a0c1a96..ea72986 100644
--- a/build-aux/flatpak/org.gnome.Console.Devel.json
+++ b/build-aux/flatpak/org.gnome.Console.Devel.json
@@ -49,6 +49,39 @@
                 }
             ]
         },
+    {
+      "name" : "libsass",
+      "buildsystem" : "meson",
+      "sources" : [
+        {
+          "type" : "git",
+          "url" : "https://github.com/lazka/libsass.git";,
+          "branch" : "meson"
+        }
+      ]
+    },
+    {
+      "name" : "sassc",
+      "buildsystem" : "meson",
+      "sources" : [
+        {
+          "type" : "git",
+          "url" : "https://github.com/lazka/sassc.git";,
+          "branch" : "meson"
+        }
+      ]
+    },
+        {
+            "name": "libadwaita",
+            "buildsystem": "meson",
+            "sources": [
+                {
+                    "type" : "git",
+                    "url" : "https://gitlab.gnome.org/GNOME/libadwaita.git";,
+                    "branch" : "wip/exalm/tab-overview"
+                }
+            ]
+        },
         {
             "name" : "gnome-console",
             "builddir" : true,
diff --git a/src/kgx-pages.c b/src/kgx-pages.c
index 4f94aee..ac4eb27 100644
--- a/src/kgx-pages.c
+++ b/src/kgx-pages.c
@@ -896,3 +896,17 @@ kgx_pages_detach_page (KgxPages *self)
   new_view = create_window (ADW_TAB_VIEW (priv->view), self);
   adw_tab_view_transfer_page (ADW_TAB_VIEW (priv->view), page, new_view, 0);
 }
+
+
+AdwTabPage *
+kgx_pages_get_selected_page (KgxPages  *self)
+{
+  KgxPagesPrivate *priv;
+
+  g_return_val_if_fail (KGX_IS_PAGES (self), NULL);
+
+  priv = kgx_pages_get_instance_private (self);
+
+  return adw_tab_view_get_selected_page (ADW_TAB_VIEW (priv->view));
+}
+
diff --git a/src/kgx-pages.h b/src/kgx-pages.h
index 11b58b0..f8c1b13 100644
--- a/src/kgx-pages.h
+++ b/src/kgx-pages.h
@@ -53,5 +53,6 @@ void        kgx_pages_focus_page     (KgxPages   *self,
 KgxStatus   kgx_pages_current_status (KgxPages   *self);
 void        kgx_pages_close_page          (KgxPages  *self);
 void        kgx_pages_detach_page         (KgxPages  *self);
+AdwTabPage *kgx_pages_get_selected_page   (KgxPages  *self);
 
 G_END_DECLS
diff --git a/src/kgx-window.c b/src/kgx-window.c
index 9c63bb2..58c9bfc 100644
--- a/src/kgx-window.c
+++ b/src/kgx-window.c
@@ -38,8 +38,6 @@
 #include "kgx-process.h"
 #include "kgx-close-dialog.h"
 #include "kgx-pages.h"
-#include "kgx-tab-button.h"
-#include "kgx-tab-switcher.h"
 #include "kgx-theme-switcher.h"
 #include "kgx-watcher.h"
 
@@ -290,11 +288,12 @@ static void new_tab_activated (GSimpleAction *action,
                                gpointer       data);
 
 
-static void
-new_tab_cb (KgxTabSwitcher *switcher,
-            KgxWindow      *self)
+static AdwTabPage *
+create_tab_cb (KgxWindow *self)
 {
   new_tab_activated (NULL, NULL, self);
+
+  return kgx_pages_get_selected_page (KGX_PAGES (self->pages));
 }
 
 
@@ -336,7 +335,7 @@ kgx_window_class_init (KgxWindowClass *klass)
   gtk_widget_class_bind_template_child (widget_class, KgxWindow, zoom_level);
   gtk_widget_class_bind_template_child (widget_class, KgxWindow, tab_bar);
   gtk_widget_class_bind_template_child (widget_class, KgxWindow, tab_button);
-  gtk_widget_class_bind_template_child (widget_class, KgxWindow, tab_switcher);
+  gtk_widget_class_bind_template_child (widget_class, KgxWindow, tab_overview);
   gtk_widget_class_bind_template_child (widget_class, KgxWindow, pages);
   gtk_widget_class_bind_template_child (widget_class, KgxWindow, primary_menu);
 
@@ -346,7 +345,7 @@ kgx_window_class_init (KgxWindowClass *klass)
   gtk_widget_class_bind_template_callback (widget_class, zoom);
   gtk_widget_class_bind_template_callback (widget_class, status_changed);
   gtk_widget_class_bind_template_callback (widget_class, extra_drag_drop);
-  gtk_widget_class_bind_template_callback (widget_class, new_tab_cb);
+  gtk_widget_class_bind_template_callback (widget_class, create_tab_cb);
 }
 
 
@@ -451,7 +450,7 @@ tab_switcher_activated (GSimpleAction *action,
 {
   KgxWindow *self = data;
 
-  kgx_tab_switcher_open (KGX_TAB_SWITCHER (self->tab_switcher));
+  adw_tab_overview_set_open (ADW_TAB_OVERVIEW (self->tab_overview), TRUE);
 }
 
 
@@ -533,8 +532,6 @@ kgx_window_init (KgxWindow *self)
   g_autoptr (GtkWindowGroup) group = NULL;
   g_autoptr (GPropertyAction) pact = NULL;
 
-  g_type_ensure (KGX_TYPE_TAB_BUTTON);
-  g_type_ensure (KGX_TYPE_TAB_SWITCHER);
   g_type_ensure (KGX_TYPE_THEME_SWITCHER);
 
   gtk_widget_init_template (GTK_WIDGET (self));
@@ -576,12 +573,15 @@ kgx_window_init (KgxWindow *self)
                           self->tab_button, "view",
                           G_BINDING_SYNC_CREATE);
   g_object_bind_property (self->pages, "tab-view",
-                          self->tab_switcher, "view",
+                          self->tab_overview, "view",
                           G_BINDING_SYNC_CREATE);
 
   adw_tab_bar_setup_extra_drop_target (ADW_TAB_BAR (self->tab_bar),
                                        GDK_ACTION_COPY,
                                        (GType[1]) { G_TYPE_STRING }, 1);
+  adw_tab_overview_setup_extra_drop_target (ADW_TAB_OVERVIEW (self->tab_overview),
+                                            GDK_ACTION_COPY,
+                                            (GType[1]) { G_TYPE_STRING }, 1);
 
   group = gtk_window_group_new ();
   gtk_window_group_add_window (group, GTK_WINDOW (self));
diff --git a/src/kgx-window.h b/src/kgx-window.h
index 2b364d2..37c4453 100644
--- a/src/kgx-window.h
+++ b/src/kgx-window.h
@@ -93,7 +93,7 @@ struct _KgxWindow
   GtkWidget            *zoom_level;
   GtkWidget            *tab_bar;
   GtkWidget            *tab_button;
-  GtkWidget            *tab_switcher;
+  GtkWidget            *tab_overview;
   GtkWidget            *pages;
   GMenu                *primary_menu;
 
diff --git a/src/kgx-window.ui b/src/kgx-window.ui
index 32e904c..3b8c0b5 100644
--- a/src/kgx-window.ui
+++ b/src/kgx-window.ui
@@ -34,11 +34,15 @@
     <signal name="notify::default-width" handler="size_changed" swapped="no"/>
     <signal name="notify::default-height" handler="size_changed" swapped="no"/>
     <property name="content">
-      <object class="KgxTabSwitcher" id="tab_switcher">
-        <signal name="new-tab" handler="new_tab_cb" swapped="no"/>
+      <object class="AdwTabOverview" id="tab_overview">
+        <property name="enable-new-tab">True</property>
+        <signal name="create-tab" handler="create_tab_cb" swapped="yes"/>
         <property name="child">
           <object class="GtkBox">
             <property name="orientation">vertical</property>
+            <style>
+              <class name="main-box"/>
+            </style>
             <child>
               <object class="GtkHeaderBar" id="header_bar">
                 <property name="title-widget">
@@ -120,14 +124,12 @@
                   </object>
                 </child>
                 <child type="end">
-                  <object class="KgxTabButton" id="tab_button">
-                    <property name="visible" bind-source="tab_switcher" bind-property="narrow" 
bind-flags="sync-create"/>
+                  <object class="AdwTabButton" id="tab_button">
                     <property name="action-name">win.tab-switcher</property>
                   </object>
                 </child>
                 <child type="end">
                   <object class="GtkButton">
-                    <property name="visible" bind-source="tab_switcher" bind-property="narrow" 
bind-flags="sync-create|invert-boolean"/>
                     <property name="can-focus">0</property>
                     <property name="receives-default">0</property>
                     <property name="action-name">win.new-tab</property>
@@ -139,7 +141,7 @@
             </child>
             <child>
               <object class="GtkRevealer">
-                <property name="reveal-child" bind-source="tab_switcher" bind-property="narrow" 
bind-flags="sync-create|invert-boolean"/>
+                <property name="reveal-child">True</property>
                 <property name="child">
                   <object class="AdwTabBar" id="tab_bar">
                     <signal name="extra-drag-drop" handler="extra_drag_drop" swapped="no"/>
diff --git a/src/kgx.gresource.xml.in b/src/kgx.gresource.xml.in
index 6994231..be2512d 100644
--- a/src/kgx.gresource.xml.in
+++ b/src/kgx.gresource.xml.in
@@ -5,9 +5,6 @@
     <file compressed="true">kgx-close-dialog.ui</file>
     <file compressed="true">kgx-pages.ui</file>
     <file compressed="true">kgx-tab.ui</file>
-    <file compressed="true">kgx-tab-button.ui</file>
-    <file compressed="true">kgx-tab-switcher.ui</file>
-    <file compressed="true">kgx-tab-switcher-row.ui</file>
     <file compressed="true">kgx-theme-switcher.ui</file>
     <file compressed="true">kgx-simple-tab.ui</file>
     <file compressed="true">style.css</file>
@@ -16,9 +13,6 @@
     <file preprocess="xml-stripblanks">icons/scalable/status/status-privileged-symbolic.svg</file>
     <file preprocess="xml-stripblanks">icons/scalable/status/status-regular-symbolic.svg</file>
     <file preprocess="xml-stripblanks">icons/scalable/status/status-remote-symbolic.svg</file>
-    <file preprocess="xml-stripblanks">icons/scalable/status/tab-counter-symbolic.svg</file>
-    <file preprocess="xml-stripblanks">icons/scalable/status/tab-overflow-symbolic.svg</file>
-    <file preprocess="xml-stripblanks">icons/scalable/status/tab-switcher-collapse-symbolic.svg</file>
     <file preprocess="xml-stripblanks">icons/scalable/status/theme-check-symbolic.svg</file>
   </gresource>
   <gresource prefix="@KGX_APPLICATION_PATH_RAW@gtk">
diff --git a/src/meson.build b/src/meson.build
index c5fabce..9e9d5bc 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -7,12 +7,6 @@ kgx_sources = [
   'kgx-terminal.h',
   'kgx-tab.c',
   'kgx-tab.h',
-  'kgx-tab-button.c',
-  'kgx-tab-button.h',
-  'kgx-tab-switcher.c',
-  'kgx-tab-switcher.h',
-  'kgx-tab-switcher-row.c',
-  'kgx-tab-switcher-row.h',
   'kgx-theme-switcher.c',
   'kgx-theme-switcher.h',
   'kgx-simple-tab.c',
diff --git a/src/style.css b/src/style.css
index debdd16..5082f33 100644
--- a/src/style.css
+++ b/src/style.css
@@ -4,31 +4,27 @@
 @define-color remote_headerbar_bg_color       shade(@purple_1, 1.27);
 @define-color remote_headerbar_backdrop_color shade(@purple_1, 1.35);
 
-.terminal-window {
-  background: transparent;
-}
-
-.terminal-window.root headerbar,
-.terminal-window.root searchbar > revealer > box,
-.terminal-window.root tabbar > revealer > box {
+.terminal-window.root .main-box headerbar,
+.terminal-window.root .main-box searchbar > revealer > box,
+.terminal-window.root .main-box tabbar > revealer > box {
   background-color: @root_headerbar_bg_color;
 }
 
-.terminal-window.root:backdrop headerbar,
-.terminal-window.root:backdrop searchbar > revealer > box,
-.terminal-window.root:backdrop tabbar > revealer > box {
+.terminal-window.root:backdrop .main-box headerbar,
+.terminal-window.root:backdrop .main-box searchbar > revealer > box,
+.terminal-window.root:backdrop .main-box tabbar > revealer > box {
   background-color: @root_headerbar_backdrop_color;
 }
 
-.terminal-window.remote headerbar,
-.terminal-window.remote searchbar > revealer > box,
-.terminal-window.remote tabbar > revealer > box {
+.terminal-window.remote .main-box  headerbar,
+.terminal-window.remote .main-box searchbar > revealer > box,
+.terminal-window.remote .main-box tabbar > revealer > box {
   background-color: @remote_headerbar_bg_color;
 }
 
-.terminal-window.remote:backdrop headerbar,
-.terminal-window.remote:backdrop searchbar > revealer > box,
-.terminal-window.remote:backdrop tabbar > revealer > box {
+.terminal-window.remote:backdrop .main-box headerbar,
+.terminal-window.remote:backdrop .main-box searchbar > revealer > box,
+.terminal-window.remote:backdrop .main-box tabbar > revealer > box {
   background-color: @remote_headerbar_backdrop_color;
 }
 
@@ -98,60 +94,6 @@ window:not(.tiled)
   font-family: monospace;
 }
 
-.tab-button label {
-  font-weight: 800;
-  font-size: 8pt;
-}
-
-.tab-button label.small {
-  font-size: 6pt;
-}
-
-.tab-switcher {
-  min-height: 180px;
-}
-
-.tab-switcher list {
-  padding-top: 48px;
-  padding-bottom: 84px;
-  background-color: @popover_bg_color;
-  color: @popover_fg_color;
-}
-
-.tab-switcher list row {
-  min-height: 40px;
-  padding: 3px;
-}
-
-.tab-switcher list row:dir(ltr) { padding-left: 11px; }
-.tab-switcher list row:dir(rtl) { padding-right: 11px; }
-
-.tab-switcher list row.needs-attention {
-  color: @accent_color;
-}
-
-.tab-switcher list row .close-btn,
-.tab-switcher list row .indicator-btn {
-  min-width: 36px;
-  min-height: 36px;
-  border-radius: 99px;
-  padding: 0;
-}
-
-.tab-switcher .collapse-button {
-  border-radius: 99px;
-  padding: 6px 30px;
-  margin: 6px;
-}
-
-.tab-switcher .new-tab-button {
-  min-width: 48px;
-  min-height: 48px;
-  border-radius: 100%;
-  padding: 0;
-  margin: 18px;
-}
-
 themeswitcher {
   padding: 6px;
 }


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