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 162531 - GtkComboBox 'popup' signal missing
GtkComboBox 'popup' signal missing
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkComboBox
2.6.x
Other Linux
: Low enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
: 162802 318514 318826 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-12-30 12:30 UTC by danny.milo
Modified: 2011-02-04 16:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
add "popup-show" and "popup-hide" signals (4.41 KB, patch)
2005-08-19 19:09 UTC, Tommi Komulainen
none Details | Review
implement property instead (5.06 KB, patch)
2006-01-19 22:31 UTC, Christian Persch
reviewed Details | Review

Description danny.milo 2004-12-30 12:30:10 UTC
1. Have a combobox model read from some slow source, i. e. a database, a 
internet source..
2. Thus want the combobox only to refresh on 'opening the dropdown' (and look 
for additional entries then)
3. hmm O_o no signal for that
Comment 1 Matthias Clasen 2005-01-03 13:31:28 UTC
*** Bug 162802 has been marked as a duplicate of this bug. ***
Comment 2 Murray Cumming 2005-02-02 23:37:14 UTC
I don't think you would want the whole UI to block on a slow database connection
 when someone clicks on a ComboBox. Why can't you update the list in the
background, as soon as you get enough information? This signal might be needed,
but this doesn't sound like the necessary use case yet.
Comment 3 Gian Mario Tagliaretti 2005-02-03 12:15:16 UTC
Mine was just an example but as you said there are a lot of situations where
this can be really useful.
Comment 4 Greg Breland 2005-02-03 15:35:22 UTC
Actually, compared to the alternatives, its prefered to block the UI on a slow
database connection when someone clicks on a combobox rather than populate all
the data.  The main Account screen for my software has 14 combobox type fields.
 Binding all these fields to the database when opening the form would slow
everthing down a lot.  Most of the time, 14 queries to the DB would be executed
for no reason as the user is just viewing the data, not changing it.
Comment 5 danny.milo 2005-02-03 20:41:34 UTC
Well said.

And note that one can always fine tune the populating:
- connect "clicked", to a handler clicked_cb
- in clicked_cb, check if timer a (or thread a, doesnt matter) is running, and 
if not, start it, handler timer_cb
- in timer_cb, read the data chunkwise
  when finished remove timer a

This has the effect that when the user clicks on the combo, the data is started 
to be read (note that the combo dropdown is open now). As the read advances, 
entries get added (with a "..." node advancing at the end to signal that). When 
the read finished, the "..." node is removed. The user can, at any stage, select 
an entry from the combo (which doesnt stop the read because it may need it 
either way)

How does that sound ?

Comment 6 Tommi Komulainen 2005-08-19 19:09:01 UTC
Created attachment 50995 [details] [review]
add "popup-show" and "popup-hide" signals

Reasoning for adding signals for both showing and hiding is that if you are
interested in knowing when the menu pops up, you probably also want to know
when it goes away.

The patch as such needs work as it's breaking binary compatibility and has
minor cosmetic issues as well.
Comment 7 danny.milo 2005-09-09 16:14:30 UTC
just remove some of the padding for future expansion and it will be binary
compatible ;)
Comment 8 Tommi Komulainen 2005-09-11 11:24:53 UTC
I'm not worried about binary compatibility, fixing it is trivial.

The devil is in the details, should it be two signals, one signal with boolean
parameter, one signal with no parameters but getter function, read-only
property, ...?
Comment 9 Tommi Komulainen 2005-09-20 12:17:43 UTC
I've been told "grab-notify" signal could be used instead in some case at least.
Comment 10 Matthias Clasen 2005-10-11 03:14:16 UTC
*** Bug 318514 has been marked as a duplicate of this bug. ***
Comment 11 Matthias Clasen 2005-10-26 18:26:09 UTC
*** Bug 318826 has been marked as a duplicate of this bug. ***
Comment 12 Matthias Clasen 2005-11-10 21:17:24 UTC
2005-11-10  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkcombobox.c: Add show-popup and hide-popup signals and
	emit them when the popup is shown or hidden.  (#162531, Tommi
	Komulainen)
Comment 13 Christian Persch 2006-01-18 18:30:42 UTC
I think this should be redone using a property instead: with signals, you have to track both show and hide and store the state yourself, if you want to access it later; and it wouldn't use 2 reserved slots.
If I wrote a patch making this use a property instead, would it be accepted?
Comment 14 Matthias Clasen 2006-01-19 21:43:55 UTC
It would be considered
Comment 15 Christian Persch 2006-01-19 22:31:46 UTC
Created attachment 57677 [details] [review]
implement property instead

Things to consider:
- make it readonly property maybe?
- I didn't add a public getter, and there's already gtk_combo_box_popup and _popdown available, so a public setter doesn't make sense either, probably.
Comment 16 Matthias Clasen 2006-01-20 15:35:08 UTC
Yes, I think a readonly property is better, and not having a getter is probably
fine. You might want to point out in the docs that the property is mostly useful for listening for change notification. It looks slightly odd to me that the property is named "-popup", but the docs speak about a "dropdown".


Comment 17 Matthias Clasen 2006-03-14 19:53:54 UTC
2006-03-09  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkcombobox.c (gtk_combo_box_class_init): Replace the
	popup-show and popup-hide signals with a readonly popup-shown
	property.  (#162531, Christian Persch)