Help with g_signal_connect()



Hi, guys

i have the next code
====================================================================
mainIcon = gtk_status_icon_new_from_file(icon_filename);

GtkWidget *menu_popup;
menu_popup = glade_xml_get_widget(xml, "main_menu");
gtk_menu_popup(GTK_MENU(menu_popup) , NULL, NULL, NULL, NULL, 0,0);
====================================================================

my GtkMenu is showed, but, if i send the widget via data in
g_signal_connect i get an segfault, with gdb i see a problem with
g_type_check_instance_cast ()

wrong code via g_signal_connect()
=====================================================================
void tray_icon_button_press (GtkWidget *widget, GtkWidget *menu)
{
    gtk_menu_popup( GTK_MENU (menu) , NULL, NULL, NULL, NULL, 0, 0);
}

mainIcon = gtk_status_icon_new_from_file(icon_filename);

GtkWidget *menu_popup;
menu_popup = glade_xml_get_widget(xml, "main_menu");
g_signal_connect(G_OBJECT(mainIcon), "popup-menu",
G_CALLBACK(tray_icon_button_press), menu_popup );
====================================================================================================

using the right click on the GtkStatusIcon to fire the "popup-menu"
signal, i get the segfault, i dont understand where is my error, can
anybody helpme please?

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb718e920 (LWP 15924)]
0xb76bee98 in g_type_check_instance_cast () from /usr/lib/libgobject-2.0.so.0

regards


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