[dconf-editor] Create ModificationsList on the fly.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Create ModificationsList on the fly.
- Date: Thu, 29 Nov 2018 13:27:05 +0000 (UTC)
commit 883c768c227de978c94b47d30ce79a188e4d5df7
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu Nov 29 07:00:51 2018 +0100
Create ModificationsList on the fly.
editor/about-list.vala | 2 +-
editor/bookmarks-list.vala | 4 ++++
editor/browser-view.ui | 8 --------
editor/browser-view.vala | 29 ++++++++++++++++++++++-------
editor/modifications-list.vala | 11 +++++++++++
editor/overlayed-list.vala | 2 ++
6 files changed, 40 insertions(+), 16 deletions(-)
---
diff --git a/editor/about-list.vala b/editor/about-list.vala
index 1f66d70..caa09e5 100644
--- a/editor/about-list.vala
+++ b/editor/about-list.vala
@@ -38,7 +38,7 @@ private class AboutList : OverlayedList
Object (needs_shadows: needs_shadows, big_placeholder: big_placeholder, edit_mode_action_prefix:
"about");
}
- internal void reset ()
+ internal override void reset ()
{
edit_mode_action.set_state (false);
show_apropos (ref main_list_store);
diff --git a/editor/bookmarks-list.vala b/editor/bookmarks-list.vala
index 0ae94ae..b7804c2 100644
--- a/editor/bookmarks-list.vala
+++ b/editor/bookmarks-list.vala
@@ -35,6 +35,10 @@ private class BookmarksList : OverlayedList
second_mode_name = _("Edit");
}
+ internal override void reset ()
+ {
+ }
+
public string schema_path
{
internal set
diff --git a/editor/browser-view.ui b/editor/browser-view.ui
index 9818d33..899d923 100644
--- a/editor/browser-view.ui
+++ b/editor/browser-view.ui
@@ -31,13 +31,5 @@
<signal name="update_bookmarks_icons" handler="on_update_bookmarks_icons"/>
</object>
</child>
- <child>
- <object class="ModificationsList" id="modifications_list">
- <property name="visible">True</property>
- <property name="needs-shadows">False</property>
- <property name="big-placeholder">True</property>
- <signal name="selection-changed" handler="on_modifications_selection_changed"/>
- </object>
- </child>
</template>
</interface>
diff --git a/editor/browser-view.vala b/editor/browser-view.vala
index 43911f0..1655dd8 100644
--- a/editor/browser-view.vala
+++ b/editor/browser-view.vala
@@ -67,7 +67,8 @@ private class BrowserView : Stack, AdaptativeWidget
window_size = new_size;
current_child.set_window_size (new_size);
bookmarks_list.set_window_size (new_size);
- modifications_list.set_window_size (new_size);
+ if (modifications_list_created)
+ modifications_list.set_window_size (new_size);
if (about_list_created)
about_list.set_window_size (new_size);
}
@@ -250,15 +251,29 @@ private class BrowserView : Stack, AdaptativeWidget
internal bool in_window_modifications { internal get; private set; default = false; }
- [GtkChild] private ModificationsList modifications_list;
+ private bool modifications_list_created = false;
+ private ModificationsList modifications_list;
+
+ private void create_modifications_list ()
+ {
+ modifications_list = new ModificationsList (false, true);
+ modifications_list.set_window_size (window_size);
+ // modifications_list.selection_changed.connect (() => ...);
+ modifications_list.show ();
+ add (modifications_list);
+ modifications_list_created = true;
+ }
internal void show_in_window_modifications ()
+ requires (modifications_list_created == true)
{
if (in_window_bookmarks)
hide_in_window_bookmarks ();
else if (in_window_about)
hide_in_window_about ();
+ modifications_list.reset ();
+
set_visible_child (modifications_list);
in_window_modifications = true;
}
@@ -272,6 +287,9 @@ private class BrowserView : Stack, AdaptativeWidget
private void update_in_window_modifications ()
{
+ if (!modifications_list_created)
+ create_modifications_list ();
+
GLib.ListStore modifications_liststore = modifications_handler.get_delayed_settings ();
modifications_list.bind_model (modifications_liststore, delayed_setting_row_create);
@@ -284,11 +302,6 @@ private class BrowserView : Stack, AdaptativeWidget
return ModificationsRevealer.create_delayed_setting_row (modifications_handler, sso.name,
sso.full_name, sso.context_id);
}
- [GtkCallback]
- private void on_modifications_selection_changed ()
- {
- }
-
/*\
* * bookmarks
\*/
@@ -308,6 +321,8 @@ private class BrowserView : Stack, AdaptativeWidget
else if (in_window_about)
hide_in_window_about ();
+ bookmarks_list.reset ();
+
if (bookmarks != old_bookmarks)
{
Variant variant = new Variant.strv (bookmarks);
diff --git a/editor/modifications-list.vala b/editor/modifications-list.vala
index 428309a..2ddb354 100644
--- a/editor/modifications-list.vala
+++ b/editor/modifications-list.vala
@@ -33,6 +33,17 @@ private class ModificationsList : OverlayedList
main_list_box.set_header_func (delayed_setting_row_update_header);
}
+ internal ModificationsList (bool needs_shadows, bool big_placeholder)
+ {
+ Object (needs_shadows: needs_shadows, big_placeholder: big_placeholder);
+ }
+
+ internal override void reset ()
+ {
+ scroll_top (); // FIXME doesn't work if selected row is not the first
+ select_first_row (main_list_box);
+ }
+
private static void delayed_setting_row_update_header (ListBoxRow _row, ListBoxRow? before)
{
if (!(_row is DelayedSettingView))
diff --git a/editor/overlayed-list.vala b/editor/overlayed-list.vala
index c95a615..c26b514 100644
--- a/editor/overlayed-list.vala
+++ b/editor/overlayed-list.vala
@@ -369,6 +369,8 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget
{
edit_mode_box.visible = is_editable && n_items != 0;
}
+
+ internal abstract void reset ();
}
private abstract class OverlayedListRow : ListBoxRow
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]