After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 681089 - Add search bar
Add search bar
Status: RESOLVED FIXED
Product: gnome-boxes
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: --
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-08-02 18:18 UTC by Marc-Andre Lureau
Modified: 2016-03-31 14:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Removing debug message (803 bytes, patch)
2012-08-02 18:18 UTC, Marc-Andre Lureau
accepted-commit_now Details | Review
revealer: learn to resize actor allocation too (2.52 KB, patch)
2012-08-02 18:18 UTC, Marc-Andre Lureau
accepted-commit_now Details | Review
revealer: add read/write revealed property (3.73 KB, patch)
2012-08-02 18:18 UTC, Marc-Andre Lureau
reviewed Details | Review
libgd: import some widgets from gnome-documents (57.37 KB, patch)
2012-08-02 18:18 UTC, Marc-Andre Lureau
accepted-commit_now Details | Review
libgd: generate gd-1.0.vapi binding (3.00 KB, patch)
2012-08-02 18:18 UTC, Marc-Andre Lureau
accepted-commit_now Details | Review
Insert items in collection not in the view (1.18 KB, patch)
2012-08-02 18:18 UTC, Marc-Andre Lureau
accepted-commit_now Details | Review
collection-view: use a filtered model (4.37 KB, patch)
2012-08-02 18:19 UTC, Marc-Andre Lureau
reviewed Details | Review
collection-view: add an activate method (1.08 KB, patch)
2012-08-02 18:19 UTC, Marc-Andre Lureau
reviewed Details | Review
topbar: simplify and generalize a function (1.53 KB, patch)
2012-08-02 18:19 UTC, Marc-Andre Lureau
accepted-commit_now Details | Review
topbar: add a search button (2.02 KB, patch)
2012-08-02 18:19 UTC, Marc-Andre Lureau
reviewed Details | Review
search: add a search bar (9.65 KB, patch)
2012-08-02 18:19 UTC, Marc-Andre Lureau
reviewed Details | Review
revealer: add read/write revealed property (3.81 KB, patch)
2012-08-08 20:34 UTC, Marc-Andre Lureau
accepted-commit_now Details | Review

Description Marc-Andre Lureau 2012-08-02 18:18:37 UTC
The searchbar is based on current gnome-documents behaviour and
style, as well as the same GtkWidget code shared in libgd.

