Re: [gtk-list] Re: Patches for gtkwidget.[ch]
- From: Tim Janik <timj gtk org>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Patches for gtkwidget.[ch]
- Date: Thu, 2 Mar 2000 17:12:33 +0100 (CET)
On Thu, 2 Mar 2000, Kent Schumacher wrote:
> Tim Janik wrote:
> > second, we don't need to integrate this into gtk proper, just create
> > your signal with gtk_object_class_user_signal_new() (omitting the
> > default hanlder portion) without modifying gtkwidget internals, to get
> > the same effect.
>
> I'm not sure I understand how gtk_object_class_user_signal_new() works.
> My guess is that an object needs to be created (i.e. gtk_button_new())
> before a gtk_object_class_user_signal_new() can be used. If this is the
> case, I feel this is too unwieldy. My application has several hundred
> ..._new() calls for focusable widget. The only commonality is that they
> all inherit from GtkWidget.
nope, the prefix here is gtk_object_class
^^^^^^^^^^^^
> I know it is possible for me to go and chase down every ..._new() call and
> add the signal, but I have a hard time understanding how this is more
> desirable than adding an additional
>
> Note that I feel there needs to be some necessary glue in gtk to make
> it easy to ubiquitously trigger events on a widget regardless of whether
> the source is menu-item, toolbar-button, keypress, voice-activation,
> bar-code reader, dart-gun, whatever.
there is glue code in place to create user defined signals:
gtk_object_class_user_signal_new ().
that should be enough to allow you to emit self defined signals
and thus trigger your callbacks (rewriting your patch):
static guint signal_user_action = 0;
signal_user_action =
gtk_object_class_user_signal_new (gtk_type_class (GTK_TYPE_WIDGET),
"user_action",
GTK_RUN_LAST | GTK_RUN_ACTION,
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
void
gtk_widget_user_action (GtkWidget *widget,
gpointer act_data)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
gtk_signal_emit (GTK_OBJECT (widget), signal_user_action, act_data);
}
>
> Thanks for the quick response,
> Kent
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]