[gnome-boxes] colloection-toolbar: Keep view type over restarts
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] colloection-toolbar: Keep view type over restarts
- Date: Mon, 21 Sep 2015 17:57:19 +0000 (UTC)
commit 6bbdd86eb6c1a04ada2d21ebbbc6ca77c963159b
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Mon Sep 21 18:53:20 2015 +0100
colloection-toolbar: Keep view type over restarts
Let's keep current view saved on disk and restore to last used state on
startup.
data/org.gnome.boxes.gschema.xml.in | 10 ++++++++++
src/collection-toolbar.vala | 4 +++-
2 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/data/org.gnome.boxes.gschema.xml.in b/data/org.gnome.boxes.gschema.xml.in
index ac5adc8..93e7b4a 100644
--- a/data/org.gnome.boxes.gschema.xml.in
+++ b/data/org.gnome.boxes.gschema.xml.in
@@ -1,4 +1,10 @@
<schemalist>
+
+ <enum id="org.gnome.boxes.view-type">
+ <value nick="icon-view" value="1"/>
+ <value nick="list-view" value="2"/>
+ </enum>
+
<schema id="org.gnome.boxes" path="/org/gnome/boxes/" gettext-domain="gnome-boxes">
<key name="collections" type="as">
@@ -17,6 +23,10 @@
<default>5</default>
</key>
+ <key name='view' enum='org.gnome.boxes.view-type'>
+ <default>'icon-view'</default>
+ </key>
+
<key name="window-size" type="ai">
<default>[768, 600]</default>
<_summary>Window size</_summary>
diff --git a/src/collection-toolbar.vala b/src/collection-toolbar.vala
index 8b65827..f62c802 100644
--- a/src/collection-toolbar.vala
+++ b/src/collection-toolbar.vala
@@ -31,7 +31,8 @@ private class Boxes.CollectionToolbar: HeaderBar {
App.app.collection.item_added.connect (update_search_btn);
App.app.collection.item_removed.connect (update_search_btn);
- update_view_type (AppWindow.ViewType.ICON);
+ var view_type = (AppWindow.ViewType) window.settings.get_enum ("view");
+ update_view_type (view_type);
search_btn.bind_property ("active", window.searchbar, "search-mode-enabled",
BindingFlags.BIDIRECTIONAL);
@@ -88,6 +89,7 @@ private class Boxes.CollectionToolbar: HeaderBar {
private void update_view_type (AppWindow.ViewType view_type) {
window.view_type = view_type;
+ window.settings.set_enum ("view", view_type);
ui_state_changed ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]