Re: menu widgets and connected signals behavior

On Tue, Feb 7, 2012 at 10:20 AM, Ozkan Sezer <sezeroz gmail com> wrote:
> I have a question about the behavior of connected signals when an
> option menu's menu items are redefined:
> In my application, I am targeting all three gtk versions. For gtk1
> and gtk2 I use GtkOptionMenu and connect to the "selection-done"
> signal. For gtk3 I use GtkComboBoxText and connect to the "changed"
> signal.
> Upon several events, I need to change the contents of the menu:
> For gtk1/2 I accomplish this by doing a gtk_option_menu_remove_menu()
> and rebuilding the menu items through calls to gtk_menu_new(),
> gtk_menu_item_new_with_label(), gtk_menu_shell_append() and
> gtk_option_menu_set_menu().
> For gtk3 it is as simple as calling gtk_combo_box_text_remove_all()
> and then for the new items calling gtk_combo_box_text_append_text().
> My question is, what happens with the signal connected to the previous
> and now removed-and-replaced menu? To be on the safe side, because I
> do not know the internals, I disconnect the signals and then reconnect
> them which does seem to work. However I do not know how necessary this
> is and whether there is an easier way for all three gtk version lines.
> Thanks in advance.
> --
> O.S.

Any luck that anyone have some knowledge about this?
(or did I post to the wrong list?)


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