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 103456 - New function gtk_widget_get_mnemonic_labels() requested.
New function gtk_widget_get_mnemonic_labels() requested.
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
2.1.x
Other Solaris
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
AP2
: 72251 79327 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2003-01-14 11:41 UTC by padraig.obriain
Modified: 2011-02-04 16:12 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Proposed patch (5.38 KB, patch)
2003-01-22 11:21 UTC, padraig.obriain
none Details | Review
Updated patch (5.81 KB, patch)
2003-07-21 14:33 UTC, padraig.obriain
none Details | Review
Patch as applied (7.47 KB, patch)
2004-02-25 17:26 UTC, Owen Taylor
none Details | Review

Description padraig.obriain 2003-01-14 11:41:40 UTC
In a comment in bug 72249 Havoc stated:

We should add a GTK function:
 GList* gtk_widget_get_mnemonic_labels(GtkWidget *w);

Should be possible to implement sanely on the GTK level. This would 
then allow us to avoid keeping labelled-by properties updated manually.
Comment 1 Owen Taylor 2003-01-20 20:29:38 UTC
Would also need change notification to be useful. 

I'd like to see a detailed
API proposal before comitting as to whether this is a good
idea or not. Would also be a real pain to implement, I suspect,
but that's just a detail...

Putting on 2.4 API freeze for the moment.
Comment 2 padraig.obriain 2003-01-22 11:21:59 UTC
Created attachment 13743 [details] [review]
Proposed patch
Comment 3 padraig.obriain 2003-01-22 11:23:07 UTC
The proposed patch is a suggested API and implementation. I have not
added change notification.
Comment 4 bill.haneman 2003-05-01 10:37:07 UTC
padraig, owen:  

This bug is blocking us (it's creating a problem since we need it for
GNOME 2.4 !).  Owen, have you had a chance to review this API?  Can we
agree to fix this for gtk-2.4?

Without this fix, we are having significant issues making combo-boxes
usable for screenreader users.
Comment 5 Owen Taylor 2003-05-01 15:39:26 UTC
GTK+-2.4 will *not* be in GNOME-2.4. I'll try to look at this
soon, but it has no relevance for GNOME-2.4.
Comment 6 Owen Taylor 2003-07-18 17:18:37 UTC
Patch comments:
 
* The doc comment needs to describe the memory management
  for the returned GList. Actually, I think the memory
  management and the name should match
  gtk_widget_list_accel_closure(), gtk_window_list_toplevels().

* There is some problems with the cleanup of the
  mnemonic widget setup, do to the fact that
  weak_notify() occurs at destroy time, 

 gtk_label_set_mnemonic_widget (label, entry);
 g_object_ref (entry);
 gtk_widget_destroy (entry);
 /* label->mnemonic_widget is cleared */
 gtk_widget_destroy (label);
 /* label is freed, still in gtk_widget_get_mnemonic_widgets result */

For this reason label_mnemonic_widget_weak_notify() should call
_gtk_widget_remove_mnemonic_label().

* I think gtk_widget_add/remove_mnemonic_label() should be
  public, not private. GtkLabel should not be conceptually
  tied to be part of the GTK+ core.

* The doc comment for gtk_widget_get_mnemonic_labels() could
  use some expansion ... "is a mnemonic widget" isn't very clear.
  Perhaps:
  "is the target of a mnemonic (see, for example,
  gtk_label_set_mnemonic_widget())"
  
Other than that looks good to me. Let's ignore the subject
of change notification for the moment.

Comment 7 padraig.obriain 2003-07-21 14:33:11 UTC
Created attachment 18482 [details] [review]
Updated patch
Comment 8 padraig.obriain 2003-11-18 15:39:40 UTC
Will this be reviewed for GTK 2.4?
Comment 9 Owen Taylor 2003-11-18 16:27:22 UTC
It's on the 2.4 API freeze milestone, hence it will be reviewed
prior to freezing the 2.4 API.
Comment 10 Owen Taylor 2004-02-24 21:34:51 UTC
*** Bug 79327 has been marked as a duplicate of this bug. ***
Comment 11 Owen Taylor 2004-02-25 17:26:05 UTC
Created attachment 24772 [details] [review]
Patch as applied
Comment 12 Owen Taylor 2004-02-25 17:30:03 UTC
Applied with various changes:

- Fixed indentation in gtkwidget.h
- Added g_return_if_fails, to add/remove mnemonic_label()
- Added API docs for add/remove mnemonic_label()
- Fixed return value docs for list_mnemonic_label to describe
  memory managemnt
- Make the lists stored in qdata GSList not GList
- Prepend not append to the lists stored internerally
  "efficiency" but here done just for consistency.
- Use g_object_set_qdata_full() not to avoid having to
  check for every widget at finalization. (Note the
  use of steal_qdata() .. this isn't the most efficient
  thing if we have a lot of labels, but it's really simple
  for the normal case.)
- Add gtk_widget_remove_mnemonic_label() to the needed
  place in gtk_label_set_mnemoniC_widget().
- My comment about label_mnemonic_widget_weak_notify() calling
  remove_mnemonic_label is wrong since you must not operate
  on the object in a weak notifier. The right fix was to
  clear the mnemonic_label list in gtk_widget_real_destroy()
  (Patch actually set mnemonic_widget to NULL before calling
  gtk_widget_remove_mnemonic_label (label->mnemonic_widget)

Wed Feb 25 12:21:32 2004  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkwidget.[ch] gtk/gtklabel.c: Patch from
        Padraig O'Briain to add gtk_widget_add/remove_mnemonic_label,
        gtk_widget_get_mnemonic_labels(). (#103456)
Comment 13 padraig.obriain 2004-11-02 10:51:50 UTC
*** Bug 72251 has been marked as a duplicate of this bug. ***