[dconf-editor] Remove search.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Remove search.
- Date: Tue, 28 Nov 2017 06:28:23 +0000 (UTC)
commit 4471df67a9e6b1f07b4d0a92d622f609e2b1c864
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Sun Nov 5 09:41:38 2017 +0100
Remove search.
editor/dconf-editor.ui | 3 +-
editor/dconf-model.vala | 4 +-
editor/dconf-window.vala | 28 ++++++------
editor/help-overlay.ui | 2 +-
editor/registry-view.ui | 43 ------------------
editor/registry-view.vala | 108 +--------------------------------------------
6 files changed, 20 insertions(+), 168 deletions(-)
---
diff --git a/editor/dconf-editor.ui b/editor/dconf-editor.ui
index 22b14d7..8989cfb 100644
--- a/editor/dconf-editor.ui
+++ b/editor/dconf-editor.ui
@@ -65,10 +65,9 @@
</child>
<child>
<object class="GtkToggleButton">
- <property name="visible">True</property>
+ <property name="visible">False</property>
<property name="valign">center</property>
<!-- TODO <property name="focus-on-click">False</property> does not work here because of
explicit focus grab -->
- <property name="active" bind-source="registry_view" bind-property="show-search-bar"
bind-flags="bidirectional|sync-create"/>
<!-- <accelerator key="F" signal="toggled" modifiers="GDK_CONTROL_MASK"/> TODO -->
<style>
<class name="image-button"/>
diff --git a/editor/dconf-model.vala b/editor/dconf-model.vala
index 8d63b1a..0d69947 100644
--- a/editor/dconf-model.vala
+++ b/editor/dconf-model.vala
@@ -533,11 +533,11 @@ public class GSettingsKey : Key
properties = builder.end ();
}
- public bool search_for (string text)
+/* public bool search_for (string text)
{
return summary.index_of (text) >= 0
|| description.index_of (text) >= 0; // TODO use the "in" keyword
- }
+ } */
}
public class SettingsModel : Object, Gtk.TreeModel
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index d5d678b..f980ab2 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -239,7 +239,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
+// registry_view.set_search_mode (false); // TODO not useful when called from bookmark
highcontrast = ("HighContrast" in Gtk.Settings.get_default ().gtk_theme_name);
registry_view.path_requested (full_name, pathbar.get_selected_child (full_name));
}
@@ -353,14 +353,14 @@ class DConfWindow : ApplicationWindow
registry_view.discard_row_popover ();
bookmarks_button.set_bookmarked (false);
return true;
- case "f":
- if (bookmarks_button.active)
- bookmarks_button.active = false;
- if (info_button.active)
- info_button.active = false;
- registry_view.discard_row_popover ();
- registry_view.set_search_mode (null);
- return true;
+// case "f":
+// if (bookmarks_button.active)
+// bookmarks_button.active = false;
+// if (info_button.active)
+// info_button.active = false;
+// registry_view.discard_row_popover ();
+// registry_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 ();
@@ -381,7 +381,7 @@ class DConfWindow : ApplicationWindow
case "KP_Enter":
if (info_button.active || bookmarks_button.active)
return false;
- registry_view.set_search_mode (false);
+// registry_view.set_search_mode (false);
registry_view.discard_row_popover ();
registry_view.toggle_boolean_key ();
return true;
@@ -393,7 +393,7 @@ class DConfWindow : ApplicationWindow
case "KP_Decimal":
if (info_button.active || bookmarks_button.active)
return false;
- registry_view.set_search_mode (false);
+// registry_view.set_search_mode (false);
registry_view.discard_row_popover ();
registry_view.set_to_default ();
return true;
@@ -444,17 +444,17 @@ class DConfWindow : ApplicationWindow
return true;
}
- if (bookmarks_button.active || info_button.active) // TODO open bug about modal popovers and
search_bar
+ if (bookmarks_button.active || info_button.active)
return false;
- return registry_view.handle_search_event (event);
+ return false; // registry_view.handle_search_event (event);
}
[GtkCallback]
private void on_menu_button_clicked ()
{
registry_view.discard_row_popover ();
- registry_view.set_search_mode (false);
+// registry_view.set_search_mode (false);
}
private void go_backward (bool shift)
diff --git a/editor/help-overlay.ui b/editor/help-overlay.ui
index a395c02..6f70f35 100644
--- a/editor/help-overlay.ui
+++ b/editor/help-overlay.ui
@@ -32,7 +32,7 @@
</child>
<child>
<object class="GtkShortcutsShortcut">
- <property name="visible">True</property>
+ <property name="visible">False</property>
<property name="title" translatable="yes" context="shortcut window">Search bar</property>
<property name="accelerator"><Primary>f</property>
</object>
diff --git a/editor/registry-view.ui b/editor/registry-view.ui
index 91e385c..dfb71cb 100644
--- a/editor/registry-view.ui
+++ b/editor/registry-view.ui
@@ -74,49 +74,6 @@
</object>
</child>
<child>
- <object class="GtkRevealer"> <!-- Workaround for the gtk+ bug:
https://bugzilla.gnome.org/show_bug.cgi?id=724096 -->
- <property name="visible">True</property>
- <property name="reveal-child" bind-source="search_bar" bind-property="search-mode-enabled"
bind-flags="bidirectional">False</property>
- <child>
- <object class="GtkSearchBar" id="search_bar">
- <property name="visible">True</property>
- <property name="search-mode-enabled">False</property>
- <property name="show-close-button">False</property>
- <child>
- <object class="GtkBox"> <!-- https://bugzilla.gnome.org/show_bug.cgi?id=769876 -->
- <property name="visible">True</property>
- <property name="orientation">horizontal</property>
- <style>
- <class name="linked"/>
- </style>
- <child>
- <object class="GtkSearchEntry" id="search_entry">
- <property name="visible">True</property>
- <property name="width-request">350</property>
- <signal name="activate" handler="find_next_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="search_next_button">
- <property name="visible">True</property>
- <signal name="clicked" handler="find_next_cb"/>
- <property name="sensitive" bind-source="search_bar" bind-property="search-mode-enabled"/>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-size">1</property>
- <property name="icon-name">go-down-symbolic</property>
- </object>
- </child>
- </object>
- </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 -->
diff --git a/editor/registry-view.vala b/editor/registry-view.vala
index 3401363..82f5f54 100644
--- a/editor/registry-view.vala
+++ b/editor/registry-view.vala
@@ -21,7 +21,6 @@ using Gtk;
class RegistryView : Grid, PathElement
{
public string current_path { get; private set; }
- public bool show_search_bar { get; set; }
public Behaviour behaviour { get; set; }
private GLib.Settings application_settings = new GLib.Settings ("ca.desrt.dconf-editor.Settings");
@@ -58,10 +57,6 @@ class RegistryView : Grid, PathElement
[GtkChild] private ModificationsRevealer revealer;
- [GtkChild] private SearchBar search_bar;
- [GtkChild] private SearchEntry search_entry;
- [GtkChild] private Button search_next_button;
-
private DConfWindow? _window = null;
private DConfWindow window {
get {
@@ -75,10 +70,6 @@ class RegistryView : Grid, PathElement
{
ulong revealer_reload_handler = revealer.reload.connect (invalidate_popovers);
- EntryBuffer buffer = search_entry.get_buffer ();
- ulong search_entry_buffer_deleted_text_handler = buffer.deleted_text.connect (() =>
search_next_button.set_sensitive (true));
- search_bar.connect_entry (search_entry);
- bind_property ("show-search-bar", search_bar, "search-mode-enabled", BindingFlags.BIDIRECTIONAL);
// TODO in UI file?
bind_property ("behaviour", revealer, "behaviour",
BindingFlags.BIDIRECTIONAL|BindingFlags.SYNC_CREATE);
sorting_options = new SortingOptions ();
@@ -89,8 +80,6 @@ class RegistryView : Grid, PathElement
destroy.connect (() => {
revealer.disconnect (revealer_reload_handler);
- buffer.disconnect (search_entry_buffer_deleted_text_handler);
-
base.destroy ();
});
}
@@ -188,7 +177,6 @@ class RegistryView : Grid, PathElement
[GtkCallback]
private void dir_selected_cb ()
{
- search_next_button.set_sensitive (true); // TODO better, or maybe just hide search_bar 1/2
Directory dir = get_selected_directory ();
dir.sort_key_model (sorting_options);
key_model = dir.key_model;
@@ -434,8 +422,6 @@ class RegistryView : Grid, PathElement
[GtkCallback]
private void row_activated_cb (ListBoxRow list_box_row)
{
- search_next_button.set_sensitive (true); // TODO better, or maybe just hide search_bar 2/2
-
((ClickableListBoxRow) list_box_row.get_child ()).on_row_clicked ();
}
@@ -548,7 +534,7 @@ class RegistryView : Grid, PathElement
* * Keyboard calls
\*/
- public void set_search_mode (bool? mode) // mode is never 'true'...
+/* public void set_search_mode (bool? mode) // mode is never 'true'...
{
if (mode == null)
search_bar.set_search_mode (!search_bar.get_search_mode ());
@@ -562,7 +548,7 @@ class RegistryView : Grid, PathElement
return false;
return search_bar.handle_event (event);
- }
+ } */
public bool show_row_popover ()
{
@@ -631,96 +617,6 @@ class RegistryView : Grid, PathElement
return (ListBoxRow?) key_list_box.get_selected_row ();
}
- /*\
- * * Search box
- \*/
-
- [GtkCallback]
- private void find_next_cb ()
- {
- if (!search_bar.get_search_mode ()) // TODO better; switches to next list_box_row when
keyboard-activating an entry of the popover
- return;
-
- TreeIter iter;
- bool on_first_directory;
- int position = 0;
- if (dir_tree_selection.get_selected (null, out iter))
- {
- ListBoxRow? selected_row = (ListBoxRow) key_list_box.get_selected_row ();
- if (selected_row != null)
- position = ((!) selected_row).get_index () + 1;
-
- on_first_directory = true;
- }
- else if (model.get_iter_first (out iter))
- on_first_directory = false;
- else
- return; // TODO better
-
- do
- {
- Directory dir = model.get_directory (iter);
-
- if (!on_first_directory)
- {
- if (dir.name.index_of (search_entry.text) >= 0)
- {
- dir_tree_selection.select_iter (iter);
- show_browse_view (dir.full_name, null, false);
- return;
- }
- }
- else
- on_first_directory = false;
-
- /* Select next key that matches */
- dir.sort_key_model (sorting_options);
- GLib.ListStore key_model = dir.key_model;
- while (position < key_model.get_n_items ())
- {
- SettingObject object = (SettingObject) key_model.get_object (position);
- if (object.name.index_of (search_entry.text) >= 0)
- {
- dir_tree_selection.select_iter (iter);
- key_list_box.select_row (key_list_box.get_row_at_index (position));
- show_browse_view (dir.full_name, object.full_name, false);
- return;
- }
- else if (object is Key)
- {
- Key key = (Key) object;
- if ((key is GSettingsKey || !((DConfKey) key).is_ghost) && key_matches (key,
search_entry.text))
- { // TODO use request_path (object.full_name); problem with hiding or not the pathbar
- properties_view.populate_properties_list_box (key);
- dir_tree_selection.select_iter (iter);
- key_list_box.select_row (key_list_box.get_row_at_index (position));
- show_properties_view (object.full_name);
- return;
- }
- }
- position++;
- }
-
- position = 0;
- }
- while (get_next_iter (ref iter));
-
- search_next_button.set_sensitive (false);
- }
-
- private bool key_matches (Key key, string text)
- {
- /* Check in key's metadata */
- if (key is GSettingsKey && ((GSettingsKey) key).search_for (text))
- return true;
-
- /* Check key value */
- if (key.value.is_of_type (VariantType.STRING) && key.value.get_string ().index_of (text) >= 0)
- return true;
-
- return false;
- }
-
private bool get_next_iter (ref TreeIter iter)
{
/* Search children next */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]