[gnome-logs/wip/cdavis/40-consistency-update: 3/4] window, eventtoolbar, application: Use HdyApplicationWindow and HdyHeaderBar




commit 915d2794a0f9ddd8bace00c052f75a4f12e63c39
Author: Christopher Davis <brainblasted disroot org>
Date:   Wed Feb 10 20:37:27 2021 -0800

    window, eventtoolbar, application: Use HdyApplicationWindow and HdyHeaderBar
    
    Gives us bottom rounded corners.

 data/gl-eventtoolbar.ui |  4 ++--
 data/gl-window.ui       | 10 +++++-----
 meson.build             |  1 +
 src/gl-application.c    |  4 ++++
 src/gl-eventtoolbar.c   |  4 ++--
 src/gl-eventtoolbar.h   |  3 ++-
 src/gl-window.c         |  2 +-
 src/gl-window.h         |  3 ++-
 8 files changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/data/gl-eventtoolbar.ui b/data/gl-eventtoolbar.ui
index 0c08623..b48756c 100644
--- a/data/gl-eventtoolbar.ui
+++ b/data/gl-eventtoolbar.ui
@@ -23,8 +23,8 @@
             </item>
         </section>
     </menu>
-    <template class="GlEventToolbar" parent="GtkHeaderBar">
-        <property name="expand">True</property>
+    <template class="GlEventToolbar" parent="HdyHeaderBar">
+        <property name="hexpand">True</property>
         <property name="show-close-button">True</property>
         <property name="visible">True</property>
         <child>
diff --git a/data/gl-window.ui b/data/gl-window.ui
index e20569d..e2e03a6 100644
--- a/data/gl-window.ui
+++ b/data/gl-window.ui
@@ -1,16 +1,16 @@
 <interface domain="gnome-logs">
-    <template class="GlWindow" parent="GtkApplicationWindow">
+    <template class="GlWindow" parent="HdyApplicationWindow">
         <property name="height-request">780</property>
         <property name="width-request">1200</property>
         <signal name="key-press-event" handler="on_gl_window_key_press_event"/>
-        <child type="titlebar">
-            <object class="GlEventToolbar" id="event_toolbar">
-            </object>
-        </child>
         <child>
             <object class="GtkBox" id="event_box">
                 <property name="orientation">vertical</property>
                 <property name="visible">True</property>
+                <child>
+                  <object class="GlEventToolbar" id="event_toolbar">
+                  </object>
+                </child>
                 <child>
                     <object class="GtkInfoBar" id="info_bar">
                         <property name="message-type">GTK_MESSAGE_ERROR</property>
diff --git a/meson.build b/meson.build
index 5fa71f6..cbe9cf0 100644
--- a/meson.build
+++ b/meson.build
@@ -71,6 +71,7 @@ endif
 gl_deps = [
     dependency('gio-unix-2.0', version : '>=2.43.90'),
     dependency('gtk+-3.0', version : '>=3.22.0'),
+    dependency('libhandy-1', version : '>=1.1.0'),
     dependency('libsystemd')
 ]
 
diff --git a/src/gl-application.c b/src/gl-application.c
index 46426b1..8f13a5d 100644
--- a/src/gl-application.c
+++ b/src/gl-application.c
@@ -20,6 +20,7 @@
 #include "gl-application.h"
 
 #include <glib/gi18n.h>
+#include <libhandy-1/handy.h>
 
 #include "gl-categorylist.h"
 #include "gl-eventtoolbar.h"
@@ -199,6 +200,9 @@ gl_application_startup (GApplication *application)
     /* Calls gtk_init() with no arguments. */
     G_APPLICATION_CLASS (gl_application_parent_class)->startup (application);
 
+    /* Initialize libhandy widgets and styling */
+    hdy_init ();
+
     /* gtk_init() calls setlocale(), so gettext must be called after that. */
     g_set_application_name (_(PACKAGE_NAME));
     gtk_window_set_default_icon_name (PACKAGE_TARNAME);
