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




commit 0da2c6d8ee99688b56bf06c419afc1f9c3cc9a69
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-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 +--
 19 files changed, 60 insertions(+), 1982 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-window.c b/src/kgx-window.c
index 9c63bb2..380b222 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,14 +288,6 @@ static void new_tab_activated (GSimpleAction *action,
                                gpointer       data);
 
 
-static void
-new_tab_cb (KgxTabSwitcher *switcher,
-            KgxWindow      *self)
-{
-  new_tab_activated (NULL, NULL, self);
-}
-
-
 static void
 kgx_window_class_init (KgxWindowClass *klass)
 {
@@ -336,7 +326,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 +336,6 @@ 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);
 }
 
 
@@ -451,7 +440,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 +522,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 +563,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..c74b72e 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="new-tab-action-name">win.new-tab</property>
+        <property name="enable-new-tab">True</property>
         <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]