[dconf-editor] Read again the adaptative stuff.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Read again the adaptative stuff.
- Date: Fri, 11 Jan 2019 13:01:59 +0000 (UTC)
commit 1812976dee7ce3f6abd56f0ecb06ac013046d49c
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Fri Jan 11 13:25:54 2019 +0100
Read again the adaptative stuff.
Fix bookmarks icons not updating, simplify a bit what
happens in the window, display the keyboard shortcuts
hamburger menu entry on really tall and thin windows.
editor/adaptative-window.vala | 4 ++--
editor/base-headerbar.vala | 8 +++++---
editor/base-window.vala | 17 ++++++++---------
editor/bookmarks-window.vala | 26 ++++++++++++--------------
editor/browser-window.vala | 4 ----
editor/dconf-window.vala | 14 +++++++-------
6 files changed, 34 insertions(+), 39 deletions(-)
---
diff --git a/editor/adaptative-window.vala b/editor/adaptative-window.vala
index d54999b..9a13b41 100644
--- a/editor/adaptative-window.vala
+++ b/editor/adaptative-window.vala
@@ -253,10 +253,10 @@ private abstract class AdaptativeWindow : ApplicationWindow
protected virtual void before_destroy () {}
/*\
- * * manage adaptative children
+ * * adaptative stuff
\*/
- protected AdaptativeWidget.WindowSize window_size = AdaptativeWidget.WindowSize.START_SIZE;
+ private AdaptativeWidget.WindowSize window_size = AdaptativeWidget.WindowSize.START_SIZE;
private List<AdaptativeWidget> adaptative_children = new List<AdaptativeWidget> ();
protected void add_adaptative_child (AdaptativeWidget child)
diff --git a/editor/base-headerbar.vala b/editor/base-headerbar.vala
index 4932940..ea8ce5b 100644
--- a/editor/base-headerbar.vala
+++ b/editor/base-headerbar.vala
@@ -33,12 +33,14 @@ private class BaseHeaderBar : NightTimeAwareHeaderBar, AdaptativeWidget
* * properties
\*/
+ private bool has_a_phone_size = false;
protected bool disable_popovers = false;
protected bool disable_action_bar = false;
protected virtual void set_window_size (AdaptativeWidget.WindowSize new_size)
{
- disable_popovers = AdaptativeWidget.WindowSize.is_phone_size (new_size)
- || AdaptativeWidget.WindowSize.is_extra_thin (new_size);
+ has_a_phone_size = AdaptativeWidget.WindowSize.is_phone_size (new_size);
+ disable_popovers = has_a_phone_size
+ || AdaptativeWidget.WindowSize.is_extra_thin (new_size);
bool _disable_action_bar = disable_popovers
|| AdaptativeWidget.WindowSize.is_extra_flat (new_size);
@@ -94,7 +96,7 @@ private class BaseHeaderBar : NightTimeAwareHeaderBar, AdaptativeWidget
{
GLib.Menu section = new GLib.Menu ();
append_or_not_night_mode_entry (ref section);
- append_or_not_keyboard_shortcuts_entry (has_keyboard_shortcuts, !disable_popovers, ref section);
+ append_or_not_keyboard_shortcuts_entry (has_keyboard_shortcuts, !has_a_phone_size, ref section);
append_about_entry (about_action_label, ref section);
section.freeze ();
menu.append_section (null, section);
diff --git a/editor/base-window.vala b/editor/base-window.vala
index 4334daf..395a350 100644
--- a/editor/base-window.vala
+++ b/editor/base-window.vala
@@ -44,6 +44,10 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
headerbar = (BaseHeaderBar) nta_headerbar;
install_action_entries ();
+
+ add_adaptative_child (headerbar);
+ add_adaptative_child (main_view);
+ add_adaptative_child (this);
}
/*\
@@ -287,7 +291,7 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
\*/
private bool disable_popovers = false;
- private void set_window_size (AdaptativeWidget.WindowSize new_size)
+ protected virtual void set_window_size (AdaptativeWidget.WindowSize new_size)
{
bool _disable_popovers = AdaptativeWidget.WindowSize.is_phone_size (new_size)
|| AdaptativeWidget.WindowSize.is_extra_thin (new_size);
@@ -297,12 +301,8 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
if (in_window_about)
show_default_view ();
}
-
- chain_set_window_size (new_size);
}
- protected virtual void chain_set_window_size (AdaptativeWidget.WindowSize new_size) {}
-
/*\
* * in-window panels
\*/
@@ -321,11 +321,10 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
private void about (/* SimpleAction action, Variant? path_variant */)
{
- if (!AdaptativeWidget.WindowSize.is_phone_size (window_size)
- && !AdaptativeWidget.WindowSize.is_extra_thin (window_size))
- show_about_dialog (); // TODO hide the dialog if visible
- else
+ if (disable_popovers)
toggle_in_window_about ();
+ else
+ show_about_dialog (); // TODO hide the dialog if visible
}
private void show_about_dialog ()
diff --git a/editor/bookmarks-window.vala b/editor/bookmarks-window.vala
index 1f23361..c853808 100644
--- a/editor/bookmarks-window.vala
+++ b/editor/bookmarks-window.vala
@@ -17,7 +17,7 @@
using Gtk;
-private abstract class BookmarksWindow : BrowserWindow
+private abstract class BookmarksWindow : BrowserWindow, AdaptativeWidget
{
private BookmarksHeaderBar headerbar;
private BookmarksView main_view;
@@ -142,8 +142,7 @@ private abstract class BookmarksWindow : BrowserWindow
private void update_bookmark_icon (string bookmark, BookmarkIcon icon)
{
- if (AdaptativeWidget.WindowSize.is_extra_thin (window_size)
- || AdaptativeWidget.WindowSize.is_extra_flat (window_size))
+ if (disable_popovers)
main_view.update_bookmark_icon (bookmark, icon);
else
headerbar.update_bookmark_icon (bookmark, icon);
@@ -154,9 +153,9 @@ private abstract class BookmarksWindow : BrowserWindow
\*/
private bool disable_popovers = false;
- protected override void chain_set_window_size (AdaptativeWidget.WindowSize new_size)
+ protected override void set_window_size (AdaptativeWidget.WindowSize new_size)
{
- base.chain_set_window_size (new_size);
+ base.set_window_size (new_size);
bool _disable_popovers = AdaptativeWidget.WindowSize.is_phone_size (new_size)
|| AdaptativeWidget.WindowSize.is_extra_thin (new_size);
@@ -175,19 +174,18 @@ private abstract class BookmarksWindow : BrowserWindow
private void toggle_bookmark (/* SimpleAction action, Variant? variant */)
{
main_view.close_popovers ();
- if (AdaptativeWidget.WindowSize.is_phone_size (window_size)
- || AdaptativeWidget.WindowSize.is_extra_thin (window_size))
- {
- if (main_view.in_window_bookmarks)
- show_default_view ();
- else
- show_use_bookmarks_view ();
- }
- else
+
+ // use popover
+ if (!disable_popovers)
{
toggle_bookmark_called ();
headerbar.click_bookmarks_button ();
}
+ // use in-window
+ else if (main_view.in_window_bookmarks)
+ show_default_view ();
+ else
+ show_use_bookmarks_view ();
}
protected abstract void toggle_bookmark_called ();
diff --git a/editor/browser-window.vala b/editor/browser-window.vala
index f4dbb68..5877ff4 100644
--- a/editor/browser-window.vala
+++ b/editor/browser-window.vala
@@ -100,10 +100,6 @@ private abstract class BrowserWindow : BaseWindow
install_key_action_entries ();
bind_mouse_config ();
-
- add_adaptative_child (headerbar);
- add_adaptative_child (main_view);
- add_adaptative_child (this);
}
/*\
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 48745c5..18ea268 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -26,7 +26,7 @@ internal enum RelocatableSchemasEnabledMappings
STARTUP
}
-private class DConfWindow : BookmarksWindow
+private class DConfWindow : BookmarksWindow, AdaptativeWidget
{
private SettingsModel model;
private ModificationsHandler modifications_handler;
@@ -502,12 +502,11 @@ private class DConfWindow : BookmarksWindow
\*/
private bool disable_action_bar = false;
- protected override void chain_set_window_size (AdaptativeWidget.WindowSize new_size)
+ protected override void set_window_size (AdaptativeWidget.WindowSize new_size)
{
- base.chain_set_window_size (new_size);
+ base.set_window_size (new_size);
- bool _disable_action_bar = AdaptativeWidget.WindowSize.is_phone_size (new_size)
- || AdaptativeWidget.WindowSize.is_extra_thin (new_size)
+ bool _disable_action_bar = AdaptativeWidget.WindowSize.is_extra_thin (new_size)
|| AdaptativeWidget.WindowSize.is_extra_flat (new_size);
if (disable_action_bar != _disable_action_bar)
{
@@ -541,9 +540,10 @@ private class DConfWindow : BookmarksWindow
if (!modifications_handler.get_current_delay_mode ())
return;
- if (!AdaptativeWidget.WindowSize.is_extra_thin (window_size)
- && !AdaptativeWidget.WindowSize.is_extra_flat (window_size))
+ // use popover
+ if (!disable_action_bar)
revealer.toggle_modifications_list ();
+ // use in-window
else if (main_view.in_window_modifications)
show_default_view ();
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]