diff --git a/src/gl-eventtoolbar.c b/src/gl-eventtoolbar.c
index 9a8bd5c..cf8b5c8 100644
--- a/src/gl-eventtoolbar.c
+++ b/src/gl-eventtoolbar.c
@@ -40,7 +40,7 @@ typedef struct
     GlEventToolbarMode mode;
 } GlEventToolbarPrivate;
 
-G_DEFINE_TYPE_WITH_PRIVATE (GlEventToolbar, gl_event_toolbar, GTK_TYPE_HEADER_BAR)
+G_DEFINE_TYPE_WITH_PRIVATE (GlEventToolbar, gl_event_toolbar, HDY_TYPE_HEADER_BAR)
 
 static void
 gl_event_toolbar_update_boot_menu_label (GlEventToolbar *toolbar,
@@ -155,7 +155,7 @@ gl_event_toolbar_add_boots (GlEventToolbar *toolbar,
     gtk_grid_attach (GTK_GRID (grid), arrow, 1, 0, 1, 2);
     gtk_widget_show_all (grid);
 
-    gtk_header_bar_set_custom_title (GTK_HEADER_BAR (toolbar),
+    hdy_header_bar_set_custom_title (HDY_HEADER_BAR (toolbar),
                                      priv->menu_button);
 
     g_free (current_boot);
diff --git a/src/gl-eventtoolbar.h b/src/gl-eventtoolbar.h
index 461d274..c397825 100644
--- a/src/gl-eventtoolbar.h
+++ b/src/gl-eventtoolbar.h
@@ -20,6 +20,7 @@
 #define GL_EVENT_TOOLBAR_H_
 
 #include <gtk/gtk.h>
+#include <libhandy-1/handy.h>
 
 G_BEGIN_DECLS
 
@@ -37,7 +38,7 @@ typedef enum
 } GlEventToolbarMode;
 
 #define GL_TYPE_EVENT_TOOLBAR (gl_event_toolbar_get_type ())
-G_DECLARE_FINAL_TYPE (GlEventToolbar, gl_event_toolbar, GL, EVENT_TOOLBAR, GtkHeaderBar)
+G_DECLARE_FINAL_TYPE (GlEventToolbar, gl_event_toolbar, GL, EVENT_TOOLBAR, HdyHeaderBar)
 
 GtkWidget * gl_event_toolbar_new (void);
 void gl_event_toolbar_add_boots (GlEventToolbar *toolbar, GArray *boot_ids);
diff --git a/src/gl-window.c b/src/gl-window.c
index 2ebd758..a81c456 100644
--- a/src/gl-window.c
+++ b/src/gl-window.c
@@ -39,7 +39,7 @@ typedef struct
     GtkWidget *info_bar;
 } GlWindowPrivate;
 
-G_DEFINE_TYPE_WITH_PRIVATE (GlWindow, gl_window, GTK_TYPE_APPLICATION_WINDOW)
+G_DEFINE_TYPE_WITH_PRIVATE (GlWindow, gl_window, HDY_TYPE_APPLICATION_WINDOW)
 
 static const gchar SETTINGS_SCHEMA[] = "org.gnome.Logs";
 static const gchar IGNORE_WARNING[] = "ignore-warning";
diff --git a/src/gl-window.h b/src/gl-window.h
index f8cffda..b088a68 100644
--- a/src/gl-window.h
+++ b/src/gl-window.h
@@ -20,6 +20,7 @@
 #define GL_WINDOW_H_
 
 #include <gtk/gtk.h>
+#include <libhandy-1/handy.h>
 
 #include "gl-application.h"
 #include "gl-journal-model.h"
@@ -27,7 +28,7 @@
 G_BEGIN_DECLS
 
 #define GL_TYPE_WINDOW (gl_window_get_type ())
-G_DECLARE_FINAL_TYPE (GlWindow, gl_window, GL, WINDOW, GtkApplicationWindow)
+G_DECLARE_FINAL_TYPE (GlWindow, gl_window, GL, WINDOW, HdyApplicationWindow)
 
 void gl_window_load_journal (GlWindow *window, GlJournal *journal);
 GtkWidget * gl_window_new (GtkApplication *application);


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