I have a program I wrote in C using GTK2+. I have just added a toggle
item to a menu, which controls a boolean. The same boolean is also
controlled by a configuration file. So, in the process of reading the
configuration file, how do I check or uncheck the menu entry?

static GtkItemFactoryEntry menu_items[] = {
 /* menu hierarchy    Accel Function action Type  */
 { "/_File",              NULL,     NULL,       0, "<Branch>" },
...
 { "/Units/_Metric", "<ctrl>m", setUnits,  METRIC, "<RadioItem>"    },
 { "/Units/_US",     "<ctrl>i", setUnits,      US, "/Units/Metric"  },
 { "/Units/_Knots",  "<ctrl>k", setUnits,   KNOTS, "/Units/Metric"  },
 { "/Units/Sep",          NULL,     NULL,       0, "<Separator>"    },
 { "/Units/_Gmt",    "<ctrl>g",   setGmt,       0, "<ToggleItem>"   },
...
};

I figure I need to access it something like the same way I do the
radio button items above it:

 case METRIC:
  gtk_check_menu_item_set_active(
   GTK_CHECK_MENU_ITEM (gtk_item_factory_get_item (item_factory, 
"/Units/Knots")),
   TRUE);

But so far I have not found a suitable magic incantation.

Thanks

-- 

Charles Curley                  /"\    ASCII Ribbon Campaign
Looking for fine software       \ /    Respect for open standards
and/or writing?                  X     No HTML/RTF in email
http://www.charlescurley.com    / \    No M$ Word docs in email

Key fingerprint = CE5C 6645 A45A 64E4 94C0  809C FFF6 4C48 4ECD DFDB

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to