calling cgnome_app_create_menus=>segfault in gnome_accelerators_sync ()
- From: "sting sting" <zstingx hotmail com>
- To: gnome-devel-list gnome org
- Subject: calling cgnome_app_create_menus=>segfault in gnome_accelerators_sync ()
- Date: Mon, 24 Nov 2003 19:18:07 +0200
Hello,
I have a little experience with gnomeui and I have a segmentation
fault iwhen creating a menu. This is the detailed description:
I had written a small program (based on gnome-volume-control of Linux).
I have a segfaut ; backtracng in gdb gives
that the segfault is in gnome_accelerators_sync () from
/usr/lib/libgnomeui-2.so.0
I also see by printing that I reach the call to
gnome_app_create_menus(GNOME_APP (app),main_menu);
but do not reach
printf("after gnome_app_create_menus \n");
(The full code is below).
Any idea o what can be my mistake ?
// gmix.c
#include <stdlib.h>
#include <fcntl.h>
#include "gmix.h"
// we are using glib-2 and gtk-2
#include "glib.h"
#include "gtk/gtk.h"
#include <gnome.h>
#include <libgnomeui/libgnomeui.h>
#include <libgnomeui/gnome-window-icon.h>
#include <gconf/gconf-client.h>
GtkWidget* app;
static GConfClient* client = NULL;
static void quit_cb (GtkWidget* widget,gpointer data);
static void config_cb(GtkWidget* widget,gpointer data);
static device_info* open_device(int num);
static void open_dialog();
static void scan_devices();
static char* mixer_device = NULL;
static void show_error(GtkDialog* dialog);
static const struct poptOption options[] = {
{ "device", '\0', POPT_ARG_STRING, &mixer_device,0,
"Mixer device to use", NULL },
{NULL, '\0', 0, NULL, 0}
};
void get_gui_config()
{
if (client == NULL)
client = gconf_client_get_default();
gconf_client_add_dir(client
,"/apps/gnome-volume-control"
,GCONF_CLIENT_PRELOAD_ONELEVEL
,NULL);
}
static GnomeUIInfo settings_menu[] =
{
GNOMEUIINFO_MENU_PREFERENCES_ITEM(config_cb,NULL),
GNOMEUIINFO_END
};
static const GnomeUIInfo file_menu[] = {
GNOMEUIINFO_MENU_EXIT_ITEM(quit_cb, NULL),
GNOMEUIINFO_END
};
static const GnomeUIInfo main_menu[] = {
GNOMEUIINFO_MENU_FILE_TREE (file_menu),
GNOMEUIINFO_MENU_SETTINGS_TREE (settings_menu),
GNOMEUIINFO_END
};
int main(int argc,char* argv[])
{
// bindtexttodomain(GETTEXT_PACKAGE,GNOMELOCALDIR);
bindtextdomain("gnome-media-2","/usr/local/share/locale");
// bind_textdomain_codset(GETTEXT_PACKAGE,"UTF-8");
textdomain("gnome-media-2");
gnome_program_init("gnome-volume-control"
,"2.2.1.1"
,LIBGNOMEUI_MODULE
,argc
,argv
,GNOME_PARAM_POPT_TABLE
,options
,GNOME_PARAM_POPT_FLAGS
,0
,GNOME_PARAM_APP_DATADIR
,DATADIR
,NULL);
gnome_window_icon_set_default_from_file("gnome-mixer.png");
get_gui_config();
open_dialog();
}
//////////////////////////////////////////////////////////////////////////////
static void open_dialog()
{
printf("in open_dialog \n");
app = gnome_app_new("gnome-volume-control",_("Volume Control") );
if (app == NULL)
printf("app == NULL\n");
gtk_widget_realize(app);
gtk_window_set_resizable(GTK_WINDOW(app),FALSE);
g_signal_connect(G_OBJECT(app)
,"delete_event"
,G_CALLBACK(quit_cb)
,NULL);
printf("before gnome_app_create_menus \n");
gnome_app_create_menus(GNOME_APP (app),main_menu);
printf("after gnome_app_create_menus \n");
gtk_widget_show(app);
gtk_main();
}
//////////////////////////////////////////////////////////////////////////////
static void quit_cb(GtkWidget* widget,gpointer data)
{
gtk_main_quit();
}
//////////////////////////////////////////////////////////////////////////////
static void config_cb(GtkWidget* widget,gpointer data)
{
}
_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]