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 738493 - Support GtkSearchBar
Support GtkSearchBar
Status: RESOLVED FIXED
Product: glade
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Glade 3 Maintainers
Glade 3 Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-10-14 02:12 UTC by Matthias Clasen
Modified: 2014-10-26 14:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Support GtkSearchBar (8.88 KB, patch)
2014-10-14 02:12 UTC, Matthias Clasen
none Details | Review

Description Matthias Clasen 2014-10-14 02:12:23 UTC
This widget has been around since 3.10, high time that glade
starts supporting it.
Comment 1 Matthias Clasen 2014-10-14 02:12:26 UTC
Created attachment 288429 [details] [review]
Support GtkSearchBar
Comment 2 Tristan Van Berkom 2014-10-14 09:52:17 UTC
Was about to try this out, seems that the patch does not apply at all here.

Applying: Support GtkSearchBar
/home/tristan/GNOME/glade/.git/rebase-apply/patch:50: trailing whitespace.
 * You should have received a copy of the GNU Lesser General Public 
/home/tristan/GNOME/glade/.git/rebase-apply/patch:96: trailing whitespace.
  return TRUE; 
error: patch failed: plugins/gtk+/Makefile.am:101
error: plugins/gtk+/Makefile.am: patch does not apply
error: patch failed: plugins/gtk+/gtk+.xml.in:5180
error: plugins/gtk+/gtk+.xml.in: patch does not apply
Patch failed at 0001 Support GtkSearchBar

Oddly, I get this from master as well as from your headerbar branch :-/
Comment 3 Matthias Clasen 2014-10-14 17:50:34 UTC
sorry about that; pushed a searchbar branch now
Comment 4 Tristan Van Berkom 2014-10-23 11:45:54 UTC
Tried out the searchbar.

All around support seems good, except I'm not sure about the bit about
showing/hiding it in Glade's UI.

In your patch, I find this:

+        <properties>
+          <property id="search-mode-enabled" save="False" default="True"/>
+        </properties>

Which means you cannot set the search bar to be 'enabled' (visible) by default,
since 'save' is set to false.

What we generally do in Glade is make sure everything is always visible
(i.e. the GtkWidget 'visible' property can be set in Glade, it will be
saved but it will not disappear from the workspace, where one might need
to design the components of an initially invisible widget).

What I think would be most consistent and useful for using this in Glade
would probably be:

  o Allow the user to set the search-mode-enabled property for the initial
    intended state of the widget (unless that is somehow not useful at all,
    or somehow undesirable... in which case we can disable it completely).

  o In glade_gtk_search_bar_post_create(), make sure that the searchbar
    is visible initially at any time it's created

  o Also in glade_gtk_search_bar_post_create(), connect to a searchbar
    signal which indicates that the searchbar disappeared, or might
    disappear.

    Whenever the user (of Glade) clicks on the close button which might
    be showing if the "show-close-button" property is enabled, make sure
    that it does not cause the search bar to disappear

An alternative to that last point would be to simply disable the close
button in the workspace altogether, but still allow the user to set
the value, that could be done with the following steps:

  o In the gtk+.xml.in definition, make the workspace widgets ignore
    the project data (never apply the setting to the object):

       <property id="show-close-button" ignore="True"/>

  o In glade_gtk_search_bar_post_create(), make sure the close button
    is not showing.
Comment 5 Matthias Clasen 2014-10-23 16:34:30 UTC
thanks for the review, I'll loook at doing those things over the weekend.
Comment 6 Matthias Clasen 2014-10-25 22:38:49 UTC
I've pushed a new branch with a few more commits. It does the Ignore-thing for show-close-button and search-mode. Also added a get_children implementation to make saving children work.
Comment 7 Tristan Van Berkom 2014-10-26 14:12:34 UTC
Comment on attachment 288429 [details] [review]
Support GtkSearchBar

Patch itself is obsolete, review was done on the searchbar branch
Comment 8 Tristan Van Berkom 2014-10-26 14:15:16 UTC
(In reply to comment #6)
> I've pushed a new branch with a few more commits. It does the Ignore-thing for
> show-close-button and search-mode. Also added a get_children implementation to
> make saving children work.

Thanks, I've looked it over and tried a bunch of things, seems to work well as
far as I can tell.

I added a patch to avoid critical messages when loading a project with
searchbar children (the current code assumed that one child already existed).

Also I made a small fix the the "Add Parent" widget action as it was making
the assumption of the logical widget hierarchy making sense, so now doing
Right Click -> Add Parent on the child of a searchbar also works.

Merged the branch to master, thanks for your attention and work on this :)