gnome_app_insert_menus
- From: paul sanford toney <pst stilton com>
- To: gnome-devel-list <gnome-devel-list gnome org>
- Subject: gnome_app_insert_menus
- Date: Wed, 19 Apr 2000 15:05:49 -0700
hello list,
i've recently begun gnome programming with a smallish mdi app, and i'm having a
little problem. let me briefly explain what's going on:
when i create my mdi top-level object, it is of course using the menubar and
toolbar templates i've designated; however, i have some dynamically assigned
menu items loaded in from a config file on startup which need to get inserted
here and there. so on startup, i generate a list of these dynamic menu items,
and then catch the mdi `app-created` signal to insert the menus after the app
menus have been instantiated from the template.
here's the problem. all of this actually works, the dynamic menus show up, even
when i drag a notebook tab out to spawn a new top-level. however, when i select
one of the dynamically-installed menu items and my callback function is invoked,
the user_data parameter gets hosed. in the sample code below, i've set it to
0xdeadbeef; by the time it gets to my callback function, it's something else.
any ideas?
also, i'm not sure whether i should assume that gnome_app_insert_menus_with_data
(...) will make a deep copy of the menuinfo structures, so i'm g_strdup'ing the
menu label.
i suppose i could trace through all of this in the debugger, but i thought
before i took that step, somebody might have some insights. any help would be
greatly appreciated. thanks!
+++ sample code starts here +++
GnomeUIInfo menuinfo [] = {
{
GNOME_APP_UI_ITEM,
NULL,
NULL,
NULL,
NULL,
NULL,
0,
0,
GDK_VoidSymbol,
0
},
GNOMEUIINFO_END
};
menuinfo[0].type = GNOME_APP_UI_ITEM;
menuinfo[0].label = g_strdup (my_label_str);
menuinfo[0].hint = NULL;
menuinfo[0].moreinfo = my_callback_cb;
menuinfo[0].user_data = (gpointer) 0xdeadbeef;
menuinfo[0].unused_data = NULL;
menuinfo[0].pixmap_type = 0;
menuinfo[0].pixmap_info = 0;
menuinfo[0].accelerator_key = GDK_VoidSymbol;
menuinfo[0].ac_mods = 0;
menuinfo[0].widget = NULL;
gnome_app_insert_menus_with_data (
my_app_ptr,
my_menu_path_str,
menuinfo,
my_mdi_ptr);
...
static void
my callback_cb (GtkWidget * widget, gpointer data)
{
/* the data parameter should be 0xdeadbeef,
but it's not - say it ain't so! */
}
+++ sample code ends here +++
/\ paul sanford toney
/()\ pst at stilton dot com
/____\ `don't rock, wobble`
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]