TreeView selection and button-press-event interaction



Hi all,

For my GSOC project[1] I'd like to have a places like sidebar on
system-config-printer. I have been looking at how nautilus does it but
there is one thing that is anoying me and I cannot see in nautilus'
code how it works there though it does work :-)

When you right click on a nautilus places treeview item the item gets
selected and still nautilus gets the button-press-event callback
called. I haven't been able to do that and am using the
button-release-event but it's not ideal since the menu doesn't behave
like other popup menus.

Mitch told me on #gtk+ that it's because the treeview's
button-press-event handler is returning TRUE and thus stopping the
signal emition and that the correct solution would be to subclass the
treeview widget and override its button-press-event handler. Still,
nautilus doesn't do that and behaves nicely.

On nautilus-places-sidebar.c:bookmarks_button_press_event_cb () the
event starts to handled and then eventually control reaches
bookmarks_check_popup_sensitivity which checks the currently selected
treeview item and acts accordingly to the just selected item.

Trying to replicate that I find that my button-press-event handler is
called but at that point the treeview says that the selected item is
still the previously selected on (before the right click). If I
connect with connect_after I don't get called.

So, can anyone familiar with the code explain me how do you allow the
treeview to select the right clicked item and still get the
button-press-event?

Thanks and sorry for the long mail :-)
Rui

[1] http://git.fedorahosted.org/git/?p=system-config-printer.git;a=summary


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