[simple-scan/wip/cdavis/consistency-updates: 5/14] app-window: Use rounded bottom corners
- From: Bartosz <bkosiorek src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [simple-scan/wip/cdavis/consistency-updates: 5/14] app-window: Use rounded bottom corners
- Date: Fri, 12 Feb 2021 11:52:51 +0000 (UTC)
commit b69b77da1bffbd22b50c4af223d0d7f35525be3a
Author: Christopher Davis <brainblasted disroot org>
Date: Wed Feb 10 09:40:59 2021 -0800
app-window: Use rounded bottom corners
For GNOME 40 we want apps to have rounded bottom corners.
In GTK3, we can do this by using HdyApplicationWindow
and HdyHeaderBar.
data/ui/app-window.ui | 338 +++++++++++++++++++++++++-------------------------
meson.build | 1 +
src/app-window.vala | 4 +-
src/meson.build | 2 +-
src/simple-scan.vala | 2 +
5 files changed, 172 insertions(+), 175 deletions(-)
---
diff --git a/data/ui/app-window.ui b/data/ui/app-window.ui
index 540c6bcb..fbedef5a 100644
--- a/data/ui/app-window.ui
+++ b/data/ui/app-window.ui
@@ -491,240 +491,239 @@
</object>
</child>
</object>
- <template class="AppWindow" parent="GtkApplicationWindow">
+ <template class="AppWindow" parent="HdyApplicationWindow">
<property name="width_request">320</property>
<property name="height_request">480</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes" comments="Title of scan window">Document Scanner</property>
<property name="icon_name">org.gnome.SimpleScan</property>
<signal name="delete-event" handler="window_delete_event_cb" swapped="no"/>
- <child type="titlebar">
- <object class="GtkHeaderBar" id="header_bar">
+ <child>
+ <object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="vexpand">True</property>
- <property name="show_close_button">True</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkBox" id="open_box">
+ <object class="HdyHeaderBar" id="header_bar">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="valign">center</property>
+ <property name="show_close_button">True</property>
<child>
- <object class="GtkButton" id="stop_button">
+ <object class="GtkBox" id="open_box">
+ <property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes" comments="Tooltip for stop button">Stop the
current scan</property>
- <property name="use_underline">True</property>
- <signal name="clicked" handler="stop_scan_button_clicked_cb" swapped="no"/>
+ <property name="valign">center</property>
<child>
- <object class="GtkBox">
+ <object class="GtkButton" id="stop_button">
+ <property name="can_focus">False</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes" comments="Tooltip for stop button">Stop
the current scan</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="stop_scan_button_clicked_cb" swapped="no"/>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkSpinner" id="stop_button_spinner">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="active">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">S_top</property>
+ <property name="use_underline">True</property>
+ <property name="width_chars">6</property>
+ <property name="xalign">0.33</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <style>
+ <class name="text-button"/>
+ <class name="destructive-action"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="scan_button">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes" comments="Tooltip for scan toolbar
button">Scan a single page from the scanner</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="scan_button_clicked_cb" swapped="no"/>
<child>
- <object class="GtkSpinner" id="stop_button_spinner">
+ <object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="active">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkImage" id="scan_options_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">scanner-symbolic</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_right">1</property>
+ <property name="label" translatable="yes">_Scan</property>
+ <property name="use_underline">True</property>
+ <property name="width_chars">6</property>
+ <property name="xalign">0.33</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
+ <style>
+ <class name="text-button"/>
+ <class name="suggested-action"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkMenuButton">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">False</property>
+ <property name="popover">scan_options_popover</property>
<child>
- <object class="GtkLabel">
+ <object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">S_top</property>
- <property name="use_underline">True</property>
- <property name="width_chars">6</property>
- <property name="xalign">0.33</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkImage" id="scan_hint_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">x-office-document-symbolic</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">pan-down-symbolic</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
</child>
<style>
- <class name="text-button"/>
- <class name="destructive-action"/>
+ <class name="linked"/>
</style>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
- <object class="GtkButton" id="scan_button">
+ <object class="GtkMenuButton" id="menu_button">
<property name="visible">True</property>
- <property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes" comments="Tooltip for scan toolbar
button">Scan a single page from the scanner</property>
<property name="use_underline">True</property>
- <signal name="clicked" handler="scan_button_clicked_cb" swapped="no"/>
+ <accelerator key="F10" signal="activate"/>
<child>
- <object class="GtkBox">
+ <object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkImage" id="scan_options_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">scanner-symbolic</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_right">1</property>
- <property name="label" translatable="yes">_Scan</property>
- <property name="use_underline">True</property>
- <property name="width_chars">6</property>
- <property name="xalign">0.33</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="icon_name">open-menu-symbolic</property>
+ <property name="icon_size">1</property>
</object>
</child>
<style>
- <class name="text-button"/>
- <class name="suggested-action"/>
+ <class name="image-button"/>
</style>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
+ <property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
- <object class="GtkMenuButton">
+ <object class="GtkButton" id="save_button">
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
- <property name="popover">scan_options_popover</property>
+ <property name="tooltip_text" translatable="yes" comments="Tooltip for save toolbar
button">Save document to a file</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="save_file_button_clicked_cb" swapped="no"/>
<child>
- <object class="GtkBox">
+ <object class="GtkImage" id="save_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkImage" id="scan_hint_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">x-office-document-symbolic</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">pan-down-symbolic</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="icon_name">document-save-symbolic</property>
+ <property name="icon_size">1</property>
</object>
</child>
+ <style>
+ <class name="image-button"/>
+ </style>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
+ <property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
<style>
- <class name="linked"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkMenuButton" id="menu_button">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <accelerator key="F10" signal="activate"/>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">open-menu-symbolic</property>
- <property name="icon_size">1</property>
- </object>
- </child>
- <style>
- <class name="image-button"/>
+ <class name="titlebar"/>
</style>
</object>
- <packing>
- <property name="pack_type">end</property>
- <property name="position">1</property>
- </packing>
</child>
- <child>
- <object class="GtkButton" id="save_button">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">False</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes" comments="Tooltip for save toolbar button">Save
document to a file</property>
- <property name="use_underline">True</property>
- <signal name="clicked" handler="save_file_button_clicked_cb" swapped="no"/>
- <child>
- <object class="GtkImage" id="save_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">document-save-symbolic</property>
- <property name="icon_size">1</property>
- </object>
- </child>
- <style>
- <class name="image-button"/>
- </style>
- </object>
- <packing>
- <property name="pack_type">end</property>
- <property name="position">2</property>
- </packing>
- </child>
- <style>
- <class name="titlebar"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
<child>
<object class="GtkStack" id="stack">
<property name="visible">True</property>
@@ -868,11 +867,6 @@
</packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
</object>
</child>
diff --git a/meson.build b/meson.build
index 2024075f..8543cbda 100644
--- a/meson.build
+++ b/meson.build
@@ -23,6 +23,7 @@ glib_dep = dependency ('glib-2.0', version: '>= 2.38')
gtk_dep = dependency ('gtk+-3.0', version: '>=3.22')
gmodule_dep = dependency ('gmodule-export-2.0')
gthread_dep = dependency ('gthread-2.0')
+libhandy_dep = dependency ('libhandy-1', version: '>=1.0.0')
zlib_dep = dependency ('zlib')
cairo_dep = dependency ('cairo')
gdk_pixbuf_dep = dependency ('gdk-pixbuf-2.0')
diff --git a/src/app-window.vala b/src/app-window.vala
index 506907b8..f765e864 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -14,7 +14,7 @@ private const int DEFAULT_TEXT_DPI = 150;
private const int DEFAULT_PHOTO_DPI = 300;
[GtkTemplate (ui = "/org/gnome/SimpleScan/ui/app-window.ui")]
-public class AppWindow : Gtk.ApplicationWindow
+public class AppWindow : Hdy.ApplicationWindow
{
private const GLib.ActionEntry[] action_entries =
{
@@ -48,7 +48,7 @@ public class AppWindow : Gtk.ApplicationWindow
private bool user_selected_device;
[GtkChild]
- private Gtk.HeaderBar header_bar;
+ private Hdy.HeaderBar header_bar;
[GtkChild]
private Gtk.Menu page_menu;
[GtkChild]
diff --git a/src/meson.build b/src/meson.build
index a2c5adea..3f699ebc 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,5 +1,5 @@
vala_args = [ '--pkg=posix', '--vapidir=' + meson.current_source_dir () ]
-dependencies = [ glib_dep, gtk_dep, zlib_dep, cairo_dep, gdk_pixbuf_dep, gusb_dep, sane_dep ]
+dependencies = [ glib_dep, gtk_dep, libhandy_dep, zlib_dep, cairo_dep, gdk_pixbuf_dep, gusb_dep, sane_dep ]
if colord_dep.found ()
vala_args += [ '-D', 'HAVE_COLORD' ]
dependencies += colord_dep
diff --git a/src/simple-scan.vala b/src/simple-scan.vala
index 84d8a8c1..c15a5418 100644
--- a/src/simple-scan.vala
+++ b/src/simple-scan.vala
@@ -50,6 +50,8 @@ public class SimpleScan : Gtk.Application
{
base.startup ();
+ Hdy.init ();
+
app = new AppWindow ();
book = app.book;
app.start_scan.connect (scan_cb);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]