Dynamic Menus (proper post)



Hi again,

My greatest apologies for posting twice, but unfortunately my experience
with mailing lists is limited and I've just found out that my attachment
is missing and
also I will provide a more detailed explanation of my problem in this
re-post.

The code/test case you can find at
http://files.i-nz.net/temp/dynamic_menus.c

My configuration:
SuSE Linux 10.0
GNOME 2.12
X Window System Version 6.8.2
gtk+ 2.8.10
glib 2.8.5
pango 1.10.2

What I am trying to do is dynamically create sub menus by handling
"select" and "deselect" signals for the menu item. Once a menu item is
selected I am creating the sub menu and once I get a deselected event I
delete the sub menu. I assume that I will always get a signal and
destroy a sub menu(for example if the user moves the pointer outside the
menu item or to another menu), which will destroy the children, etc.

I have two major problems with the code:

1) The newly created sub menu is not being shown after it is created in
the selected signal handler. It is shown only if I click
on the selected menu item.
2) If I double click on a menu item it freezes my whole screen and I
can't click on anything. I get a flood of messages containing the same
text in console:

Gtk-CRITICAL **: gtk_widget_event: assertion `WIDGET_REALIZED_FOR_EVENT
(widget, event)' failed

I managed to get a backtrace with GDB by running the program with
--g-fatal-warnings and it is:

Program received signal SIGABRT, Aborted.
0xffffe410 in __kernel_vsyscall ()
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x407b6541 in raise () from /lib/tls/libc.so.6
#2  0x407b7dbb in abort () from /lib/tls/libc.so.6
#3  0x4073a1a0 in g_logv () from /opt/gnome/lib/libglib-2.0.so.0
#4  0x4073a1e5 in g_log () from /opt/gnome/lib/libglib-2.0.so.0
#5  0x4073a33c in g_return_if_fail_warning ()
from /opt/gnome/lib/libglib-2.0.so.0
#6  0x40263df4 in gtk_widget_event ()
from /opt/gnome/lib/libgtk-x11-2.0.so.0
#7  0x4016ffc5 in gtk_propagate_event ()
from /opt/gnome/lib/libgtk-x11-2.0.so.0
#8  0x4017045f in gtk_main_do_event ()
from /opt/gnome/lib/libgtk-x11-2.0.so.0
#9  0x4037ae4a in gdk_screen_get_setting ()
from /opt/gnome/lib/libgdk-x11-2.0.so.0
#10 0x407325dc in g_main_context_dispatch ()
from /opt/gnome/lib/libglib-2.0.so.0
#11 0x40732c9b in g_main_context_dispatch ()
from /opt/gnome/lib/libglib-2.0.so.0
#12 0x40733187 in g_main_loop_run ()
from /opt/gnome/lib/libglib-2.0.so.0
#13 0x4016f5d1 in gtk_main () from /opt/gnome/lib/libgtk-x11-2.0.so.0
#14 0x08049161 in main (argc=1, argv=0xbfd92174) at main.c:111

What am I doing wrong and what would be the proper way to implement what
I am trying to without experiencing the 2 problems I am having?

-- 
Ivan N. Zlatev
Web: http://www.i-nZ.net
PGP Key: http://files.i-nz.net/Ivan%20N.%20Zlatev.asc
"It's all some kind of whacked out conspiracy."


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