[baobab/wip/cdavis/hdy-restyle: 2/2] window: Use HdyApplicationWindow and HdyHeaderBar
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab/wip/cdavis/hdy-restyle: 2/2] window: Use HdyApplicationWindow and HdyHeaderBar
- Date: Sun, 27 Dec 2020 07:14:15 +0000 (UTC)
commit ee8d546df688764ebcd5b0ec9daaef0ce6bc9288
Author: Christopher Davis <brainblasted disroot org>
Date: Sat Dec 26 23:13:33 2020 -0800
window: Use HdyApplicationWindow and HdyHeaderBar
Gives us nice bottom rounded corners
data/ui/baobab-main-window.ui | 132 +++++++++++++++++++++---------------------
src/baobab-window.vala | 14 +----
2 files changed, 69 insertions(+), 77 deletions(-)
---
diff --git a/data/ui/baobab-main-window.ui b/data/ui/baobab-main-window.ui
index 62b705f..7e44b40 100644
--- a/data/ui/baobab-main-window.ui
+++ b/data/ui/baobab-main-window.ui
@@ -62,77 +62,79 @@
</object>
</child>
</object>
- <object class="GtkHeaderBar" id="header_bar">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="show_close_button">True</property>
- <style>
- <class name="titlebar"/>
- </style>
- <child>
- <object class="GtkButton" id="back_button">
- <property name="valign">center</property>
- <property name="can_focus">True</property>
- <property name="action_name">win.show-home-page</property>
- <property name="tooltip_text" translatable="yes">Go back to location list</property>
- <style>
- <class name="image-button"/>
- </style>
- <child>
- <object class="GtkImage" id="back_button_image">
- <property name="visible">True</property>
- <property name="icon_name">go-previous-symbolic</property>
- <property name="icon_size">1</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack_type">start</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="reload_button">
- <property name="valign">center</property>
- <property name="can_focus">True</property>
- <property name="action_name">win.reload</property>
- <property name="tooltip_text" translatable="yes">Rescan current location</property>
- <style>
- <class name="image-button"/>
- </style>
- <child>
- <object class="GtkImage" id="reload_button_image">
- <property name="visible">True</property>
- <property name="icon_size">1</property>
- <property name="icon_name">view-refresh-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
- <child>
- <object class="GtkMenuButton" id="menu_button">
- <property name="valign">center</property>
- <property name="menu_model">primarymenu</property>
- <property name="action_name">win.show-primary-menu</property>
- <property name="direction">none</property>
- <style>
- <class name="image-button"/>
- </style>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
- </object>
- <template class="BaobabWindow" parent="GtkApplicationWindow">
+ <template class="BaobabWindow" parent="HdyApplicationWindow">
<property name="title" translatable="yes">Disk Usage Analyzer</property>
<property name="icon_name">baobab</property>
<child>
<object class="GtkBox" id="vbox">
<property name="orientation">vertical</property>
<property name="visible">True</property>
+ <child>
+ <object class="HdyHeaderBar" id="header_bar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="show_close_button">True</property>
+ <style>
+ <class name="titlebar"/>
+ </style>
+ <child>
+ <object class="GtkButton" id="back_button">
+ <property name="valign">center</property>
+ <property name="can_focus">True</property>
+ <property name="action_name">win.show-home-page</property>
+ <property name="tooltip_text" translatable="yes">Go back to location list</property>
+ <style>
+ <class name="image-button"/>
+ </style>
+ <child>
+ <object class="GtkImage" id="back_button_image">
+ <property name="visible">True</property>
+ <property name="icon_name">go-previous-symbolic</property>
+ <property name="icon_size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack_type">start</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="reload_button">
+ <property name="valign">center</property>
+ <property name="can_focus">True</property>
+ <property name="action_name">win.reload</property>
+ <property name="tooltip_text" translatable="yes">Rescan current location</property>
+ <style>
+ <class name="image-button"/>
+ </style>
+ <child>
+ <object class="GtkImage" id="reload_button_image">
+ <property name="visible">True</property>
+ <property name="icon_size">1</property>
+ <property name="icon_name">view-refresh-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkMenuButton" id="menu_button">
+ <property name="valign">center</property>
+ <property name="menu_model">primarymenu</property>
+ <property name="action_name">win.show-primary-menu</property>
+ <property name="direction">none</property>
+ <style>
+ <class name="image-button"/>
+ </style>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
+ </object>
+ </child>
<child>
<object class="GtkGrid" id="window_contents">
<property name="visible">True</property>
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index c1e733a..265fbec 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -23,11 +23,11 @@
namespace Baobab {
[GtkTemplate (ui = "/org/gnome/baobab/ui/baobab-main-window.ui")]
- public class Window : Gtk.ApplicationWindow {
+ public class Window : Hdy.ApplicationWindow {
[GtkChild]
private Gtk.Box vbox;
[GtkChild]
- private Gtk.HeaderBar header_bar;
+ private Hdy.HeaderBar header_bar;
[GtkChild]
private Pathbar pathbar;
[GtkChild]
@@ -176,16 +176,6 @@ namespace Baobab {
ui_settings.apply ();
});
- var desktop = Environment.get_variable ("XDG_CURRENT_DESKTOP");
-
- if (desktop == null || !desktop.contains ("Unity")) {
- this.set_titlebar (header_bar);
- } else {
- header_bar.show_close_button = false;
- header_bar.get_style_context ().remove_class ("titlebar");
- vbox.pack_start (header_bar, false, false, 0);
- }
-
set_ui_state (home_page, false);
button_press_event.connect ((event) => {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]