User data in gnome menus
- From: "Carlos Fernández" <carlicus hotmail com>
- To: gnome-devel-list gnome org
- Subject: User data in gnome menus
- Date: Sun, 10 Mar 2002 15:21:23 +0000
I have a problem with the user_data parameter of a GnomeUIInfo structure.
My project is made of several c files, but i'm not going to send you all of
them, i'll only extract the most important piece of code.
/******************************************/
/********** main_window.c *****************/
/******************************************/
GtkWidget *app;
app = gnome_app_new("GnomeGps", "GnomeGps");
ggps_install_menu_bar(app); /*This function is in bars.c*/
/******************************************/
/********** bars.c ************************/
/******************************************/
static GnomeUIInfo file_menu[] = {
GNOMEUIINFO_MENU_OPEN_ITEM(file_open_cb, NULL),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_END
};
static GnomeUIInfo main_menu[] = {
GNOMEUIINFO_MENU_FILE_TREE(file_menu),
GNOMEUIINFO_END
};
void ggps_install_menu_bar(GtkWidget *app)
{
gnome_app_create_menus_with_data(GNOME_APP(app), main_menu, app); /*This
function is in open.c*/
}
/***************************************/
/********** open.c *********************/
/***************************************/
void file_open_cb (GtkWidget *widget, gpointer data)
{
GtkWidget *open_file_selector;
open_file_selector = gtk_file_selection_new(NULL);
gtk_window_set_modal (GTK_WINDOW (open_file_selector), TRUE);
gtk_window_set_transient_for(GTK_WINDOW(open_file_selector),
GTK_WINDOW((GtkWidget *)app)); /*THE PROBLEM IS HERE!!*/
...
gtk_widget_show (open_file_selector);
}
That's to say, i'm opening a file selection dialog when clicking on the
option "open" in the file menu. The problem is that i think the "gpointer
data" parameter (in the function file_open_cb should point to the "app"
variable, because i do that when i call
gnome_app_create_menus_with_data(...,...,app).
This does NOT work. Please What i'm doing wrong? I only want to use the
"app" variable from the file main_window.c in the file open.c (but without
using extern variables). Please correct my code or give me a new way of
doing it.
_________________________________________________________________
Hable con sus amigos en línea, pruebe MSN Messenger: http://messenger.msn.es
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]