It will search as you type and filter the boxes. You can activate
the result if there is only a single match currently (I am not sure
that's what the design says).

Anyway, it's hopefully a good and useful first iteration.
Comment 1 Marc-Andre Lureau 2012-08-02 18:18:40 UTC
Created attachment 220171 [details] [review]
Removing debug message
Comment 2 Marc-Andre Lureau 2012-08-02 18:18:44 UTC
Created attachment 220172 [details] [review]
revealer: learn to resize actor allocation too
Comment 3 Marc-Andre Lureau 2012-08-02 18:18:47 UTC
Created attachment 220173 [details] [review]
revealer: add read/write revealed property
Comment 4 Marc-Andre Lureau 2012-08-02 18:18:50 UTC
Created attachment 220174 [details] [review]
libgd: import some widgets from gnome-documents

These files should be kept in sync with upstream, if possible.
That's why I also left the trailing white spaces.
Comment 5 Marc-Andre Lureau 2012-08-02 18:18:54 UTC
Created attachment 220175 [details] [review]
libgd: generate gd-1.0.vapi binding
Comment 6 Marc-Andre Lureau 2012-08-02 18:18:57 UTC
Created attachment 220176 [details] [review]
Insert items in collection not in the view

The view might show a filtered or different version.
Comment 7 Marc-Andre Lureau 2012-08-02 18:19:00 UTC
Created attachment 220177 [details] [review]
collection-view: use a filtered model

Learn to filter the view by using the model_visible () callback,
using the app.filter Boxes.CollectionFilter to contain the current
filtering criterias.
Comment 8 Marc-Andre Lureau 2012-08-02 18:19:03 UTC
Created attachment 220178 [details] [review]
collection-view: add an activate method

When then search entry is pressed, we want to activate whatever item
is matching the search, to open it (start and show display).
Comment 9 Marc-Andre Lureau 2012-08-02 18:19:07 UTC
Created attachment 220179 [details] [review]
topbar: simplify and generalize a function

Rename update_select_btn_sensitivity () to update_select_btn () since
it could perform and other UI changes, and we want name consitency
with other similar UI update functions.
Comment 10 Marc-Andre Lureau 2012-08-02 18:19:10 UTC
Created attachment 220180 [details] [review]
topbar: add a search button

The button is active whenever the search bar is visible
Comment 11 Marc-Andre Lureau 2012-08-02 18:19:14 UTC
Created attachment 220181 [details] [review]
search: add a search bar

The searchbar is based on current gnome-documents behaviour and style,
as well as the same GtkWidget code shared in libgd.

It will search as you type and filter the boxes. You can activate the
result if there is only a single match currently (I am not sure that's
what the design says).

Anyway, it's hopefully a good and useful first iteration.
Comment 12 André Klapper 2012-08-03 11:26:33 UTC
(In reply to comment #11)
> Created an attachment (id=220181) [details] [review]
> search: add a search bar
> 
> The searchbar is based on current gnome-documents behaviour and style,
> as well as the same GtkWidget code shared in libgd.

Free cookies if the search bar is consistent with other applications. 
Currently it's a mess in GNOME. (bug 672394, bug 661564)
Comment 13 Marc-Andre Lureau 2012-08-03 13:55:01 UTC
(In reply to comment #12)
> (In reply to comment #11)
> > Created an attachment (id=220181) [details] [review] [details] [review]
> > search: add a search bar
> > 
> > The searchbar is based on current gnome-documents behaviour and style,
> > as well as the same GtkWidget code shared in libgd.
> 
> Free cookies if the search bar is consistent with other applications. 
> Currently it's a mess in GNOME. (bug 672394, bug 661564)

I used the information I gathered during GUADEC, but I think we should not hold this feature until the design is "finalizes". We can fix the remaining style/behaviour issues in the following releases.
Comment 14 Zeeshan Ali 2012-08-04 17:13:49 UTC
Review of attachment 220171 [details] [review]:

ACK
Comment 15 Zeeshan Ali 2012-08-08 19:25:36 UTC
Review of attachment 220172 [details] [review]:

I might be able to give a verdict here if you could add a bit more detail in the log: Whats the current behaviour and why this change is needed.
Comment 16 Marc-Andre Lureau 2012-08-08 20:06:25 UTC
Review of attachment 220172 [details] [review]:

the patch doesn't change behaviour unless resize is set to true, if true then we change the actor allocation before/during animation, so that it takes 0 space when unrevealed, and its  max(children) when revealed. This allows to put the search bar between 2 actors and actually "grow"/"shrink" the allocation between them when revealed/unrevealed
Comment 17 Zeeshan Ali 2012-08-08 20:11:42 UTC
Review of attachment 220173 [details] [review]:

So if i understood correct, 'revealed' is target state and '_visible' is current state? Why do we need to differentiate?

::: src/revealer.vala
@@ +4,3 @@
 public class Boxes.Revealer: Clutter.Actor {
     private bool horizontal;
+    private bool _visible;

i thought we don't do '_' prefixing for private fields except for place-holders for props (like _revealed below).
Comment 18 Zeeshan Ali 2012-08-08 20:15:53 UTC
Review of attachment 220174 [details] [review]:

Hm.. I understood in GNOME OS BoF that Cosimo will make this availble as a module for apps to use as submodule. Have you asked cosimo if he is gonna do that soon?
Comment 19 Zeeshan Ali 2012-08-08 20:21:56 UTC
Review of attachment 220175 [details] [review]:

Looks good. ACK if/when the dependent patch is ACK'ed.
Comment 20 Zeeshan Ali 2012-08-08 20:25:05 UTC
Review of attachment 220176 [details] [review]:

Seems right.
Comment 21 Zeeshan Ali 2012-08-08 20:25:20 UTC
Review of attachment 220176 [details] [review]:

Seems right.
Comment 22 Marc-Andre Lureau 2012-08-08 20:30:07 UTC
(In reply to comment #17)
> Review of attachment 220173 [details] [review]:
> 
> So if i understood correct, 'revealed' is target state and '_visible' is
> current state? Why do we need to differentiate?
> 
> ::: src/revealer.vala
> @@ +4,3 @@
>  public class Boxes.Revealer: Clutter.Actor {
>      private bool horizontal;
> +    private bool _visible;
> 
> i thought we don't do '_' prefixing for private fields except for place-holders
> for props (like _revealed below).

There is a parent visible property clashing. I suggest we rename this _visible in children_visible instead.
Comment 23 Marc-Andre Lureau 2012-08-08 20:31:04 UTC
(In reply to comment #18)
> Review of attachment 220174 [details] [review]:
> 
> Hm.. I understood in GNOME OS BoF that Cosimo will make this availble as a
> module for apps to use as submodule. Have you asked cosimo if he is gonna do
> that soon?

I actually discussed that several time with Cosimo, and I guess he might even be waiting for me to do it. But not just yet, because libgd is actually a bunch of things that we need to clean up first, and that was not my goal here.
Comment 24 Marc-Andre Lureau 2012-08-08 20:34:23 UTC
Created attachment 220733 [details] [review]
revealer: add read/write revealed property
Comment 25 Christophe Fergeau 2012-08-08 20:38:32 UTC
(In reply to comment #23)
> (In reply to comment #18)
> > Review of attachment 220174 [details] [review] [details]:
> > 
> > Hm.. I understood in GNOME OS BoF that Cosimo will make this availble as a
> > module for apps to use as submodule. Have you asked cosimo if he is gonna do
> > that soon?
> 
> I actually discussed that several time with Cosimo, and I guess he might even
> be waiting for me to do it. But not just yet, because libgd is actually a bunch
> of things that we need to clean up first, and that was not my goal here.

Yup, he was hoping for you to do it ;)
Comment 26 Zeeshan Ali 2012-08-08 20:43:29 UTC
Review of attachment 220177 [details] [review]:

Looks good otherwise.

::: src/collection-view.vala
@@ -237,0 +241,13 @@
+
+    private CollectionItem get_item_for_path (Gtk.TreePath path) {
+        Gtk.TreeIter filter_iter, iter;
... 10 more ...

I'd keep this code agnostic of filtering itself and have a function like this in CollectionFilter to call from here: public bool item_qualifies (CollectionItem item);
Comment 27 Zeeshan Ali 2012-08-08 20:43:42 UTC
Review of attachment 220177 [details] [review]:

Looks good otherwise.

::: src/collection-view.vala
@@ -237,0 +241,13 @@
+
+    private CollectionItem get_item_for_path (Gtk.TreePath path) {
+        Gtk.TreeIter filter_iter, iter;
... 10 more ...

I'd keep this code agnostic of filtering itself and have a function like this in CollectionFilter to call from here: public bool item_qualifies (CollectionItem item);
Comment 28 Zeeshan Ali 2012-08-08 20:47:13 UTC
Review of attachment 220178 [details] [review]:

* In the log
  * 'when then' -> 'when'.
  * 'entry is pressed' -> 'entry is activated' ?

* You are not using this method while the log suggests that you do?
Comment 29 Zeeshan Ali 2012-08-08 21:00:32 UTC
Review of attachment 220179 [details] [review]:

* Log
  * 'simplify and generalize a function' -> 'simplify & generalize a function name'
  * 'could perform and' -> 'could perform' ?
  * consitency -> consistency

Otherwise good. Please remember to fix the commit log before pushing this time. :)
Comment 30 Zeeshan Ali 2012-08-08 21:03:04 UTC
Review of attachment 220180 [details] [review]:

* Log
  * active -> activated ?
* Button appears joined to the selection button. Adding some padding/space in btw?

Looks good otherwise.
Comment 31 Zeeshan Ali 2012-08-08 21:42:09 UTC
Review of attachment 220181 [details] [review]:

I'm assuming that this patch apears after the 'search button' patch only in bz? If not, you want to swap the order of these patches.

"Anyway, it's hopefully a good and useful first iteration."

actually, iIts an awesome first iteration. :)

::: src/searchbar.vala
@@ +7,3 @@
+
+    private uint refilter_delay_id;
+    static const uint refilter_delay = 200; // in ms

10 points for commenting about units but 'm' could mean 'milli' or 'micro' so better specificy 'milliseconds'.

@@ +31,3 @@
+        App.app.view.refilter ();
+        refilter_delay_id = 0;
+        return false;

coding-style nitpick: return on new line.

@@ +57,3 @@
+
+    public void grab_focus () {
+            Gd.entry_focus_hack (entry, Gtk.get_current_event_device ());

nitpick: indented twice as usual..

@@ +121,3 @@
+        entry = new Gd.TaggedEntry ();
+        entry.width_request = 260;
+        // entry.no_show_all = true;

commented out code without any explanation of why its desired and why its commented out is never good IMHO.
Comment 32 Zeeshan Ali 2012-08-08 21:44:52 UTC
Review of attachment 220172 [details] [review]:

ok, ACK!
Comment 33 Zeeshan Ali 2012-08-08 21:47:14 UTC
Review of attachment 220174 [details] [review]:

Fair enough.
Comment 34 Christophe Fergeau 2012-08-08 21:48:50 UTC
Review of attachment 220181 [details] [review]:

::: src/searchbar.vala
@@ +7,3 @@
+
+    private uint refilter_delay_id;
+    static const uint refilter_delay = 200; // in ms

m is milli, u or µ is micro, no ambiguity there.
Comment 35 Zeeshan Ali 2012-08-08 23:37:06 UTC
Review of attachment 220733 [details] [review]:

Renaming also answered my other question about this patch. Cheers for good names.
Comment 36 Zeeshan Ali 2012-08-08 23:39:03 UTC
Review of attachment 220181 [details] [review]:

::: src/searchbar.vala
@@ +7,3 @@
+
+    private uint refilter_delay_id;
+    static const uint refilter_delay = 200; // in ms

If Christophe thinks there is no abmiguity, there probably isn't. :)
Comment 37 Marc-Andre Lureau 2012-08-09 11:50:50 UTC
Review of attachment 220177 [details] [review]:

::: src/collection-view.vala
@@ -237,0 +241,13 @@
+
+    private CollectionItem get_item_for_path (Gtk.TreePath path) {
+        Gtk.TreeIter filter_iter, iter;
... 10 more ...

done
Comment 38 Marc-Andre Lureau 2012-08-09 11:53:38 UTC
Review of attachment 220178 [details] [review]:

done
Comment 39 Marc-Andre Lureau 2012-08-09 11:55:50 UTC
Review of attachment 220180 [details] [review]:

technically the propert is named "active", but activated is perhaps better in the log.

The styling/spacing is fixed with the usage of Gd.MainToolbar (not part of this bug)
Comment 40 Marc-Andre Lureau 2012-08-09 11:58:26 UTC
Review of attachment 220181 [details] [review]:

::: src/searchbar.vala
@@ +31,3 @@
+        App.app.view.refilter ();
+        refilter_delay_id = 0;
+        return false;

done

@@ +57,3 @@
+
+    public void grab_focus () {
+            Gd.entry_focus_hack (entry, Gtk.get_current_event_device ());

done

@@ +121,3 @@
+        entry = new Gd.TaggedEntry ();
+        entry.width_request = 260;
+        // entry.no_show_all = true;

removed
Comment 41 Marc-Andre Lureau 2012-08-09 12:02:58 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
Comment 42 Christophe Fergeau 2012-08-14 08:45:52 UTC
diff --git a/libgd/Makefile.am b/libgd/Makefile.am
index 84f978d..a5e8fda 100644
--- a/libgd/Makefile.am
+++ b/libgd/Makefile.am
@@ -71,11 +71,12 @@ VAPIS = gd-1.0.vapi
 BUILT_SOURCES = $(VAPIS)

 gd-1.0.vapi: $(builddir)/Gd-1.0.gir
-       $(AM_V_GEN)$(VAPIGEN)                   \
-               --library gd-1.0                \
-               --pkg gio-2.0                   \
-               --pkg gobject-2.0               \
-               --pkg gtk+-3.0                  \
+       $(AM_V_GEN)$(VAPIGEN)                           \
+               --vapidir=$(top_srcdir)/vapi/upstream   \
+               --library gd-1.0                        \
+               --pkg gio-2.0                           \
+               --pkg gobject-2.0                       \
+               --pkg gtk+-3.0                          \
                $<

 EXTRA_DIST = $(VAPIS)


is needed to fix compilation with vala 0.16
Comment 43 Christophe Fergeau 2012-08-14 09:26:24 UTC
And I sometimes get build failures on fresh git clones with parallel make, make complains about libcommon.h not existing, I think something like this is needed:

diff --git a/src/Makefile.am b/src/Makefile.am
index 99a1008..d3011ab 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -56,7 +56,7 @@ libcommon_a_SOURCES =                         \

 libcommon_a_CFLAGS = $(BOXES_COMMON_CFLAGS)

-libcommon_vala.stamp common.vapi: $(libcommon_a_VALASOURCES)
+libcommon_vala.stamp common.vapi libcommon.h: $(libcommon_a_VALASOURCES)
        $(AM_V_VALAC)$(VALAC) $(VALAFLAGS) $(VALA_DEBUG_FLAGS)  \
        --enable-experimental                                   \
        --vapidir=$(srcdir)/                                    \
Comment 44 Marc-Andre Lureau 2012-08-14 09:39:19 UTC
ack, feel free to commit build-sys fixes.