[dconf-editor] Implement properties on small screen.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Implement properties on small screen.
- Date: Thu, 20 Dec 2018 13:36:50 +0000 (UTC)
commit cfd861089a82ce4aafb3e6647b632dca721a88f0
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu Dec 20 14:04:04 2018 +0100
Implement properties on small screen.
editor/browser-headerbar.vala | 73 +++++++++++++++++++++++++++++++++++++++++--
editor/browser-window.vala | 16 +++++++++-
editor/dconf-window.vala | 6 ++++
3 files changed, 92 insertions(+), 3 deletions(-)
---
diff --git a/editor/browser-headerbar.vala b/editor/browser-headerbar.vala
index e2da226..22b1904 100644
--- a/editor/browser-headerbar.vala
+++ b/editor/browser-headerbar.vala
@@ -21,15 +21,28 @@ private abstract class BrowserHeaderBar : BaseHeaderBar, AdaptativeWidget
{
protected PathWidget path_widget;
+ construct
+ {
+ init_path_widget ();
+
+ register_properties_mode ();
+ }
+
+ private ViewType current_type = ViewType.FOLDER;
internal virtual void set_path (ViewType type, string path)
{
path_widget.set_path (type, path);
- update_hamburger_menu ();
+ current_type = type;
+ update_properties_view (); // takes care of the hamburger menu
}
+ private bool is_extra_thin = false;
protected override void set_window_size (AdaptativeWidget.WindowSize new_size)
{
+ is_extra_thin = AdaptativeWidget.WindowSize.is_extra_thin (new_size);
+ update_properties_view ();
+
base.set_window_size (new_size);
path_widget.set_window_size (new_size);
@@ -39,7 +52,7 @@ private abstract class BrowserHeaderBar : BaseHeaderBar, AdaptativeWidget
* * path_widget creation
\*/
- construct
+ private void init_path_widget ()
{
add_path_widget ();
@@ -125,6 +138,62 @@ private abstract class BrowserHeaderBar : BaseHeaderBar, AdaptativeWidget
return path_widget.handle_event (event);
}
+ /*\
+ * * properties mode
+ \*/
+
+ private uint8 properties_mode_id = 0;
+ private bool properties_mode_on = false;
+ internal bool in_window_properties { get { return properties_mode_on; }}
+
+ private void update_properties_view ()
+ {
+ if (is_extra_thin)
+ {
+ if (current_type == ViewType.CONFIG)
+ show_properties_view ();
+ else
+ hide_properties_view ();
+ }
+ else
+ hide_properties_view ();
+ }
+
+ private void show_properties_view ()
+ requires (properties_mode_id > 0)
+ {
+ if (!properties_mode_on)
+ change_mode (properties_mode_id);
+ }
+
+ private void hide_properties_view ()
+ {
+ if (properties_mode_on)
+ change_mode (default_mode_id);
+ update_hamburger_menu ();
+ }
+
+ private void register_properties_mode ()
+ {
+ properties_mode_id = register_new_mode ();
+
+ this.change_mode.connect (mode_changed_properties);
+ }
+
+ private static void mode_changed_properties (BaseHeaderBar _this, uint8 requested_mode_id)
+ {
+ BrowserHeaderBar real_this = (BrowserHeaderBar) _this;
+ if (is_not_requested_mode (real_this.properties_mode_id, requested_mode_id, ref
real_this.properties_mode_on))
+ return;
+
+ real_this.set_default_widgets_states (/* show go_back_button */ true,
+ /* show ltr_left_separator */ false,
+ /* title_label text or null */ _("Properties"),
+ /* show info_button */ false,
+ /* show ltr_right_separator */ false,
+ /* show quit_button_stack */ true);
+ }
+
/*\
* * keyboard calls
\*/
diff --git a/editor/browser-window.vala b/editor/browser-window.vala
index 856a16a..30307f9 100644
--- a/editor/browser-window.vala
+++ b/editor/browser-window.vala
@@ -280,7 +280,7 @@ private abstract class BrowserWindow : BaseWindow
// query
protected bool is_in_in_window_mode ()
{
- return main_view.is_in_in_window_mode ();
+ return main_view.is_in_in_window_mode () || headerbar.in_window_properties;
}
protected bool row_action_blocked ()
@@ -292,6 +292,20 @@ private abstract class BrowserWindow : BaseWindow
return false;
}
+ protected override void show_default_view ()
+ {
+ if (headerbar.in_window_properties)
+ request_folder (current_path);
+ else if (in_window_about)
+ {
+ base.show_default_view ();
+
+ if (current_type == ViewType.CONFIG)
+ request_folder (current_path);
+ }
+ else
+ base.show_default_view ();
+ }
/*\
* * search callbacks
\*/
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 3ad44f5..baa0423 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -502,11 +502,17 @@ private class DConfWindow : BrowserWindow
leave_edit_mode (); // TODO place after
headerbar.show_default_view ();
main_view.show_default_view ();
+
+ if (current_type == ViewType.CONFIG)
+ request_folder (current_path);
}
else if (main_view.in_window_modifications)
{
headerbar.show_default_view ();
main_view.show_default_view ();
+
+ if (current_type == ViewType.CONFIG)
+ request_folder (current_path);
}
else
base.show_default_view ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]