Re: GtkItemFactoryEntry (was: Re: New 'GObject' as base forGtkObject?)



On Sat, 11 Dec 1999, Karl Nelson wrote:

> We do have a working menu item builder (but likely not one that
> gives the paths completely yet.)  The item factory builder
> interface is utterly unusable in C++.  So do I need to create an ItemFactory
> and connect it to the window to get accelerators to work?  
> What it the logic behind the paths? 

no, you do not need an item factory to call gtk_item_factory_add_foreign().
you just need to pass the menu item you created, a full menu factory path
e.g. "<MyApp>/File/Preferences/Save Accelerators", the accelerator group,
and the default accelerator into it.
you should have a accelerator group per menu+window combination you use,
e.g. for window1 and window2 using the same menu bar, you should have two
distinct accel groups (while equal items in both menu bars would have the
*same* path), and also if you use two distinct types of menus for the same
window, say a menu bar and a popup menu.

then upon program entry you call gtk_item_factory_parse_rc() and upon exit
you call gtk_item_factory_dump_rc(), which can be as easy as for instance:
static gint
gnome_save_accels (gpointer data)
{
        gchar *file_name;

        file_name = g_concat_dir_and_file (gnome_user_accels_dir, gnome_app_id);
        gtk_item_factory_dump_rc (file_name, NULL, TRUE);
        g_free (file_name);

        return TRUE;
}
gtk_quit_add (1, gnome_save_accels, NULL);

> 
> --Karl
> 

---
ciaoTJ



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]