[nautilus/wip/cdavis/hdywindow: 2/2] Use HdyApplicationWindow and HdyHeaderBar




commit 2dffc636039ec2d2ef42c304fca547caa6d3ab3b
Author: Christopher Davis <brainblasted disroot org>
Date:   Thu Feb 4 01:32:44 2021 -0800

    Use HdyApplicationWindow and HdyHeaderBar
    
    Brings us rounded corners and ends the separation between
    titlebar and content.

 meson.build                          |  1 +
 src/meson.build                      |  1 +
 src/nautilus-application.c           |  3 +++
 src/nautilus-toolbar.c               |  2 +-
 src/nautilus-toolbar.h               |  3 ++-
 src/nautilus-window.c                |  5 +++--
 src/nautilus-window.h                |  3 ++-
 src/resources/ui/nautilus-toolbar.ui |  2 +-
 src/resources/ui/nautilus-window.ui  | 11 ++++++-----
 9 files changed, 20 insertions(+), 11 deletions(-)
---
diff --git a/meson.build b/meson.build
index 3d9aaa340..3ceac6924 100644
--- a/meson.build
+++ b/meson.build
@@ -120,6 +120,7 @@ gmodule = dependency('gmodule-no-export-2.0', version: glib_ver)
 gnome_autoar = dependency('gnome-autoar-0', version: '>= 0.2.1')
 gnome_desktop = dependency('gnome-desktop-3.0', version: '>= 3.0.0')
 gtk = dependency('gtk+-3.0', version: '>= 3.22.27')
+libhandy = dependency('libhandy-1', version: '>= 1.0.0')
 libportal = []
 if get_option('libportal')
   libportal = dependency('libportal', version: '>= 0.3')
diff --git a/src/meson.build b/src/meson.build
index a1b9bdbd2..0672359a5 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -283,6 +283,7 @@ nautilus_deps = [
   gnome_autoar,
   gnome_desktop,
   libgd_dep,
+  libhandy,
   libportal,
   nautilus_extension,
   selinux,
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 7842a582a..73153f548 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -34,6 +34,7 @@
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
 #include <gtk/gtk.h>
+#include <libhandy-1/handy.h>
 #include <nautilus-extension.h>
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -1326,6 +1327,8 @@ nautilus_application_startup_common (NautilusApplication *self)
      */
     G_APPLICATION_CLASS (nautilus_application_parent_class)->startup (G_APPLICATION (self));
 
+    hdy_init ();
+
     gtk_window_set_default_icon_name (APPLICATION_ID);
 
     setup_theme_extensions ();
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 89ebac72f..31b67bb2f 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -128,7 +128,7 @@ enum
 
 static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
 
-G_DEFINE_TYPE (NautilusToolbar, nautilus_toolbar, GTK_TYPE_HEADER_BAR);
+G_DEFINE_TYPE (NautilusToolbar, nautilus_toolbar, HDY_TYPE_HEADER_BAR);
 
 static void nautilus_toolbar_set_window_slot_real (NautilusToolbar    *self,
                                                    NautilusWindowSlot *slot);
diff --git a/src/nautilus-toolbar.h b/src/nautilus-toolbar.h
index 13f00721e..364bc76d8 100644
--- a/src/nautilus-toolbar.h
+++ b/src/nautilus-toolbar.h
@@ -24,6 +24,7 @@
 #pragma once
 
 #include <gtk/gtk.h>
+#include <libhandy-1/handy.h>
 
 #include "nautilus-window-slot.h"
 
@@ -31,7 +32,7 @@ G_BEGIN_DECLS
 
 #define NAUTILUS_TYPE_TOOLBAR nautilus_toolbar_get_type()
 
-G_DECLARE_FINAL_TYPE (NautilusToolbar, nautilus_toolbar, NAUTILUS, TOOLBAR, GtkHeaderBar)
+G_DECLARE_FINAL_TYPE (NautilusToolbar, nautilus_toolbar, NAUTILUS, TOOLBAR, HdyHeaderBar)
 
 GtkWidget *nautilus_toolbar_new (void);
 
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 4be36ebbf..b13d989f7 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -33,6 +33,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
+#include <libhandy-1/handy.h>
 #include <math.h>
 #include <sys/time.h>
 
@@ -98,7 +99,7 @@ static void close_slot (NautilusWindow     *window,
 
 struct _NautilusWindow
 {
-    GtkApplicationWindow parent_instance;
+    HdyApplicationWindow parent_instance;
 
     GtkWidget *notebook;
 
@@ -164,7 +165,7 @@ enum
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-G_DEFINE_TYPE (NautilusWindow, nautilus_window, GTK_TYPE_APPLICATION_WINDOW);
+G_DEFINE_TYPE (NautilusWindow, nautilus_window, HDY_TYPE_APPLICATION_WINDOW);
 
 static const struct
 {
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index ac8833a20..27ebbb247 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -27,13 +27,14 @@
 #pragma once
 
 #include <gtk/gtk.h>
+#include <libhandy-1/handy.h>
 
 #include "nautilus-types.h"
 
 G_BEGIN_DECLS
 
 #define NAUTILUS_TYPE_WINDOW (nautilus_window_get_type ())
-G_DECLARE_FINAL_TYPE (NautilusWindow, nautilus_window, NAUTILUS, WINDOW, GtkApplicationWindow);
+G_DECLARE_FINAL_TYPE (NautilusWindow, nautilus_window, NAUTILUS, WINDOW, HdyApplicationWindow);
 
 typedef gboolean (* NautilusWindowGoToCallback) (NautilusWindow *window,
                                                  GFile *location,
diff --git a/src/resources/ui/nautilus-toolbar.ui b/src/resources/ui/nautilus-toolbar.ui
index 51a882838..4bf6e3621 100644
--- a/src/resources/ui/nautilus-toolbar.ui
+++ b/src/resources/ui/nautilus-toolbar.ui
@@ -477,7 +477,7 @@
       </object>
     </child>
   </object>
-  <template class="NautilusToolbar" parent="GtkHeaderBar">
+  <template class="NautilusToolbar" parent="HdyHeaderBar">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="show_close_button">True</property>
diff --git a/src/resources/ui/nautilus-window.ui b/src/resources/ui/nautilus-window.ui
index 8ce69c64f..e554696ca 100644
--- a/src/resources/ui/nautilus-window.ui
+++ b/src/resources/ui/nautilus-window.ui
@@ -1,14 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <template class="NautilusWindow" parent="GtkApplicationWindow">
+  <template class="NautilusWindow" parent="HdyApplicationWindow">
     <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">
+      <object class="GtkBox">
         <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="NautilusToolbar" id="toolbar"/>
+        </child>
         <child>
           <object class="GtkPaned" id="content_paned">
             <property name="visible">True</property>


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