[dconf-editor] Duplicate RegistryView to BrowserView.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Duplicate RegistryView to BrowserView.
- Date: Tue, 28 Nov 2017 06:28:54 +0000 (UTC)
commit babbb21fcb78f7eea8655e50fc37c984b879e0dd
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Fri Nov 17 23:20:45 2017 +0100
Duplicate RegistryView to BrowserView.
editor/browser-view.ui | 111 +++++++++
editor/browser-view.vala | 495 +++++++++++++++++++++++++++++++++++++
editor/dconf-editor.gresource.xml | 1 +
editor/dconf-editor.ui | 2 +-
editor/dconf-window.vala | 82 +++---
editor/meson.build | 2 +
6 files changed, 651 insertions(+), 42 deletions(-)
---
diff --git a/editor/browser-view.ui b/editor/browser-view.ui
new file mode 100644
index 0000000..8072297
--- /dev/null
+++ b/editor/browser-view.ui
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <template class="BrowserView" parent="GtkGrid">
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkRevealer" id="multiple_schemas_warning_revealer">
+ <property name="visible">True</property>
+ <property name="reveal-child">False</property>
+ <child>
+ <object class="GtkInfoBar">
+ <property name="visible">True</property>
+ <property name="message-type">warning</property>
+ <child internal-child="content_area">
+ <object class="GtkBox">
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <property name="max-width-chars">40</property>
+ <property name="wrap">True</property>
+ <property name="label" translatable="yes">Multiple schemas are installed at this path.
This could lead to problems if it hasn’t been done carefully. Only one schema is displayed here. Edit values
at your own risk.</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkRevealer" id="need_reload_warning_revealer">
+ <property name="visible">True</property>
+ <property name="reveal-child">False</property>
+ <child>
+ <object class="GtkInfoBar">
+ <property name="visible">True</property>
+ <property name="message-type">info</property>
+ <child internal-child="content_area">
+ <object class="GtkBox">
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <property name="max-width-chars">40</property>
+ <property name="wrap">True</property>
+ <property name="label" translatable="yes">Sort preferences have changed. Do you want to
reload the view?</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Reload</property>
+ <signal name="clicked" handler="reload"/>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkStack" id="stack">
+ <property name="visible">True</property>
+ <property name="visible-child">browse-view</property> <!-- uses the "id" attribute -->
+ <property name="transition-type">crossfade</property>
+ <property name="expand">True</property>
+ <child>
+ <object class="GtkScrolledWindow" id="browse-view">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkListBox" id="key_list_box">
+ <property name="visible">True</property>
+ <property name="activate-on-single-click">True</property>
+ <property name="selection-mode">browse</property><!-- permits to not have an item selected
-->
+ <style>
+ <class name="keys-list"/>
+ </style>
+ <signal name="row-activated" handler="row_activated_cb"/>
+ <child type="placeholder">
+ <object class="RegistryPlaceholder">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">No keys in this path</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="name">browse-view</property>
+ </packing>
+ </child>
+ <child>
+ <object class="RegistryInfo" id="properties_view">
+ <property name="visible">True</property>
+ <property name="revealer">revealer</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="ModificationsRevealer" id="revealer">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/editor/browser-view.vala b/editor/browser-view.vala
new file mode 100644
index 0000000..c7888c3
--- /dev/null
+++ b/editor/browser-view.vala
@@ -0,0 +1,495 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+using Gtk;
+
+[GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/browser-view.ui")]
+class BrowserView : Grid, PathElement
+{
+ public string current_path { get; private set; }
+ public Behaviour behaviour { get; set; }
+
+ private GLib.Settings application_settings = new GLib.Settings ("ca.desrt.dconf-editor.Settings");
+ [GtkChild] private Revealer need_reload_warning_revealer;
+ [GtkChild] private Revealer multiple_schemas_warning_revealer;
+ private bool multiple_schemas_warning_needed;
+
+ private Directory current_directory;
+
+ [GtkChild] private Stack stack;
+ [GtkChild] private RegistryInfo properties_view;
+
+ [GtkChild] private ListBox key_list_box;
+ private GLib.ListStore? key_model = null;
+ private SortingOptions sorting_options;
+
+ private GLib.ListStore rows_possibly_with_popover = new GLib.ListStore (typeof (ClickableListBoxRow));
+
+ private bool _small_keys_list_rows;
+ public bool small_keys_list_rows
+ {
+ set
+ {
+ _small_keys_list_rows = value;
+ key_list_box.foreach((row) => {
+ Widget row_child = ((ListBoxRow) row).get_child ();
+ if (row_child is KeyListBoxRow)
+ ((KeyListBoxRow) row_child).small_keys_list_rows = value;
+ });
+ }
+ }
+
+ [GtkChild] private ModificationsRevealer revealer;
+
+ private DConfWindow? _window = null;
+ private DConfWindow window {
+ get {
+ if (_window == null)
+ _window = (DConfWindow) DConfWindow._get_parent (DConfWindow._get_parent (this));
+ return (!) _window;
+ }
+ }
+
+ construct
+ {
+ ulong revealer_reload_handler = revealer.reload.connect (invalidate_popovers);
+
+ bind_property ("behaviour", revealer, "behaviour",
BindingFlags.BIDIRECTIONAL|BindingFlags.SYNC_CREATE);
+
+ sorting_options = new SortingOptions ();
+ application_settings.bind ("sort-case-sensitive", sorting_options, "case-sensitive",
GLib.SettingsBindFlags.GET);
+ application_settings.bind ("sort-folders", sorting_options, "sort-folders",
GLib.SettingsBindFlags.GET);
+
+ key_list_box.set_header_func (update_row_header);
+
+ destroy.connect (() => {
+ revealer.disconnect (revealer_reload_handler);
+ base.destroy ();
+ });
+ }
+
+ public void init (string path, bool restore_view) // TODO check path format
+ {
+ current_path = (restore_view && path != "" && path [0] == '/') ? path : "/";
+
+ sorting_options.notify.connect (() => {
+ if (!is_not_browsing_view () && current_directory.need_sorting (sorting_options))
+ need_reload_warning_revealer.set_reveal_child (true);
+ });
+ }
+
+ /*\
+ * * Stack switching
+ \*/
+
+ public void set_directory (Directory directory, string? selected)
+ {
+ current_directory = directory;
+
+ current_directory.sort_key_model (sorting_options);
+ key_model = current_directory.key_model;
+
+ multiple_schemas_warning_needed = current_directory.warning_multiple_schemas;
+
+ key_list_box.bind_model (key_model, new_list_box_row);
+
+ show_browse_view (directory.full_name, selected);
+ }
+
+ private void show_browse_view (string path, string? selected, bool grab_focus = true)
+ {
+ stack.set_transition_type (current_path.has_prefix (path) ? StackTransitionType.CROSSFADE :
StackTransitionType.NONE);
+ need_reload_warning_revealer.set_reveal_child (false);
+ multiple_schemas_warning_revealer.set_reveal_child (multiple_schemas_warning_needed);
+ update_current_path (path);
+ current_directory.sort_key_model (sorting_options);
+ stack.set_visible_child_name ("browse-view");
+ if (selected != null)
+ {
+ check_resize ();
+ ListBoxRow? row = key_list_box.get_row_at_index (get_row_position ((!) selected));
+ if (row == null)
+ assert_not_reached ();
+ scroll_to_row ((!) row, grab_focus);
+ }
+ else
+ {
+ ListBoxRow? row = key_list_box.get_row_at_index (0);
+ if (row != null)
+ scroll_to_row ((!) row, grab_focus);
+ }
+ properties_view.clean ();
+ }
+ private int get_row_position (string selected)
+ requires (key_model != null)
+ {
+ uint position = 0;
+ while (position < ((!) key_model).get_n_items ())
+ {
+ SettingObject object = (SettingObject) ((!) key_model).get_object (position);
+ if (object.full_name == selected)
+ return (int) position;
+ position++;
+ }
+ assert_not_reached ();
+ }
+ private void scroll_to_row (ListBoxRow row, bool grab_focus)
+ {
+ key_list_box.select_row (row);
+ if (grab_focus)
+ row.grab_focus ();
+
+ Allocation list_allocation, row_allocation;
+ stack.get_allocation (out list_allocation);
+ row.get_allocation (out row_allocation);
+ key_list_box.get_adjustment ().set_value (row_allocation.y + (int) ((row_allocation.height -
list_allocation.height) / 2.0));
+ }
+
+ public void show_properties_view (Key key, string path, bool warning_multiple_schemas)
+ {
+ properties_view.populate_properties_list_box (key, warning_multiple_schemas);
+
+ need_reload_warning_revealer.set_reveal_child (false);
+ multiple_schemas_warning_revealer.set_reveal_child (false);
+
+ stack.set_transition_type (path.has_prefix (current_path) && current_path.length ==
path.last_index_of_char ('/') + 1 ? StackTransitionType.CROSSFADE : StackTransitionType.NONE);
+ update_current_path (path);
+ stack.set_visible_child (properties_view);
+ }
+
+ private void update_current_path (string path)
+ {
+ revealer.path_changed ();
+ current_path = path;
+ window.update_path_elements ();
+ invalidate_popovers ();
+ }
+
+ /*\
+ * * Key ListBox
+ \*/
+
+ private void update_row_header (ListBoxRow row, ListBoxRow? before)
+ {
+ if (before != null)
+ {
+ ListBoxRowHeader header = new ListBoxRowHeader ();
+ header.set_halign (Align.CENTER);
+ header.show ();
+ row.set_header (header);
+ }
+ }
+
+ private Widget new_list_box_row (Object item)
+ {
+ ClickableListBoxRow row;
+ SettingObject setting_object = (SettingObject) item;
+ ulong on_delete_call_handler;
+
+ if (setting_object is Directory)
+ {
+ row = new FolderListBoxRow (setting_object.name, setting_object.full_name);
+ on_delete_call_handler = row.on_delete_call.connect (() => reset_objects (((Directory)
setting_object).key_model, true));
+ }
+ else
+ {
+ if (setting_object is GSettingsKey)
+ row = new KeyListBoxRowEditable ((GSettingsKey) setting_object);
+ else
+ row = new KeyListBoxRowEditableNoSchema ((DConfKey) setting_object);
+
+ Key key = (Key) setting_object;
+ KeyListBoxRow key_row = (KeyListBoxRow) row;
+ key_row.small_keys_list_rows = _small_keys_list_rows;
+
+ on_delete_call_handler = row.on_delete_call.connect (() => set_key_value (key, null));
+ ulong set_key_value_handler = key_row.set_key_value.connect ((variant) => { set_key_value (key,
variant); set_delayed_icon (row, key); });
+ ulong change_dismissed_handler = key_row.change_dismissed.connect (() => revealer.dismiss_change
(key));
+
+ ulong key_planned_change_handler = key.notify ["planned-change"].connect (() => set_delayed_icon
(row, key));
+ ulong key_planned_value_handler = key.notify ["planned-value"].connect (() => set_delayed_icon
(row, key));
+ set_delayed_icon (row, key);
+
+ row.destroy.connect (() => {
+ key_row.disconnect (set_key_value_handler);
+ key_row.disconnect (change_dismissed_handler);
+ key.disconnect (key_planned_change_handler);
+ key.disconnect (key_planned_value_handler);
+ });
+ }
+
+ ulong on_row_clicked_handler = row.on_row_clicked.connect (() => request_path
(setting_object.full_name));
+ ulong button_press_event_handler = row.button_press_event.connect (on_button_pressed);
+
+ row.destroy.connect (() => {
+ row.disconnect (on_delete_call_handler);
+ row.disconnect (on_row_clicked_handler);
+ row.disconnect (button_press_event_handler);
+ });
+
+ /* Wrapper ensures max width for rows */
+ ListBoxRowWrapper wrapper = new ListBoxRowWrapper ();
+ wrapper.set_halign (Align.CENTER);
+ wrapper.add (row);
+ if (row is FolderListBoxRow)
+ wrapper.get_style_context ().add_class ("folder-row");
+ else
+ wrapper.get_style_context ().add_class ("key-row");
+ return wrapper;
+ }
+
+ private void set_delayed_icon (ClickableListBoxRow row, Key key)
+ {
+ if (key.planned_change)
+ {
+ StyleContext context = row.get_style_context ();
+ context.add_class ("delayed");
+ if (key is DConfKey)
+ {
+ if (key.planned_value == null)
+ context.add_class ("erase");
+ else
+ context.remove_class ("erase");
+ }
+ }
+ else
+ row.get_style_context ().remove_class ("delayed");
+ }
+
+ private bool on_button_pressed (Widget widget, Gdk.EventButton event)
+ {
+ ListBoxRow list_box_row = (ListBoxRow) widget.get_parent ();
+ key_list_box.select_row (list_box_row);
+ list_box_row.grab_focus ();
+
+ if (event.button == Gdk.BUTTON_SECONDARY)
+ {
+ ClickableListBoxRow row = (ClickableListBoxRow) widget;
+
+ int event_x = (int) event.x;
+ if (event.window != widget.get_window ()) // boolean value switch
+ {
+ int widget_x, unused;
+ event.window.get_position (out widget_x, out unused);
+ event_x += widget_x;
+ }
+
+ row.show_right_click_popover (get_current_delay_mode (), event_x);
+ rows_possibly_with_popover.append (row);
+ }
+
+ return false;
+ }
+
+ [GtkCallback]
+ private void row_activated_cb (ListBoxRow list_box_row)
+ {
+ ((ClickableListBoxRow) list_box_row.get_child ()).on_row_clicked ();
+ }
+
+ public void invalidate_popovers ()
+ {
+ uint position = 0;
+ ClickableListBoxRow? row = (ClickableListBoxRow?) rows_possibly_with_popover.get_item (0);
+ while (row != null)
+ {
+ ((!) row).destroy_popover ();
+ position++;
+ row = (ClickableListBoxRow?) rows_possibly_with_popover.get_item (position);
+ }
+ rows_possibly_with_popover.remove_all ();
+ window.update_hamburger_menu ();
+ }
+
+ [GtkCallback]
+ private void reload ()
+ requires (!is_not_browsing_view ())
+ {
+ ListBoxRow? selected_row = key_list_box.get_selected_row ();
+ string? saved_selection = null;
+ if (selected_row != null)
+ {
+ int position = ((!) selected_row).get_index ();
+ saved_selection = ((SettingObject) ((!) key_model).get_object (position)).full_name;
+ }
+
+ show_browse_view (current_path, saved_selection);
+ }
+
+ /*\
+ * * Revealer stuff
+ \*/
+
+ public bool get_current_delay_mode ()
+ {
+ return revealer.get_current_delay_mode ();
+ }
+
+ public void enter_delay_mode ()
+ {
+ revealer.enter_delay_mode ();
+ invalidate_popovers ();
+ }
+
+ private void set_key_value (Key key, Variant? new_value)
+ {
+ if (get_current_delay_mode ())
+ revealer.add_delayed_setting (key, new_value);
+ else if (new_value != null)
+ key.value = (!) new_value;
+ else if (key is GSettingsKey)
+ ((GSettingsKey) key).set_to_default ();
+ else if (behaviour != Behaviour.UNSAFE)
+ {
+ enter_delay_mode ();
+ revealer.add_delayed_setting (key, null);
+ }
+ else
+ ((DConfKey) key).erase ();
+ }
+
+ /*\
+ * * Action entries
+ \*/
+
+ public void reset (bool recursively)
+ {
+ reset_objects (key_model, recursively);
+ }
+
+ private void reset_objects (GLib.ListStore? objects, bool recursively)
+ {
+ enter_delay_mode ();
+ reset_generic (objects, recursively);
+ revealer.warn_if_no_planned_changes ();
+ }
+
+ private void reset_generic (GLib.ListStore? objects, bool recursively)
+ {
+ if (objects == null)
+ return;
+
+ for (uint position = 0;; position++)
+ {
+ Object? object = ((!) objects).get_object (position);
+ if (object == null)
+ return;
+
+ SettingObject setting_object = (SettingObject) ((!) object);
+ if (setting_object is Directory)
+ {
+ if (recursively)
+ reset_generic (((Directory) setting_object).key_model, true);
+ continue;
+ }
+ if (setting_object is DConfKey)
+ {
+ if (!((DConfKey) setting_object).is_ghost)
+ revealer.add_delayed_setting ((Key) setting_object, null);
+ }
+ else if (!((GSettingsKey) setting_object).is_default)
+ revealer.add_delayed_setting ((Key) setting_object, null);
+ }
+ }
+
+ /*\
+ * * Keyboard calls
+ \*/
+
+/* public void set_search_mode (bool? mode) // mode is never 'true'...
+ {
+ if (mode == null)
+ search_bar.set_search_mode (!search_bar.get_search_mode ());
+ else
+ search_bar.set_search_mode ((!) mode);
+ }
+
+ public bool handle_search_event (Gdk.EventKey event)
+ {
+ if (is_not_browsing_view ())
+ return false;
+
+ return search_bar.handle_event (event);
+ } */
+
+ public bool show_row_popover ()
+ {
+ ListBoxRow? selected_row = get_key_row ();
+ if (selected_row == null)
+ return false;
+
+ ClickableListBoxRow row = (ClickableListBoxRow) ((!) selected_row).get_child ();
+ row.show_right_click_popover (get_current_delay_mode ());
+ rows_possibly_with_popover.append (row);
+ return true;
+ }
+
+ public string? get_copy_text ()
+ {
+ if (is_not_browsing_view ())
+ return properties_view.get_copy_text ();
+
+ ListBoxRow? selected_row = key_list_box.get_selected_row ();
+ if (selected_row == null)
+ return null;
+ else
+ return ((ClickableListBoxRow) ((!) selected_row).get_child ()).get_text ();
+ }
+
+ public void toggle_boolean_key ()
+ {
+ ListBoxRow? selected_row = get_key_row ();
+ if (selected_row == null)
+ return;
+
+ if (!(((!) selected_row).get_child () is KeyListBoxRow))
+ return;
+
+ ((KeyListBoxRow) ((!) selected_row).get_child ()).toggle_boolean_key ();
+ }
+
+ public void set_to_default ()
+ {
+ ListBoxRow? selected_row = get_key_row ();
+ if (selected_row == null)
+ return;
+
+ ((ClickableListBoxRow) ((!) selected_row).get_child ()).on_delete_call ();
+ }
+
+ public void discard_row_popover ()
+ {
+ ListBoxRow? selected_row = get_key_row ();
+ if (selected_row == null)
+ return;
+
+ ((ClickableListBoxRow) ((!) selected_row).get_child ()).hide_right_click_popover ();
+ }
+
+ private bool is_not_browsing_view ()
+ {
+ string? visible_child_name = stack.get_visible_child_name ();
+ return (visible_child_name == null || ((!) visible_child_name) != "browse-view");
+ }
+
+ private ListBoxRow? get_key_row ()
+ {
+ if (is_not_browsing_view ())
+ return null;
+ return (ListBoxRow?) key_list_box.get_selected_row ();
+ }
+}
diff --git a/editor/dconf-editor.gresource.xml b/editor/dconf-editor.gresource.xml
index 2a65d68..186906b 100644
--- a/editor/dconf-editor.gresource.xml
+++ b/editor/dconf-editor.gresource.xml
@@ -3,6 +3,7 @@
<gresource prefix="/ca/desrt/dconf-editor/ui">
<file preprocess="xml-stripblanks">bookmark.ui</file>
<file preprocess="xml-stripblanks">bookmarks.ui</file>
+ <file preprocess="xml-stripblanks">browser-view.ui</file>
<file>dconf-editor.css</file>
<file preprocess="xml-stripblanks">dconf-editor.ui</file>
<file preprocess="xml-stripblanks">folder-list-box-row.ui</file>
diff --git a/editor/dconf-editor.ui b/editor/dconf-editor.ui
index 8989cfb..bd7889b 100644
--- a/editor/dconf-editor.ui
+++ b/editor/dconf-editor.ui
@@ -113,7 +113,7 @@
<object class="GtkOverlay">
<property name="visible">True</property>
<child>
- <object class="RegistryView" id="registry_view">
+ <object class="BrowserView" id="browser_view">
<property name="visible">True</property>
<signal name="request_path" handler="request_path"/>
</object>
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index de2ce68..b7b9309 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -55,7 +55,7 @@ class DConfWindow : ApplicationWindow
[GtkChild] private Bookmarks bookmarks_button;
[GtkChild] private MenuButton info_button;
[GtkChild] private PathBar pathbar;
- [GtkChild] private RegistryView registry_view;
+ [GtkChild] private BrowserView browser_view;
[GtkChild] private Revealer notification_revealer;
[GtkChild] private Label notification_label;
@@ -82,7 +82,7 @@ class DConfWindow : ApplicationWindow
{
add_action_entries (action_entries, this);
- behaviour_changed_handler = settings.changed ["behaviour"].connect
(registry_view.invalidate_popovers);
+ behaviour_changed_handler = settings.changed ["behaviour"].connect
(browser_view.invalidate_popovers);
set_default_size (settings.get_int ("window-width"), settings.get_int ("window-height"));
if (settings.get_boolean ("window-is-maximized"))
@@ -104,7 +104,7 @@ class DConfWindow : ApplicationWindow
if (!context.has_class ("small-keys-list-rows")) context.add_class
("small-keys-list-rows");
}
else if (context.has_class ("small-keys-list-rows")) context.remove_class
("small-keys-list-rows");
- registry_view.small_keys_list_rows = small_rows;
+ browser_view.small_keys_list_rows = small_rows;
});
small_bookmarks_rows_handler = settings.changed ["small-bookmarks-rows"].connect (() => {
if (settings.get_boolean ("small-bookmarks-rows"))
@@ -118,12 +118,12 @@ class DConfWindow : ApplicationWindow
bool small_rows = settings.get_boolean ("small-keys-list-rows");
if (small_rows)
context.add_class ("small-keys-list-rows");
- registry_view.small_keys_list_rows = small_rows;
+ browser_view.small_keys_list_rows = small_rows;
if (settings.get_boolean ("small-bookmarks-rows"))
context.add_class ("small-bookmarks-rows");
- registry_view.bind_property ("current-path", this, "current-path"); // TODO in UI file?
- settings.bind ("behaviour", registry_view, "behaviour",
SettingsBindFlags.GET|SettingsBindFlags.NO_SENSITIVITY);
+ browser_view.bind_property ("current-path", this, "current-path"); // TODO in UI file?
+ settings.bind ("behaviour", browser_view, "behaviour",
SettingsBindFlags.GET|SettingsBindFlags.NO_SENSITIVITY);
settings.bind ("mouse-use-extra-buttons", this, "mouse-extra-buttons",
SettingsBindFlags.GET|SettingsBindFlags.NO_SENSITIVITY);
settings.bind ("mouse-back-button", this, "mouse-back-button",
SettingsBindFlags.GET|SettingsBindFlags.NO_SENSITIVITY);
@@ -131,9 +131,9 @@ class DConfWindow : ApplicationWindow
/* init current_path */
if (path == null)
- registry_view.init (settings.get_string ("saved-view"), settings.get_boolean ("restore-view"));
// TODO better?
+ browser_view.init (settings.get_string ("saved-view"), settings.get_boolean ("restore-view"));
// TODO better?
else
- registry_view.init ((!) path, true);
+ browser_view.init ((!) path, true);
/* go to directory */
string folder_name = SettingsModel.get_base_path (current_path);
@@ -146,7 +146,7 @@ class DConfWindow : ApplicationWindow
}
if (folder_name == current_path)
{
- registry_view.set_directory ((!) dir, null);
+ browser_view.set_directory ((!) dir, null);
return;
}
@@ -161,12 +161,12 @@ class DConfWindow : ApplicationWindow
{
if (existing_dir != null)
warning ("TODO: search (current_path)");
- registry_view.show_properties_view ((Key) (!) existing_key, current_path, ((!)
dir).warning_multiple_schemas);
+ browser_view.show_properties_view ((Key) (!) existing_key, current_path, ((!)
dir).warning_multiple_schemas);
}
else
{
if (existing_dir != null)
- registry_view.set_directory ((!) existing_dir, null);
+ browser_view.set_directory ((!) existing_dir, null);
else
cannot_find_key (object_name, (!) dir);
}
@@ -271,7 +271,7 @@ class DConfWindow : ApplicationWindow
[GtkCallback]
private void request_path (string full_name)
{
-// registry_view.set_search_mode (false); // TODO not useful when called from bookmark
+// browser_view.set_search_mode (false); // TODO not useful when called from bookmark
highcontrast = ("HighContrast" in Gtk.Settings.get_default ().gtk_theme_name);
string folder_name = SettingsModel.get_base_path (full_name);
@@ -284,7 +284,7 @@ class DConfWindow : ApplicationWindow
}
if (full_name == folder_name)
{
- registry_view.set_directory ((!) dir, pathbar.get_selected_child (full_name));
+ browser_view.set_directory ((!) dir, pathbar.get_selected_child (full_name));
return;
}
@@ -298,7 +298,7 @@ class DConfWindow : ApplicationWindow
else if (((!) existing_key) is DConfKey && ((DConfKey) (!) existing_key).is_ghost)
key_has_been_removed (object_name, (!) dir);
else
- registry_view.show_properties_view ((Key) (!) existing_key, full_name, ((!)
dir).warning_multiple_schemas);
+ browser_view.show_properties_view ((Key) (!) existing_key, full_name, ((!)
dir).warning_multiple_schemas);
}
/*\
@@ -327,7 +327,7 @@ class DConfWindow : ApplicationWindow
menu.append_section (null, section);
}
- if (!registry_view.get_current_delay_mode ())
+ if (!browser_view.get_current_delay_mode ())
{
section = new GLib.Menu ();
section.append (_("Enter delay mode"), "win.enter-delay-mode");
@@ -351,17 +351,17 @@ class DConfWindow : ApplicationWindow
private void reset ()
{
- registry_view.reset (false);
+ browser_view.reset (false);
}
private void reset_recursively ()
{
- registry_view.reset (true);
+ browser_view.reset (true);
}
private void enter_delay_mode ()
{
- registry_view.enter_delay_mode ();
+ browser_view.enter_delay_mode ();
}
/*\
@@ -399,19 +399,19 @@ class DConfWindow : ApplicationWindow
case "b":
if (info_button.active)
info_button.active = false;
- registry_view.discard_row_popover ();
+ browser_view.discard_row_popover ();
bookmarks_button.clicked ();
return true;
case "d":
if (info_button.active)
info_button.active = false;
- registry_view.discard_row_popover ();
+ browser_view.discard_row_popover ();
bookmarks_button.set_bookmarked (true);
return true;
case "D":
if (info_button.active)
info_button.active = false;
- registry_view.discard_row_popover ();
+ browser_view.discard_row_popover ();
bookmarks_button.set_bookmarked (false);
return true;
// case "f":
@@ -419,21 +419,21 @@ class DConfWindow : ApplicationWindow
// bookmarks_button.active = false;
// if (info_button.active)
// info_button.active = false;
-// registry_view.discard_row_popover ();
-// registry_view.set_search_mode (null);
+// browser_view.discard_row_popover ();
+// browser_view.set_search_mode (null);
// return true;
case "c":
- registry_view.discard_row_popover (); // TODO avoid duplicate get_selected_row () call
- string? selected_row_text = registry_view.get_copy_text ();
+ browser_view.discard_row_popover (); // TODO avoid duplicate get_selected_row () call
+ string? selected_row_text = browser_view.get_copy_text ();
ConfigurationEditor application = (ConfigurationEditor) get_application ();
application.copy (selected_row_text == null ? current_path : (!) selected_row_text);
return true;
case "C":
- registry_view.discard_row_popover ();
+ browser_view.discard_row_popover ();
((ConfigurationEditor) get_application ()).copy (current_path);
return true;
case "F1":
- registry_view.discard_row_popover ();
+ browser_view.discard_row_popover ();
if ((event.state & Gdk.ModifierType.SHIFT_MASK) == 0)
return false; // help overlay
((ConfigurationEditor) get_application ()).about_cb ();
@@ -442,9 +442,9 @@ class DConfWindow : ApplicationWindow
case "KP_Enter":
if (info_button.active || bookmarks_button.active)
return false;
-// registry_view.set_search_mode (false);
- registry_view.discard_row_popover ();
- registry_view.toggle_boolean_key ();
+// browser_view.set_search_mode (false);
+ browser_view.discard_row_popover ();
+ browser_view.toggle_boolean_key ();
return true;
// case "BackSpace": // ?
case "Delete":
@@ -454,9 +454,9 @@ class DConfWindow : ApplicationWindow
case "KP_Decimal":
if (info_button.active || bookmarks_button.active)
return false;
-// registry_view.set_search_mode (false);
- registry_view.discard_row_popover ();
- registry_view.set_to_default ();
+// browser_view.set_search_mode (false);
+ browser_view.discard_row_popover ();
+ browser_view.set_to_default ();
return true;
default:
break; // TODO make <ctrl>v work; https://bugzilla.gnome.org/show_bug.cgi?id=762257 is
WONTFIX
@@ -480,14 +480,14 @@ class DConfWindow : ApplicationWindow
/* don't use "else if", or some widgets will not be hidden on <ctrl>F10 or such things */
if (name == "F10")
{
- registry_view.discard_row_popover ();
+ browser_view.discard_row_popover ();
if (bookmarks_button.active)
bookmarks_button.active = false;
return false;
}
if (name == "Menu")
{
- if (registry_view.show_row_popover ())
+ if (browser_view.show_row_popover ())
{
if (bookmarks_button.active)
bookmarks_button.active = false;
@@ -508,14 +508,14 @@ class DConfWindow : ApplicationWindow
if (bookmarks_button.active || info_button.active)
return false;
- return false; // registry_view.handle_search_event (event);
+ return false; // browser_view.handle_search_event (event);
}
[GtkCallback]
private void on_menu_button_clicked ()
{
- registry_view.discard_row_popover ();
-// registry_view.set_search_mode (false);
+ browser_view.discard_row_popover ();
+// browser_view.set_search_mode (false);
}
private void go_backward (bool shift)
@@ -550,17 +550,17 @@ class DConfWindow : ApplicationWindow
private void cannot_find_folder (string folder_name)
{
- registry_view.set_directory ((!) model.get_directory ("/"), null);
+ browser_view.set_directory ((!) model.get_directory ("/"), null);
show_notification (_("Cannot find folder “%s”.").printf (folder_name));
}
private void cannot_find_key (string key_name, Directory fallback_dir)
{
- registry_view.set_directory (fallback_dir, null);
+ browser_view.set_directory (fallback_dir, null);
show_notification (_("Cannot find key “%s” here.").printf (key_name));
}
private void key_has_been_removed (string key_name, Directory fallback_dir)
{
- registry_view.set_directory (fallback_dir, fallback_dir.full_name + key_name);
+ browser_view.set_directory (fallback_dir, fallback_dir.full_name + key_name);
show_notification (_("Key “%s” has been removed.").printf (key_name));
}
diff --git a/editor/meson.build b/editor/meson.build
index 86c2fa7..bcc14ae 100644
--- a/editor/meson.build
+++ b/editor/meson.build
@@ -51,6 +51,7 @@ install_data(
sources = files(
'bookmarks.vala',
+ 'browser-view.vala',
'dconf-editor.vala',
'dconf-model.vala',
'dconf-view.vala',
@@ -66,6 +67,7 @@ sources = files(
resource_data = files(
'bookmarks.ui',
'bookmark.ui',
+ 'browser-view.ui',
'dconf-editor.css',
'dconf-editor-menu.ui',
'dconf-editor.ui',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]