Web lists-archives.com

Re: How do you write common codes for GObject?




If I ned to be backwards compatible, I go with GobGen (an Emacs package I wrote, available on MELPA). If not, see ebassi’s answer.

On Mon, Sep 4, 2017, 16:46 Kouhei Sutou <kou@xxxxxxxxxxxx> wrote:
Hi,

We need to write common codes for GObject like the
followings:

#define GTK_TYPE_WIDGET                   (gtk_widget_get_type ())
#define GTK_WIDGET(widget)                (G_TYPE_CHECK_INSTANCE_CAST ((widget), GTK_TYPE_WIDGET, GtkWidget))
#define GTK_WIDGET_CLASS(klass)           (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WIDGET, GtkWidgetClass))
#define GTK_IS_WIDGET(widget)             (G_TYPE_CHECK_INSTANCE_TYPE ((widget), GTK_TYPE_WIDGET))
#define GTK_IS_WIDGET_CLASS(klass)        (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WIDGET))
#define GTK_WIDGET_GET_CLASS(obj)         (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WIDGET, GtkWidgetClass))


How do you write them?

  a. Write them from scratch
  b. Copy from existing codes, paste them to new source file
     and substitute them
  c. Generate them by script
  d. Other

My approach is b. If there is better approach, I want to use
it. Please share your approach.


Thanks,
--
kou
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list