GtkOptionMenu: reading menu -item labels
- From: Zoran Rilak <wayward tirion test net>
- To: gtk-app-devel-list gnome org
- Subject: GtkOptionMenu: reading menu -item labels
- Date: Tue, 24 Feb 2004 01:56:53 +0100 (CET)
Hello,
I'm having a problem with GtkOptionMenu widget. I have an instance with
labels for menu items (at least that's how I believe Glade creates option
menus), so it's an ordinary 'select-a-line' option button. At some point
in my program I need to iterate over those labels (when changing default
preferences with those read in from the config file). When I do
/* get menu */
GtkMenu *w = gtk_option_menu_get_menu (opt_menu_widget);
/* get menu items */
GList *l = ((GtkMenuShell *)w)->children;
/* iterate over menu items */
while (l != NULL)
{
w = gtk_bin_get_child ((GtkBin *)l->data);
/******/
printf ("[%s]\n", gtk_label_get_text ((GtkLabel *)w));
/******/
l = g_list_next (l);
}
I get the following behavior: for every menu item *other* than the
currently displayed one, I get that item's text; but for the displayed
item, gtk_label_get_text () issues a warning that w isn't a (GtkLabel *)
(and printf outputs "[(null)]").
I tried to determine the type of the offending widget with
printf ("[%s]\n", g_type_name (GTK_WIDGET_TYPE (w)));
but it didn't work.
Also, GTK+ 2.3.2 documentation states that all of the functions operating
on GtkOptionMenu are deprecated; what are their replacements?
Thanks,
Zoran
Wayward Bruce - Yet Another Kind of Bruces
---
http://www.rcub.bg.ac.yu/~bruce
bruce tesla rcub bg ac yu
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]