List Info

Thread: Howto revert a gtk_widget_tap_and_hold_setup




Howto revert a gtk_widget_tap_and_hold_setup
country flaguser name
Spain
2007-04-17 13:52:24
Hi,

is there any way to revert a gtk_widget_tap_and_hold_setup?
I mean I
have a widget that shows a popup as response to a tap and
hold event. I
want to change the contents of that popup menu in execution
time. So I
want to "unregister" the old one and setup a new
one.

I tried a combination of gtk_menu_get_for_attach_widget +
gtk_menu_detach but it does not work, because it seems that
the
gtk_widget_tap_and_hold_setup does not attach the menu to
the widget
correctly. For example I have the following code:

gtk_widget_tap_and_hold_setup (item, popup, NULL, 0);
g_assert (gtk_menu_get_attach_widget (GTK_MENU(popup)) !=
NULL);
g_assert (item ==
gtk_menu_get_attach_widget(GTK_MENU(popup)));

The second assert fails, and I guess it should be correct,
isn't it?

Br

PS: I'm using gtk 2.6.10, sardine's version
_______________________________________________
maemo-developers mailing list
maemo-developersmaemo.org
h
ttps://maemo.org/mailman/listinfo/maemo-developers

Re: Howto revert a gtk_widget_tap_and_hold_setup
user name
2007-04-17 14:19:03
2007/4/17, Sergio Villar Senin <svillarigalia.com>:
> Hi,
>
> is there any way to revert a
gtk_widget_tap_and_hold_setup? I mean I
> have a widget that shows a popup as response to a tap
and hold event. I
> want to change the contents of that popup menu in
execution time. So I
> want to "unregister" the old one and setup a
new one.

If possible, I'd suggest carrying the existing menu pointer
to the
code that wants to change it and operate on that (it's just
a
container after all, adding/removing items is possible).

Furthermore, if the contents are not totally dynamic, a
more
convenient solution might be using UI Manager[1] to change
the menu.
It takes a bit more effort to set up than just adding
menuitems to a
menu, but once the initial work is done it is very flexible
and
simplifies code a lot.

[1] htt
p://live.gnome.org/GnomeLove/UIManagerTutorial

-- 
Kalle Vahlman, zuhiki.fi
Powered by http://movial.fi
Interesting stuff at http://syslog.movial.fi
_______________________________________________
maemo-developers mailing list
maemo-developersmaemo.org
h
ttps://maemo.org/mailman/listinfo/maemo-developers

Re: Howto revert a gtk_widget_tap_and_hold_setup
country flaguser name
Spain
2007-04-18 02:00:09
Kalle Vahlman wrote:
> 2007/4/17, Sergio Villar Senin <svillarigalia.com>:
>> Hi,
>>
>> is there any way to revert a
gtk_widget_tap_and_hold_setup? I mean I
>> have a widget that shows a popup as response to a
tap and hold event. I
>> want to change the contents of that popup menu in
execution time. So I
>> want to "unregister" the old one and
setup a new one.
> 
> If possible, I'd suggest carrying the existing menu
pointer to the
> code that wants to change it and operate on that (it's
just a
> container after all, adding/removing items is
possible).

Yeah, that was my second choice . But I
wanted to know also, why gtk+
is not working as expected, because the tap_and_hold_setup
method to
attach the menu to the widget:
http://maemo.org/lxr/source/gtk%2B/gtk/gtkwidget.c#8111

> Furthermore, if the contents are not totally dynamic, a
more
> convenient solution might be using UI Manager[1] to
change the menu.
> It takes a bit more effort to set up than just adding
menuitems to a
> menu, but once the initial work is done it is very
flexible and
> simplifies code a lot.
> 
> [1] htt
p://live.gnome.org/GnomeLove/UIManagerTutorial

Actually I use the ui manager a lot , but the
contents are in fact,
totally dynamic.

Br

_______________________________________________
maemo-developers mailing list
maemo-developersmaemo.org
h
ttps://maemo.org/mailman/listinfo/maemo-developers

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )