Applet problem



Hi all,

I'm quite new to gtkmm and actually also to C++. I'm working on a small
applet that I call dirlist.

This is a small applet that displays a single menu entry in the panel
corresponding to a "base directory" selected by the user. Sub menus are
then recursively generated based on the directory and file structure in
the selected base directory. By clicking a directory of a file a custom
command can be launched.

I just started hosting the project at launchpad, so the code can be
found at

https://launchpad.net/dirlist-applet

Now I have a problem (actually I have several, but this one I'v been
trying to resolve for some time now :-) relating to how menus work. The
thing is that when I click on a MenuItem I want to perform some action
corresponding to if it is a directory or something else. So far only the
directory part is implemented and is executes nautilus [dirname], which
is what I want. However I have to click 3 times on the MenuItem for the
signal to propagate and the wanted action to happen. I can't figure out
why. It probably has something to do with how signals are propagated (is
e.g. signal_button_pres_event propageted to signal_activated on a menu
item?) which I havn't quite understood.

To see more closely what I mean, please take a look at the code. It is
not very mature yet and several features are missing but it should be
buildable with make and sudo make install (no autoconf yet).

On IRC I was given the suggestion to work with Menu_Helpers instead of
MenuItem et al. but I could not find any information of what is actually
the difference here. Anyone can point me to any useful info?

Finally a memory management question. I create sub menus in the applet
and I do
...
	sub_menu = manage(new Gtk::Menu);
	set_submenu (*sub_menu);
...
Since this is not a add (*sum_menu) I wonder: does this take care of
memory management for me, or do I have to do that myself?

Thanks in advance,
Robert Rehammar



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