[gnome-software: 1/2] shell: Use HdyApplicationWindow
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 1/2] shell: Use HdyApplicationWindow
- Date: Tue, 20 Apr 2021 13:35:44 +0000 (UTC)
commit cf9e7a6d6b3fe1172a18dc2cb93b3488ec6af8af
Author: Adrien Plazas <kekun plazas laposte net>
Date: Tue Apr 20 11:51:15 2021 +0200
shell: Use HdyApplicationWindow
This gives the window rounded corners and gives us more flexibility in
the future. This also drops the now unneeded HdyTitleBar.
Fixes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1130
src/gs-shell.c | 8 ++++----
src/gs-shell.h | 3 ++-
src/gs-shell.ui | 18 ++++++------------
3 files changed, 12 insertions(+), 17 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 356b66145..e1308a003 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -60,7 +60,7 @@ typedef struct {
struct _GsShell
{
- GtkApplicationWindow parent_object;
+ HdyApplicationWindow parent_object;
GSettings *settings;
GCancellable *cancellable;
@@ -107,7 +107,7 @@ struct _GsShell
GsPage *pages[GS_SHELL_MODE_LAST];
};
-G_DEFINE_TYPE (GsShell, gs_shell, GTK_TYPE_APPLICATION_WINDOW)
+G_DEFINE_TYPE (GsShell, gs_shell, HDY_TYPE_APPLICATION_WINDOW)
enum {
SIGNAL_LOADED,
@@ -168,7 +168,7 @@ gs_shell_set_header_start_widget (GsShell *shell, GtkWidget *widget)
if (widget != NULL) {
g_object_ref (widget);
- gtk_header_bar_pack_start (GTK_HEADER_BAR (shell->main_header), widget);
+ hdy_header_bar_pack_start (HDY_HEADER_BAR (shell->main_header), widget);
}
shell->header_start_widget = widget;
@@ -191,7 +191,7 @@ gs_shell_set_header_end_widget (GsShell *shell, GtkWidget *widget)
if (widget != NULL) {
g_object_ref (widget);
- gtk_header_bar_pack_end (GTK_HEADER_BAR (shell->main_header), widget);
+ hdy_header_bar_pack_end (HDY_HEADER_BAR (shell->main_header), widget);
}
shell->header_end_widget = widget;
diff --git a/src/gs-shell.h b/src/gs-shell.h
index dcaf63588..4fed18bd4 100644
--- a/src/gs-shell.h
+++ b/src/gs-shell.h
@@ -10,6 +10,7 @@
#pragma once
#include <gtk/gtk.h>
+#include <handy.h>
#include "gnome-software-private.h"
@@ -17,7 +18,7 @@ G_BEGIN_DECLS
#define GS_TYPE_SHELL (gs_shell_get_type ())
-G_DECLARE_FINAL_TYPE (GsShell, gs_shell, GS, SHELL, GtkApplicationWindow)
+G_DECLARE_FINAL_TYPE (GsShell, gs_shell, GS, SHELL, HdyApplicationWindow)
typedef enum {
GS_SHELL_MODE_UNKNOWN,
diff --git a/src/gs-shell.ui b/src/gs-shell.ui
index 7d0053e50..ac4bc6dd3 100644
--- a/src/gs-shell.ui
+++ b/src/gs-shell.ui
@@ -14,7 +14,7 @@
</item>
</menu>
- <template class="GsShell" parent="GtkApplicationWindow">
+ <template class="GsShell" parent="HdyApplicationWindow">
<property name="visible">False</property>
<property name="default-width">1200</property>
<property name="default-height">800</property>
@@ -27,10 +27,10 @@
<signal name="key-press-event" handler="window_keypress_handler"/>
<signal name="button-press-event" handler="window_button_press_event" after="yes"/>
- <child type="titlebar">
- <object class="HdyTitleBar">
+ <child>
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="orientation">vertical</property>
<child>
<object class="HdyLeaflet" id="header_leaflet">
<property name="visible">True</property>
@@ -41,7 +41,7 @@
<property name="child-transition-duration" bind-source="main_leaflet"
bind-property="child-transition-duration" bind-flags="bidirectional|sync-create"/>
<property name="transition-type" bind-source="main_leaflet" bind-property="transition-type"
bind-flags="bidirectional|sync-create"/>
<child>
- <object class="GtkHeaderBar" id="sidebar_header">
+ <object class="HdyHeaderBar" id="sidebar_header">
<property name="visible" bind-source="sidebar_box" bind-property="visible"
bind-flags="sync-create|bidirectional" />
<property name="can-focus">False</property>
<property name="show-close-button">True</property>
@@ -117,7 +117,7 @@
</packing>
</child>
<child>
- <object class="GtkHeaderBar" id="main_header">
+ <object class="HdyHeaderBar" id="main_header">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
@@ -213,13 +213,7 @@
</child>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
<child>
<object class="GtkOverlay" id="overlay">
<property name="visible">True</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]