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 666683 - gtk_menu_reorder_child should send a signal to notify interested parties
gtk_menu_reorder_child should send a signal to notify interested parties
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkMenu
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2011-12-21 19:06 UTC by Michael Terry
Modified: 2018-04-15 00:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (8.31 KB, patch)
2012-09-18 01:03 UTC, Michael Terry
none Details | Review
Add "position" child property to track GtkMenuShell children (8.29 KB, patch)
2014-03-26 17:51 UTC, Iain Lane
none Details | Review

Description Michael Terry 2011-12-21 19:06:34 UTC
Hello!  gtk_menu_reorder_child just quietly does its work and updates the way the widget is drawn.  I think it would be nicer if it also sent out a signal when it happened.

A) It would be analogous to "add" and "remove" signals.
B) It seems common to have calls that change the visible state of a widget cause a signal (even if just a "notify::" one).
C) There are consumers today that would be interested.  I noticed because I was pointed at a bug [1] in libdbusmenu due to this.

If ya'll agree that would be a good thing, I can work on whipping up a patch.  Maybe a signal like "void reordered (GtkMenu *menu, GtkWidget *child, int old_pos, int new_pos, gpointer data)" ?

[1] https://bugs.launchpad.net/dbusmenu/+bug/785852
Comment 1 Claudio Saavedra 2012-01-31 15:01:12 UTC
I'd say you need a "position" child property and use the "child-notify::position" signal?
Comment 2 Michael Terry 2012-09-18 01:03:28 UTC
Created attachment 224566 [details] [review]
Proposed patch

How about this?

It does not emit a signal on add or removal of items, but does emit a child-notify whenever an item changes position due to add/removal/reorder of other items.

I figured it was best to not keep track of position state separately, since that might easily get out of sync, so I calculate the position of an item upon request.  Seems like a request that won't happen often, and I'd rather optimize for maintainability in this case.
Comment 3 Iain Lane 2014-03-26 17:51:55 UTC
Created attachment 273014 [details] [review]
Add "position" child property to track GtkMenuShell children
Comment 4 Iain Lane 2014-03-26 17:52:44 UTC
I did a noddy update to get this to apply on trunk - please review.
Comment 5 Matthias Clasen 2018-02-10 05:16:40 UTC
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
Comment 6 Matthias Clasen 2018-04-15 00:09:30 UTC
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla.

If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab:

https://gitlab.gnome.org/GNOME/gtk/issues/new