Re: [gtk-list] Re: how to set toggle/radio buttons without "clicked"
- From: "Emmanuel DELOGET" <logout free fr>
- To: <gtk-list redhat com>
- Subject: Re: [gtk-list] Re: how to set toggle/radio buttons without "clicked"
- Date: Sun, 16 Jan 2000 14:10:13 +0100
> In message <yb7g0vzw1er.fsf@icon.labs.redhat.com>you write:
> >
> >Paul Barton-Davis <pbd@Op.Net> writes:
> >> i have some radio and toggle buttons. they can be set (in-)active by
> >> the user+mouse, or programmatically as a result of data read from
> >> an external input source.
> >>
> >> if i use gtk_toggle_button_set_active() for the programmatic setting,
> >> then the "clicked" signal is emitted. How can i set the button states
> >> in a way that doesn't make it appear that there was user interaction ?
> >>
> >
> >You have to do gtk_signal_handler_block_*() around your set_active().
>
> but to use that, i need to know the handler_id that needs to be
> blocked, right ? i don't want *anything* that is connected to
> "clicked" to be invoked, even though i have no idea what is connected ...
>
> if this is written down someplace, i'll gladly go read it :)
>
You can use
gtk_signal_handler_block_by_func(GtkObject *, GtkSignalFunc *,
gpointer)
(the func and the data pointer must be equal to the correponding
gtk_signal_connect()
parameters)
Or
gtk_signal_handler_block_by_data(GtkObject *, gpointer)
(the data parameter must be the same as in the gtk_signal_connect()
call)
BTW, it should be nice to have a
gtk_signal_handler_xxx_by_name(GtkObject *, const gchar *)
where xxx is disconnect, block, unblock or pending.
This would be something like this (for block_by_name)
(this is not intended to be used in a application since
gtk_handler_quark is
a private variable in gtksignal.c
void
gtk_signal_handler_block_by_name(GtkObject *object,
const gchar *name)
{
GtkHandler *handler;
guint found_one;
guint signal_id;
g_return_if_fail(object != NULL);
g_return_if_fail(name != NULL);
signal_id = gtk_signal_lookup (name, GTK_OBJECT_TYPE (object));
if (signal_id >= 1)
{
found_one = FALSE;
handler = gtk_object_get_data_by_id(object, gtk_handler_quark);
while (handler)
{
if (handler->id == signal_id)
{
found_one = TRUE;
handler->blocked += 1;
}
handler = handler->next;
}
if (found_one != TRUE)
{
g_warning("blah blah...");
}
}
else
{
g_warning("blah blah...");
}
}
Yours,
Emmanuel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]