[dconf-editor] Introduce BrowserContent.



commit 81a00d121966637fe345da1f16c20e8bc7a93b9b
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Mon Dec 17 17:47:24 2018 +0100

    Introduce BrowserContent.

 editor/browser-content.vala | 61 +++++++++++++++++++++++++++++++++++++++++++++
 editor/browser-stack.vala   |  4 +--
 editor/meson.build          |  1 +
 3 files changed, 64 insertions(+), 2 deletions(-)
---
diff --git a/editor/browser-content.vala b/editor/browser-content.vala
new file mode 100644
index 0000000..3495dd8
--- /dev/null
+++ b/editor/browser-content.vala
@@ -0,0 +1,61 @@
+/*
+  This file is part of Dconf Editor
+
+  Dconf Editor is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  Dconf Editor is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with Dconf Editor.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
+using Gtk;
+
+private interface BrowserContent : Widget, AdaptativeWidget
+{
+    [CCode (notify = false)] internal abstract ViewType current_view { internal get; protected set; }
+
+    internal abstract void prepare_folder_view (GLib.ListStore key_model, bool is_ancestor);
+    internal abstract void prepare_object_view (string full_name, uint16 context_id, Variant properties, 
bool is_parent);
+    internal abstract void set_path (ViewType type, string path);
+
+    /*\
+    * * current row stuff
+    \*/
+
+    internal abstract string get_selected_row_name ();
+    internal abstract void select_row (string selected, uint16 last_context_id, bool grab_focus_if_needed);
+    internal abstract void row_grab_focus ();
+    /*\
+    * * popovers
+    \*/
+
+    internal abstract bool toggle_row_popover ();
+    internal abstract void discard_row_popover ();
+    internal abstract void invalidate_popovers ();
+
+    /*\
+    * * reload
+    \*/
+
+    internal abstract bool check_reload_folder (Variant? fresh_key_model);
+    internal abstract bool check_reload_object (uint properties_hash);
+
+    /*\
+    * * keyboard calls
+    \*/
+
+    internal abstract bool handle_copy_text (out string copy_text);     // <Ctrl>c
+    internal abstract bool handle_alt_copy_text (out string copy_text); // <Ctrl>C
+
+    internal abstract bool next_match ();                               // <Ctlr>g
+    internal abstract bool previous_match ();                           // <Ctrl>G
+
+    internal abstract bool return_pressed ();                           // Return or KP_Enter
+}
diff --git a/editor/browser-stack.vala b/editor/browser-stack.vala
index 96aa040..2c607ac 100644
--- a/editor/browser-stack.vala
+++ b/editor/browser-stack.vala
@@ -18,14 +18,14 @@
 using Gtk;
 
 [GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/browser-stack.ui")]
-private class BrowserStack : Grid, AdaptativeWidget
+private class BrowserStack : Grid, AdaptativeWidget, BrowserContent
 {
     [GtkChild] private Stack stack;
     [GtkChild] private RegistryView folder_view;
     [GtkChild] private RegistryInfo object_view;
     [GtkChild] private RegistrySearch search_view;
 
-    [CCode (notify = false)] internal ViewType current_view { get; private set; default = ViewType.FOLDER; }
+    [CCode (notify = false)] internal ViewType current_view { internal get; protected set; default = 
ViewType.FOLDER; }
 
     private void set_window_size (AdaptativeWidget.WindowSize new_size)
     {
diff --git a/editor/meson.build b/editor/meson.build
index a84e222..4b5f747 100644
--- a/editor/meson.build
+++ b/editor/meson.build
@@ -75,6 +75,7 @@ sources = files(
   'bookmarks.vala',
   'bookmarks-controller.vala',
   'bookmarks-list.vala',
+  'browser-content.vala',
   'browser-headerbar.vala',
   'browser-infobar.vala',
   'browser-stack.vala',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]