Il Wed, 2 Nov 2016 10:23:44 +0100 Pozz Pozz <pozzu...@gmail.com> scrisse:
> ...
> How do you implement the generic function _my_set_value()? It should have
> two parameters: spinbutton and value. signal_handler_block() function needs
> the handler_id associated that I don't have.
> Maybe during initialization, when I connected the handlers, I could create
> a data structure (a list) with spinbuttons and associated handler_id. In
> this way, _my_set_value() could accept the item of the list and could
> recover the handler_id to block.
> 
> However there is another problem with this approach. I'm using Glade and I
> connect *all* the handlers with a single instruction:
> builder.connect_signals(). So I don't have the handler IDs.
> ...

Hi,

you don't necessarily need the handler id. In C (I don't use
python) you could write the following:

void my_set_value(GtkSpinButton *spin_button, gdouble value)
{
    g_signal_handlers_block_matched(spin_button,
                                    G_SIGNAL_MATCH_FUNC,
                                    0, 0, NULL,
                                    callback_to_skip,
                                    NULL);

    /* This will not trigger callback_to_skip */
    gtk_spin_button_set_value(spin_button, value)

    g_signal_handlers_unblock_matched(spin_button,
                                      G_SIGNAL_MATCH_FUNC,
                                      0, 0, NULL,
                                      callback_to_skip,
                                      NULL);
}

Not tested, but should give you the idea.

Ciao.
-- 
Nicola
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to