qulogic/libgnt

Use G_DEFINE_TYPE for GntWidget.

2019-04-03, Elliott Sales de Andrade
c3de29b0a6c5
Parents 746987e29e4d
Children 44cdc95eabee
Use G_DEFINE_TYPE for GntWidget.
  • +7 -35
    gntwidget.c
  • +4 -4
    gntwidget.h
  • --- a/gntwidget.c Wed Apr 03 19:22:35 2019 -0400
    +++ b/gntwidget.c Wed Apr 03 20:44:30 2019 -0400
    @@ -47,17 +47,19 @@
    SIGS
    };
    -static GObjectClass *parent_class = NULL;
    static guint signals[SIGS] = { 0 };
    static void init_widget(GntWidget *widget);
    +G_DEFINE_TYPE(GntWidget, gnt_widget, GNT_TYPE_BINDABLE)
    +
    +/******************************************************************************
    + * GObject Implementation
    + *****************************************************************************/
    static void
    -gnt_widget_init(GTypeInstance *instance, gpointer class)
    +gnt_widget_init(GntWidget *widget)
    {
    - GntWidget *widget = GNT_WIDGET(instance);
    widget->priv.name = NULL;
    - GNTDEBUG;
    }
    static void
    @@ -74,8 +76,7 @@
    {
    GntWidget *self = GNT_WIDGET(obj);
    g_signal_emit(self, signals[SIG_DESTROY], 0);
    - parent_class->dispose(obj);
    - GNTDEBUG;
    + G_OBJECT_CLASS(gnt_widget_parent_class)->dispose(obj);
    }
    static void
    @@ -112,8 +113,6 @@
    {
    GObjectClass *obj_class = G_OBJECT_CLASS(klass);
    - parent_class = g_type_class_peek_parent(klass);
    -
    obj_class->dispose = gnt_widget_dispose;
    klass->destroy = gnt_widget_destroy;
    @@ -250,33 +249,6 @@
    /******************************************************************************
    * GntWidget API
    *****************************************************************************/
    -GType
    -gnt_widget_get_type(void)
    -{
    - static GType type = 0;
    -
    - if(type == 0) {
    - static const GTypeInfo info = {
    - sizeof(GntWidgetClass),
    - NULL, /* base_init */
    - NULL, /* base_finalize */
    - (GClassInitFunc)gnt_widget_class_init,
    - NULL,
    - NULL, /* class_data */
    - sizeof(GntWidget),
    - 0, /* n_preallocs */
    - gnt_widget_init, /* instance_init */
    - NULL /* value_table */
    - };
    -
    - type = g_type_register_static(GNT_TYPE_BINDABLE,
    - "GntWidget",
    - &info, G_TYPE_FLAG_ABSTRACT);
    - }
    -
    - return type;
    -}
    -
    void gnt_widget_set_take_focus(GntWidget *widget, gboolean can)
    {
    if (can)
    --- a/gntwidget.h Wed Apr 03 19:22:35 2019 -0400
    +++ b/gntwidget.h Wed Apr 03 20:44:30 2019 -0400
    @@ -106,10 +106,10 @@
    WINDOW *window;
    /*< private >*/
    - void *res1;
    - void *res2;
    - void *res3;
    - void *res4;
    + void *res1;
    + void *res2;
    + void *res3;
    + void *res4;
    };
    struct _GntWidgetClass