[libadwaita/wip/exalm/tab-overview: 807/807] Demo




commit 9d6a3580fa30589680e59859373c525e193c8fb1
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Aug 12 03:15:10 2022 +0400

    Demo

 demo/pages/tab-view/adw-tab-view-demo-window.c  | 23 +++++---
 demo/pages/tab-view/adw-tab-view-demo-window.ui | 70 +++++++++++++++----------
 2 files changed, 58 insertions(+), 35 deletions(-)
---
diff --git a/demo/pages/tab-view/adw-tab-view-demo-window.c b/demo/pages/tab-view/adw-tab-view-demo-window.c
index adc4eef2..e1b10dec 100644
--- a/demo/pages/tab-view/adw-tab-view-demo-window.c
+++ b/demo/pages/tab-view/adw-tab-view-demo-window.c
@@ -7,6 +7,7 @@ struct _AdwTabViewDemoWindow
   AdwWindow parent_instance;
   AdwTabView *view;
   AdwTabBar *tab_bar;
+  AdwTabOverview *tab_overview;
 
   GActionMap *tab_action_group;
 
@@ -75,20 +76,26 @@ add_page (AdwTabViewDemoWindow *self,
           GIcon                *icon)
 {
   GtkWidget *content;
+  GtkWidget *entry;
   AdwTabPage *page;
 
-  content = g_object_new (GTK_TYPE_ENTRY,
-                          "text", title,
-                          "halign", GTK_ALIGN_CENTER,
-                          "valign", GTK_ALIGN_CENTER,
+  entry = g_object_new (GTK_TYPE_ENTRY,
+                        "text", title,
+                        "halign", GTK_ALIGN_CENTER,
+                        "valign", GTK_ALIGN_CENTER,
+                        NULL);
+
+  content = g_object_new (ADW_TYPE_BIN,
+                          "child", entry,
                           NULL);
+  gtk_widget_add_css_class (content, "background");
 
   page = adw_tab_view_add_page (self->view, GTK_WIDGET (content), parent);
 
-  g_object_bind_property (content, "text",
+  g_object_bind_property (entry, "text",
                           page, "title",
                           G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
-  g_object_bind_property_full (content, "text",
+  g_object_bind_property_full (entry, "text",
                                page, "tooltip",
                                G_BINDING_SYNC_CREATE,
                                text_to_tooltip, NULL,
@@ -516,6 +523,7 @@ adw_tab_view_demo_window_class_init (AdwTabViewDemoWindowClass *klass)
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/Adwaita1/Demo/ui/pages/tab-view/adw-tab-view-demo-window.ui");
   gtk_widget_class_bind_template_child (widget_class, AdwTabViewDemoWindow, view);
   gtk_widget_class_bind_template_child (widget_class, AdwTabViewDemoWindow, tab_bar);
+  gtk_widget_class_bind_template_child (widget_class, AdwTabViewDemoWindow, tab_overview);
   gtk_widget_class_bind_template_callback (widget_class, page_detached_cb);
   gtk_widget_class_bind_template_callback (widget_class, setup_menu_cb);
   gtk_widget_class_bind_template_callback (widget_class, create_window_cb);
@@ -556,6 +564,9 @@ adw_tab_view_demo_window_init (AdwTabViewDemoWindow *self)
   adw_tab_bar_setup_extra_drop_target (self->tab_bar,
                                        GDK_ACTION_COPY,
                                        (GType[1]) { G_TYPE_STRING }, 1);
+  adw_tab_overview_setup_extra_drop_target (self->tab_overview,
+                                            GDK_ACTION_COPY,
+                                            (GType[1]) { G_TYPE_STRING }, 1);
 }
 
 AdwTabViewDemoWindow *
diff --git a/demo/pages/tab-view/adw-tab-view-demo-window.ui b/demo/pages/tab-view/adw-tab-view-demo-window.ui
index a53ad72e..598fca92 100644
--- a/demo/pages/tab-view/adw-tab-view-demo-window.ui
+++ b/demo/pages/tab-view/adw-tab-view-demo-window.ui
@@ -7,40 +7,52 @@
     <property name="default-width">800</property>
     <property name="default-height">600</property>
     <property name="content">
-      <object class="GtkBox">
-        <property name="orientation">vertical</property>
-        <child>
-          <object class="GtkHeaderBar">
-            <child type="start">
-              <object class="GtkButton">
-                <property name="action-name">win.tab-new</property>
-                <property name="icon-name">tab-new-symbolic</property>
+      <object class="AdwTabOverview" id="tab_overview">
+        <property name="view">view</property>
+        <signal name="extra-drag-drop" handler="extra_drag_drop_cb" swapped="true"/>
+        <property name="child">
+          <object class="GtkBox">
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkHeaderBar">
+                <child type="start">
+                  <object class="GtkButton">
+                    <property name="action-name">win.tab-new</property>
+                    <property name="icon-name">tab-new-symbolic</property>
+                  </object>
+                </child>
+                <child type="end">
+                  <object class="GtkButton">
+                    <property name="action-name">win.window-new</property>
+                    <property name="icon-name">window-new-symbolic</property>
+                  </object>
+                </child>
+                <child type="end">
+                  <object class="AdwTabButton">
+                    <property name="view">view</property>
+                    <property name="action-name">overview.open</property>
+                  </object>
+                </child>
               </object>
             </child>
-            <child type="end">
-              <object class="GtkButton">
-                <property name="action-name">win.window-new</property>
-                <property name="icon-name">window-new-symbolic</property>
+            <child>
+              <object class="AdwTabBar" id="tab_bar">
+                <property name="view">view</property>
+                <signal name="extra-drag-drop" handler="extra_drag_drop_cb" swapped="true"/>
+              </object>
+            </child>
+            <child>
+              <object class="AdwTabView" id="view">
+                <property name="vexpand">True</property>
+                <property name="menu-model">tab_menu</property>
+                <signal name="page-detached" handler="page_detached_cb" swapped="true"/>
+                <signal name="setup-menu" handler="setup_menu_cb" swapped="true"/>
+                <signal name="create-window" handler="create_window_cb" swapped="true"/>
+                <signal name="indicator-activated" handler="indicator_activated_cb" swapped="true"/>
               </object>
             </child>
           </object>
-        </child>
-        <child>
-          <object class="AdwTabBar" id="tab_bar">
-            <property name="view">view</property>
-            <signal name="extra-drag-drop" handler="extra_drag_drop_cb" swapped="true"/>
-          </object>
-        </child>
-        <child>
-          <object class="AdwTabView" id="view">
-            <property name="vexpand">True</property>
-            <property name="menu-model">tab_menu</property>
-            <signal name="page-detached" handler="page_detached_cb" swapped="true"/>
-            <signal name="setup-menu" handler="setup_menu_cb" swapped="true"/>
-            <signal name="create-window" handler="create_window_cb" swapped="true"/>
-            <signal name="indicator-activated" handler="indicator_activated_cb" swapped="true"/>
-          </object>
-        </child>
+        </property>
       </object>
     </property>
   </template>


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