Merge lp:~donadigo/switchboard/plug-use-search-entry into lp:~elementary-pantheon/switchboard/switchboard

Proposed by Adam Bieńkowski
Status: Rejected
Rejected by: Cody Garver
Proposed branch: lp:~donadigo/switchboard/plug-use-search-entry
Merge into: lp:~elementary-pantheon/switchboard/switchboard
Diff against target: 76 lines (+24/-5)
2 files modified
lib/Plug.vala (+12/-1)
src/Switchboard.vala (+12/-4)
To merge this branch: bzr merge lp:~donadigo/switchboard/plug-use-search-entry
Reviewer Review Type Date Requested Status
Corentin Noël Needs Fixing
Switchboard Hackers Pending
Review via email: mp+257461@code.launchpad.net

Description of the change

Proivde use_search_entry in the Switchboard.Plug abstract class to set switchboard's plug entry sensitive and also search_entry_changed (text) to inform the plug that the entry has changed.

Used in shortcuts searching in keyboard plug:
https://code.launchpad.net/~donadigo/switchboard-plug-keyboard/search-shortcuts

To post a comment you must log in.
Revision history for this message
Corentin Noël (tintou) wrote :

This does already the job :

public abstract async Gee.TreeMap<string, string> search (string search);

indeed, our client doesn't make use of this right now, but here is how it should work:
 * When the search entry is changed, it calls this search function with the search string
 * The TreeMap contains some "Keyboard → Behavior → Duration", "keyboard<sep>behavior" if there are result, otherwise it is empty.
So it is up to the client to show the search results, but it's currently not implemented in the client.

review: Needs Fixing

Unmerged revisions

557. By Adam Bieńkowski

Provide use_search_entry key and search_entry_changed in library in order to use search entry directly in the plugs

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/Plug.vala'
2--- lib/Plug.vala 2014-11-04 23:12:02 +0000
3+++ lib/Plug.vala 2015-04-25 13:34:27 +0000
4@@ -67,6 +67,12 @@
5 * Inform if the plug should be shown or not
6 */
7 public bool can_show { get; set; default=true;}
8+
9+ /**
10+ * Makes entry sensitive in order
11+ * to use it in plugs.
12+ */
13+ public bool use_search_entry { get; set; default=false; }
14
15 /**
16 * Inform the application that the plug can now be listed in the available plugs
17@@ -74,6 +80,11 @@
18 public signal void visibility_changed ();
19
20 /**
21+ * Inform the plug that the text in search entry has changed
22+ */
23+ public signal void search_entry_changed (string text);
24+
25+ /**
26 * Returns the widget that contain the whole interface.
27 *
28 * @return a {@link Gtk.Widget} containing the interface.
29@@ -108,4 +119,4 @@
30 * @param location a {@link string} that represents the setting to show.
31 */
32 public abstract void search_callback (string location);
33-}
34\ No newline at end of file
35+}
36
37=== modified file 'src/Switchboard.vala'
38--- src/Switchboard.vala 2015-04-09 08:46:22 +0000
39+++ src/Switchboard.vala 2015-04-25 13:34:27 +0000
40@@ -362,7 +362,11 @@
41 stack.set_transition_type (Gtk.StackTransitionType.SLIDE_LEFT_RIGHT);
42 }
43
44- search_box.sensitive = false;
45+ if (plug.use_search_entry)
46+ search_box.sensitive = true;
47+ else
48+ search_box.sensitive = false;
49+
50 plug.shown ();
51 stack.set_visible_child_name (plug.code_name);
52 category_scrolled.hide ();
53@@ -402,7 +406,11 @@
54 search_box.margin_right = 5;
55 search_box.sensitive = false;
56 search_box.changed.connect(() => {
57- category_view.filter_plugs(search_box.get_text ());
58+ // Check if the current plug is visible and uses search entry
59+ if ((stack.get_visible_child_name () == current_plug.code_name && current_plug.use_search_entry))
60+ current_plug.search_entry_changed (search_box.get_text ());
61+ else
62+ category_view.filter_plugs(search_box.get_text ());
63 });
64 search_box.key_press_event.connect ((event) => {
65 if (event.keyval == Gdk.Key.Return) {
66@@ -431,8 +439,8 @@
67 if (event.keyval in NAVIGATION_KEYS)
68 return false;
69
70- // Don't focus if it is a modifier or if search_box is already focused
71- if ((event.is_modifier == 0) && !search_box.has_focus)
72+ // Don't focus if it is a modifier, if search_box is already focused or the current plug is active
73+ if ((event.is_modifier == 0) && !search_box.has_focus && stack.get_visible_child_name () != current_plug.code_name)
74 search_box.grab_focus ();
75
76 return false;

Subscribers

People subscribed via source and target branches

to all changes: