Re: [gtk-list] Re: Patches for gtkwidget.[ch]



Tim Janik wrote:

> On Thu, 2 Mar 2000, Kent Schumacher wrote:
>
> >
> > I'm not sure I understand how gtk_object_class_user_signal_new() works.
>

OK, now I'm sure I didn't understand - thanks for helping me


> nope, the prefix here is gtk_object_class
>                              ^^^^^^^^^^^^
>
> > 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);
> }
>

Is there any chance this example could be added to the Gtk+ Reference Manual
at the gtk_object_class_user_signal_new explanation?

Thanks again Tim,
Kent




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