[nautilus/wip/cdavis/hdywindow: 1/2] window: Init toolbar from template




commit a6593e57c3413d4ceb3dd04fb61dc74c81f309a8
Author: Christopher Davis <brainblasted disroot org>
Date:   Tue Nov 17 13:43:01 2020 -0800

    window: Init toolbar from template
    
    This will allow us to easily set up HdyWindow,
    as otherwise we'd need to use GtkContainer APIs
    that will be removed in GTK4

 src/nautilus-window.c               | 5 +----
 src/resources/ui/nautilus-window.ui | 3 +++
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 0d8cd8414..4be36ebbf 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1975,8 +1975,6 @@ setup_toolbar (NautilusWindow *window)
                              G_CALLBACK (location_entry_location_changed_callback), window, 0);
     g_signal_connect_object (location_entry, "cancel",
                              G_CALLBACK (location_entry_cancel_callback), window, 0);
-
-    gtk_window_set_titlebar (GTK_WINDOW (window), window->toolbar);
 }
 
 static void
@@ -2776,8 +2774,6 @@ nautilus_window_init (NautilusWindow *window)
     gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (window)),
                                  "nautilus-window");
 
-    window->toolbar = nautilus_toolbar_new ();
-
     window_group = gtk_window_group_new ();
     gtk_window_group_add_window (window_group, GTK_WINDOW (window));
     g_object_unref (window_group);
@@ -2826,6 +2822,7 @@ nautilus_window_class_init (NautilusWindowClass *class)
 
     gtk_widget_class_set_template_from_resource (wclass,
                                                  "/org/gnome/nautilus/ui/nautilus-window.ui");
+    gtk_widget_class_bind_template_child (wclass, NautilusWindow, toolbar);
     gtk_widget_class_bind_template_child (wclass, NautilusWindow, content_paned);
     gtk_widget_class_bind_template_child (wclass, NautilusWindow, sidebar);
     gtk_widget_class_bind_template_child (wclass, NautilusWindow, places_sidebar);
diff --git a/src/resources/ui/nautilus-window.ui b/src/resources/ui/nautilus-window.ui
index 4eef37c11..8ce69c64f 100644
--- a/src/resources/ui/nautilus-window.ui
+++ b/src/resources/ui/nautilus-window.ui
@@ -3,6 +3,9 @@
   <template class="NautilusWindow" parent="GtkApplicationWindow">
     <property name="show-menubar">False</property>
     <property name="title" translatable="yes">_Files</property>
+    <child type="titlebar">
+      <object class="NautilusToolbar" id="toolbar"/>
+    </child>
     <child>
       <object class="GtkGrid">
         <property name="visible">True</property>


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