signals with GTK_TYPE_ADJUSTMENT

View: New views
2 Messages — Rating Filter:   Alert me  

signals with GTK_TYPE_ADJUSTMENT

by Dov Grobgeld-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In hope that the mailing list isn't dead yet, I wonder if someone can help me with some gob2 syntax.

I got stuck on trying to create signals with the following signature (copied from GtkTextView) in gob:

  signals[SET_SCROLL_ADJUSTMENTS] =
    g_signal_new (I_("set_scroll_adjustments"),
          G_OBJECT_CLASS_TYPE (gobject_class),
          G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
          G_STRUCT_OFFSET (MyFooClass, set_scroll_adjustments),
          NULL, NULL,
          _gtk_marshal_VOID__OBJECT_OBJECT,
          G_TYPE_NONE, 2,
          GTK_TYPE_ADJUSTMENT,
          GTK_TYPE_ADJUSTMENT);

I tried the following:

 signal last NONE (GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT)
  gboolean
  set_scroll_adjustments (self,
                          Gtk:Adjustment    *hadjustment,
                          Gtk:Adjustment    *vadjustment)

but got the error "Error: Unknown GTK+ type 'GTK_TYPE_ADJUSTMENT' among signal types".

This also failed:

 signal last NONE (OBJECT=Gtk:Adjustment, OBJECT=Gtk:Adjustment)
  gboolean
  set_scroll_adjustments (self,
                          Gtk:Adjustment    *hadjustment,
                          Gtk:Adjustment    *vadjustment)


which gave the error "Error: syntax error before '='".

In the end I used:

 signal last NONE (OBJECT, OBJECT)
  gboolean
  set_scroll_adjustments (self,
                          Gtk:Adjustment    *hadjustment,
                          Gtk:Adjustment    *vadjustment)

and then applied an external patch:

-            G_TYPE_OBJECT,
-            G_TYPE_OBJECT);
+            GTK_TYPE_ADJUSTMENT,
+            GTK_TYPE_ADJUSTMENT);

But of course I wonder whether there is any syntax to do this in gob2?

Thanks!
Dov




--
to unsubscribe:
send mail to minimalist@... with "unsubscribe gob-list" in the subject

Re: signals with GTK_TYPE_ADJUSTMENT

by Jiri Lebl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dov Grobgeld wrote:

> In hope that the mailing list isn't dead yet, I wonder if someone can
> help me with some gob2 syntax.
>
> I got stuck on trying to create signals with the following signature
> (copied from GtkTextView) in gob:
>
>   signals[SET_SCROLL_ADJUSTMENTS] =
>     g_signal_new (I_("set_scroll_adjustments"),
>           G_OBJECT_CLASS_TYPE (gobject_class),
>           G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
>           G_STRUCT_OFFSET (MyFooClass, set_scroll_adjustments),
>           NULL, NULL,
>           _gtk_marshal_VOID__OBJECT_OBJECT,
>           G_TYPE_NONE, 2,
>           GTK_TYPE_ADJUSTMENT,
>           GTK_TYPE_ADJUSTMENT);
>
> I tried the following:
>
>  signal last NONE (GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT)
>   gboolean
>   set_scroll_adjustments (self,
>                           Gtk:Adjustment    *hadjustment,
>                           Gtk:Adjustment    *vadjustment)

1) you have a gboolean return and you specify NONE for your return, you
should have BOOLEAN there
2) Use OBJECT or POINTER instead of GTK_TYPE_ADJUSTMENT.  These types are
used for the marshalling, and it is sufficient to pass objects as OBJECTs or
even just POINTERs.  The type checking is done at a different place.

George

--
George <jirka@...>
    Few people can be happy unless they hate some other person,
    nation or creed.
                        -- Bertrand Russell



--
to unsubscribe:
send mail to minimalist@... with "unsubscribe gob-list" in the subject