[dconf-editor] Move NotificationsRevealer in BaseView.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Move NotificationsRevealer in BaseView.
- Date: Wed, 19 Dec 2018 17:20:17 +0000 (UTC)
commit 476e0d8eac97079248cdf70fa8f31ce556e17c04
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Tue Dec 18 12:22:15 2018 +0100
Move NotificationsRevealer in BaseView.
editor/adaptative-window.vala | 3 +++
editor/base-view.ui | 12 ++++++++++--
editor/base-view.vala | 42 +++++++++++++++++++++++++++++++++++++++---
editor/base-window.ui | 11 ++---------
editor/base-window.vala | 27 +++------------------------
editor/browser-view.vala | 12 ++++++------
editor/dconf-window.vala | 10 ++++------
7 files changed, 67 insertions(+), 50 deletions(-)
---
diff --git a/editor/adaptative-window.vala b/editor/adaptative-window.vala
index a4fcc3c..248c586 100644
--- a/editor/adaptative-window.vala
+++ b/editor/adaptative-window.vala
@@ -169,6 +169,9 @@ private abstract class AdaptativeWindow : ApplicationWindow
context = get_style_context ();
context.add_class ("startup");
+ height_request = 283; // 294px max for Purism Librem 5 landscape, for 720px width
+ width_request = 349; // 360px max for Purism Librem 5 portrait, for 654px height
+
nta_headerbar.show ();
set_titlebar (nta_headerbar);
diff --git a/editor/base-view.ui b/editor/base-view.ui
index eadc265..7a58307 100644
--- a/editor/base-view.ui
+++ b/editor/base-view.ui
@@ -5,10 +5,18 @@
<property name="transition-type">over-down-up</property>
<property name="transition-duration">300</property>
<child>
- <object class="GtkGrid" id="current_child_grid">
+ <object class="GtkOverlay" id="notifications_overlay"> <!-- or "main-view", see packing -->
<property name="visible">True</property>
- <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkGrid" id="main_grid">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="name">main-view</property>
+ </packing>
</child>
</template>
</interface>
diff --git a/editor/base-view.vala b/editor/base-view.vala
index b045426..edd5d9a 100644
--- a/editor/base-view.vala
+++ b/editor/base-view.vala
@@ -20,7 +20,7 @@ using Gtk;
[GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/base-view.ui")]
private class BaseView : Stack, AdaptativeWidget
{
- [GtkChild] protected Grid current_child_grid;
+ [GtkChild] protected Grid main_grid;
internal virtual bool handle_copy_text (out string copy_text)
{
@@ -42,6 +42,8 @@ private class BaseView : Stack, AdaptativeWidget
saved_window_size = new_size;
if (about_list_created)
about_list.set_window_size (new_size);
+ if (notifications_revealer_created)
+ notifications_revealer.set_window_size (new_size);
}
/*\
@@ -53,7 +55,7 @@ private class BaseView : Stack, AdaptativeWidget
if (in_window_about)
{
in_window_about = false;
- set_visible_child (current_child_grid);
+ set_visible_child (notifications_overlay); // or set_visible_child_name ("main-view");
}
else
assert_not_reached ();
@@ -83,7 +85,7 @@ private class BaseView : Stack, AdaptativeWidget
about_list_created = true;
}
- internal void show_in_window_about ()
+ internal void show_about_view ()
requires (in_window_about == false)
{
if (about_list_created)
@@ -94,4 +96,38 @@ private class BaseView : Stack, AdaptativeWidget
set_visible_child (about_list);
in_window_about = true;
}
+
+ /*\
+ * * notifications
+ \*/
+
+ [GtkChild] private Overlay notifications_overlay;
+
+ private bool notifications_revealer_created = false;
+ private NotificationsRevealer notifications_revealer;
+
+ private void create_notifications_revealer ()
+ {
+ notifications_revealer = new NotificationsRevealer ();
+ notifications_revealer.set_window_size (saved_window_size);
+ notifications_revealer.show ();
+ notifications_overlay.add_overlay (notifications_revealer);
+ notifications_revealer_created = true;
+ }
+
+ internal void show_notification (string notification)
+ {
+ if (!notifications_revealer_created)
+ create_notifications_revealer ();
+
+ notifications_revealer.show_notification (notification);
+ }
+
+ internal void hide_notification ()
+ {
+ if (!notifications_revealer_created)
+ return;
+
+ notifications_revealer.hide_notification ();
+ }
}
diff --git a/editor/base-window.ui b/editor/base-window.ui
index c5c8d2a..b10cca0 100644
--- a/editor/base-window.ui
+++ b/editor/base-window.ui
@@ -3,19 +3,12 @@
<!-- interface-requires gtk+ 3.0 -->
<template class="BaseWindow" parent="AdaptativeWindow">
<property name="visible">False</property>
- <property name="height-request">283</property> <!-- 294 max for Purism Librem 5 landscape -->
- <property name="width-request">349</property> <!-- 360 max for Purism Librem 5 portrait -->
<signal name="key-press-event" handler="on_key_press_event"/>
<signal name="destroy" handler="on_destroy"/>
<child>
- <object class="GtkOverlay" id="main_overlay">
+ <object class="GtkGrid" id="main_grid">
<property name="visible">True</property>
- <child>
- <object class="GtkGrid" id="main_grid">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- </object>
- </child>
+ <property name="orientation">vertical</property>
</object>
</child>
</template>
diff --git a/editor/base-window.vala b/editor/base-window.vala
index 9c00755..2888049 100644
--- a/editor/base-window.vala
+++ b/editor/base-window.vala
@@ -359,7 +359,7 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
in_window_about = true;
headerbar.show_about_view ();
- base_view.show_in_window_about ();
+ base_view.show_about_view ();
}
protected virtual void show_default_view (/* SimpleAction action, Variant? path_variant */)
@@ -378,34 +378,13 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
* * notifications
\*/
- [GtkChild] private Overlay main_overlay;
-
- private bool notifications_revealer_created = false;
- private NotificationsRevealer notifications_revealer;
-
- private void create_notifications_revealer ()
- {
- notifications_revealer = new NotificationsRevealer ();
- add_adaptative_child (notifications_revealer);
- notifications_revealer.set_window_size (window_size);
- notifications_revealer.show ();
- main_overlay.add_overlay (notifications_revealer);
- notifications_revealer_created = true;
- }
-
protected void show_notification (string notification)
{
- if (!notifications_revealer_created)
- create_notifications_revealer ();
-
- notifications_revealer.show_notification (notification);
+ base_view.show_notification (notification);
}
protected void hide_notification ()
{
- if (!notifications_revealer_created)
- return;
-
- notifications_revealer.hide_notification ();
+ base_view.hide_notification ();
}
}
diff --git a/editor/browser-view.vala b/editor/browser-view.vala
index c51b980..b4f4eed 100644
--- a/editor/browser-view.vala
+++ b/editor/browser-view.vala
@@ -101,11 +101,11 @@ private class BrowserView : BaseView, AdaptativeWidget
info_bar.add_label ("hard-reload-object", _("This key’s properties have changed. Do you want to
reload the view?"),
_("Reload"), "browser.reload-object"); // TODO also for
key removing?
info_bar.show ();
- current_child_grid.add (info_bar);
+ main_grid.add (info_bar);
current_child = new BrowserStack ();
current_child.show ();
- current_child_grid.add (current_child);
+ main_grid.add (current_child);
create_bookmarks_list ();
}
@@ -122,12 +122,12 @@ private class BrowserView : BaseView, AdaptativeWidget
if (in_window_bookmarks_edit_mode)
leave_bookmarks_edit_mode ();
in_window_bookmarks = false;
- set_visible_child (current_child_grid);
+ set_visible_child_name ("main-view");
}
else if (in_window_modifications)
{
in_window_modifications = false;
- set_visible_child (current_child_grid);
+ set_visible_child_name ("main-view");
}
else
base.show_default_view ();
@@ -250,7 +250,7 @@ private class BrowserView : BaseView, AdaptativeWidget
modifications_list_created = true;
}
- internal void show_in_window_modifications ()
+ internal void show_modifications_view ()
requires (modifications_list_created == true)
{
if (in_window_bookmarks || in_window_about)
@@ -302,7 +302,7 @@ private class BrowserView : BaseView, AdaptativeWidget
private string [] old_bookmarks = new string [0];
- internal void show_in_window_bookmarks (string [] bookmarks)
+ internal void show_bookmarks_view (string [] bookmarks)
{
if (in_window_modifications || in_window_about)
show_default_view ();
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 8800a1b..8e482f8 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -516,22 +516,20 @@ private class DConfWindow : BrowserWindow
private void show_use_bookmarks_view (/* SimpleAction action, Variant? path_variant */)
{
- if (browser_view.in_window_modifications || in_window_about)
- show_default_view ();
+ close_in_window_panels ();
headerbar.show_use_bookmarks_view ();
string [] bookmarks = headerbar.get_bookmarks ();
- browser_view.show_in_window_bookmarks (bookmarks);
+ browser_view.show_bookmarks_view (bookmarks);
update_bookmarks_icons_from_array (bookmarks);
}
private void show_modifications_view (/* SimpleAction action, Variant? path_variant */)
{
- if (browser_view.in_window_bookmarks || in_window_about)
- show_default_view ();
+ close_in_window_panels ();
headerbar.show_modifications_view ();
- browser_view.show_in_window_modifications ();
+ browser_view.show_modifications_view ();
}
/*\
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]