[gnome-boxes/wip/exalm/libhandy1: 6/6] collection-toolbar: Use HdyViewSwitcher
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/wip/exalm/libhandy1: 6/6] collection-toolbar: Use HdyViewSwitcher
- Date: Tue, 26 May 2020 15:54:06 +0000 (UTC)
commit 697e466b4e17bce5f59b1e2a87f47ce16ab7a33f
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Tue May 26 20:25:35 2020 +0500
collection-toolbar: Use HdyViewSwitcher
See https://gitlab.gnome.org/GNOME/Initiatives/-/issues/16
data/ui/app-window.ui | 1 +
data/ui/collection-toolbar.ui | 2 +-
src/app-window.vala | 3 +++
src/collection-toolbar.vala | 9 +++++----
4 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/data/ui/app-window.ui b/data/ui/app-window.ui
index 4f4002a7..cabccf28 100644
--- a/data/ui/app-window.ui
+++ b/data/ui/app-window.ui
@@ -117,6 +117,7 @@
</object>
<packing>
<property name="title" translatable="yes" comments="Translators: this is a switch to
show only favorite boxes in main view.">Favorites</property>
+ <property name="icon-name">starred-symbolic</property>
<property name="name">favorites-view</property>
</packing>
</child>
diff --git a/data/ui/collection-toolbar.ui b/data/ui/collection-toolbar.ui
index c77b7537..69d038b4 100644
--- a/data/ui/collection-toolbar.ui
+++ b/data/ui/collection-toolbar.ui
@@ -9,7 +9,7 @@
</style>
<child type="title">
- <object class="GtkStackSwitcher" id="stack_switcher">
+ <object class="HdyViewSwitcher" id="view_switcher">
<property name="visible">True</property>
</object>
</child>
diff --git a/src/app-window.vala b/src/app-window.vala
index 327c2624..d03863b4 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -168,6 +168,9 @@ public AppWindow (Gtk.Application app) {
if (app.application_id == "org.gnome.BoxesDevel") {
get_style_context ().add_class ("devel");
}
+
+ var icon_name = Config.APPLICATION_ID + "-symbolic";
+ collection_stack.child_set (all_view, "icon-name", icon_name);
}
public void setup_ui () {
diff --git a/src/collection-toolbar.vala b/src/collection-toolbar.vala
index 1502921f..ca0f5646 100644
--- a/src/collection-toolbar.vala
+++ b/src/collection-toolbar.vala
@@ -1,8 +1,9 @@
// This file is part of GNOME Boxes. License: LGPLv2+
using Gtk;
+using Hdy;
[GtkTemplate (ui = "/org/gnome/Boxes/ui/collection-toolbar.ui")]
-private class Boxes.CollectionToolbar: HeaderBar {
+private class Boxes.CollectionToolbar: Gtk.HeaderBar {
[GtkChild]
private Button search_btn;
[GtkChild]
@@ -20,7 +21,7 @@
[GtkChild]
public MenuButton hamburger_btn;
[GtkChild]
- private StackSwitcher stack_switcher;
+ private ViewSwitcher view_switcher;
private AppWindow window;
@@ -43,7 +44,7 @@ public void setup_ui (AppWindow window) {
window.notify["ui-state"].connect (ui_state_changed);
App.app.notify["main-window"].connect (ui_state_changed);
- stack_switcher.stack = window.collection_stack;
+ view_switcher.stack = window.collection_stack;
var builder = new Builder.from_resource ("/org/gnome/Boxes/ui/menus.ui");
MenuModel menu = (MenuModel) builder.get_object ("app-menu");
@@ -114,7 +115,7 @@ private void ui_state_changed () {
new_btn.show ();
grid_btn.visible = window.view_type != AppWindow.ViewType.ICON;
list_btn.visible = window.view_type != AppWindow.ViewType.LIST;
- custom_title = stack_switcher;
+ custom_title = view_switcher;
break;
case UIState.CREDS:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]