[dconf-editor] Add an open-parent button on small screen.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Add an open-parent button on small screen.
- Date: Mon, 7 Jan 2019 13:41:59 +0000 (UTC)
commit e9b6c237211f931ee57701531e4828cf43db06e7
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Mon Jan 7 10:10:27 2019 +0100
Add an open-parent button on small screen.
That was the one main functionality not accessible enough.
editor/browser-window.vala | 7 +++++--
editor/pathwidget.ui | 23 +++++++++++++++++++++++
editor/pathwidget.vala | 44 +++++++++++++++++++++++++++++++++++++-------
editor/short-pathbar.vala | 4 ++--
4 files changed, 67 insertions(+), 11 deletions(-)
---
diff --git a/editor/browser-window.vala b/editor/browser-window.vala
index ad24b96..16cfdc3 100644
--- a/editor/browser-window.vala
+++ b/editor/browser-window.vala
@@ -65,7 +65,9 @@ private abstract class BrowserWindow : BaseWindow
action_group.add_action_entries (browser_action_entries, this);
insert_action_group ("browser", action_group);
- disabled_state_action = (SimpleAction) action_group.lookup_action ("disabled-state");
+ disabled_state_action = (SimpleAction) action_group.lookup_action ("disabled-state-s");
+ disabled_state_action.set_enabled (false);
+ disabled_state_action = (SimpleAction) action_group.lookup_action ("disabled-state-sq");
disabled_state_action.set_enabled (false);
open_path_action = (SimpleAction) action_group.lookup_action ("open-path");
@@ -78,7 +80,8 @@ private abstract class BrowserWindow : BaseWindow
{
{ "empty", empty, "*" },
{ "empty-null", empty },
- { "disabled-state", empty, "(sq)", "('',uint16 65535)" },
+ { "disabled-state-s", empty, "s", "''" },
+ { "disabled-state-sq", empty, "(sq)", "('',uint16 65535)" },
{ "open-folder", open_folder, "s" },
{ "open-object", open_object, "(sq)" },
diff --git a/editor/pathwidget.ui b/editor/pathwidget.ui
index b1e51ef..06f93ba 100644
--- a/editor/pathwidget.ui
+++ b/editor/pathwidget.ui
@@ -27,6 +27,29 @@
<property name="valign">fill</property>
</object>
</child>
+ <child>
+ <object class="GtkRevealer" id="parent_revealer">
+ <property name="visible">True</property>
+ <property name="reveal-child">False</property>
+ <property name="transition-type">slide-left</property>
+ <style>
+ <class name="headerbar-revealer"/>
+ </style>
+ <child>
+ <object class="GtkModelButton" id="parent_button">
+ <property name="visible">True</property>
+ <property name="valign">center</property>
+ <property name="iconic">True</property>
+ <property name="centered">True</property>
+ <property name="action-name">browser.disabled-state-s</property>
+ <property name="action-target">''</property>
+ <style>
+ <class name="image-button"/>
+ </style>
+ </object>
+ </child>
+ </object>
+ </child>
<child>
<object class="GtkModelButton" id="search_button">
<property name="visible">False</property>
diff --git a/editor/pathwidget.vala b/editor/pathwidget.vala
index 467e13c..0a1e3b6 100644
--- a/editor/pathwidget.vala
+++ b/editor/pathwidget.vala
@@ -27,34 +27,51 @@ private class PathWidget : Box, AdaptativeWidget
[GtkChild] private AdaptativePathbar pathbar;
[GtkChild] private PathEntry searchentry;
+ [GtkChild] private Revealer parent_revealer;
+ [GtkChild] private ModelButton parent_button;
+
internal signal void search_changed ();
internal signal void search_stopped ();
private ThemedIcon search_icon = new ThemedIcon.from_names ({"edit-find-symbolic"});
+ private ThemedIcon parent_icon = new ThemedIcon.from_names ({"go-up-symbolic"});
construct
{
search_toggle.icon = search_icon;
search_button.icon = search_icon;
+ parent_button.icon = parent_icon;
}
- private bool thin_window = false;
+ private bool quite_thin_window = false;
+ private bool extra_thin_window = false;
private void set_window_size (AdaptativeWidget.WindowSize new_size)
{
pathbar.set_window_size (new_size);
- bool _thin_window = AdaptativeWidget.WindowSize.is_quite_thin (new_size);
- if (thin_window != _thin_window)
+ bool _quite_thin_window = AdaptativeWidget.WindowSize.is_quite_thin (new_size);
+ bool _extra_thin_window = AdaptativeWidget.WindowSize.is_extra_thin (new_size);
+ if (quite_thin_window != _quite_thin_window
+ || extra_thin_window != _extra_thin_window)
{
- thin_window = _thin_window;
- if (_thin_window)
+ quite_thin_window = _quite_thin_window;
+ extra_thin_window = _extra_thin_window;
+ if (_extra_thin_window)
+ {
+ search_toggle.hide ();
+ search_button.show ();
+ parent_revealer.set_reveal_child (true);
+ }
+ else if (_quite_thin_window)
{
search_toggle.hide ();
search_button.show ();
+ parent_revealer.set_reveal_child (false);
}
else
{
search_button.hide ();
search_toggle.show ();
+ parent_revealer.set_reveal_child (false);
}
}
@@ -107,9 +124,22 @@ private class PathWidget : Box, AdaptativeWidget
pathbar.set_path (type, path);
searchentry.set_path (type, path);
- if (type == ViewType.SEARCH && !search_mode_enabled)
+ bool is_search = type == ViewType.SEARCH;
+
+ if (!is_search)
+ {
+ if (path != "/")
+ {
+ Variant path_variant = new Variant.string (path);
+ parent_button.set_detailed_action_name ("browser.open-parent(" + path_variant.print (false)
+ ")");
+ }
+ else
+ parent_button.set_detailed_action_name ("browser.disabled-state-s('/')");
+ }
+
+ if (is_search && !search_mode_enabled)
enter_search_mode ();
- else if (type != ViewType.SEARCH && search_mode_enabled)
+ else if (!is_search && search_mode_enabled)
leave_search_mode ();
}
diff --git a/editor/short-pathbar.vala b/editor/short-pathbar.vala
index 7f585c2..d415baa 100644
--- a/editor/short-pathbar.vala
+++ b/editor/short-pathbar.vala
@@ -155,7 +155,7 @@ private class ShortPathbar : Grid, Pathbar // TODO make MenuButton?
if (non_ghost_path.has_prefix (tmp_path))
menu.append (item, "browser.open-path(" + variant.print (true) + ")"); // TODO append or
prepend?
else
- menu.append (item, "browser.disabled-state(" + variant.print (true) + ")"); // TODO append
or prepend?
+ menu.append (item, "browser.disabled-state-sq(" + variant.print (true) + ")"); // TODO
append or prepend?
}
// key or nothing
@@ -171,7 +171,7 @@ private class ShortPathbar : Grid, Pathbar // TODO make MenuButton?
if (non_ghost_path.has_prefix (tmp_path)) // FIXME problem if key and folder named similarly
menu.append (last, "browser.open-path(" + variant.print (true) + ")");
else
- menu.append (last, "browser.disabled-state(" + variant.print (true) + ")"); // TODO append
or prepend?
+ menu.append (last, "browser.disabled-state-sq(" + variant.print (true) + ")"); // TODO
append or prepend?
}
section.freeze ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]