[gnome-software] first run dialog: Port to G_DECLARE_FINAL_TYPE macro



commit 6185b797bd98d5fc65ab32af6c7e56b1f5909b26
Author: Kalev Lember <klember redhat com>
Date:   Mon Sep 7 15:19:00 2015 +0200

    first run dialog: Port to G_DECLARE_FINAL_TYPE macro

 src/gs-first-run-dialog.c |   13 +++++++------
 src/gs-first-run-dialog.h |   24 ++++--------------------
 2 files changed, 11 insertions(+), 26 deletions(-)
---
diff --git a/src/gs-first-run-dialog.c b/src/gs-first-run-dialog.c
index e92f5e2..838bdb6 100644
--- a/src/gs-first-run-dialog.c
+++ b/src/gs-first-run-dialog.c
@@ -25,12 +25,14 @@
 
 #include "gs-first-run-dialog.h"
 
-struct _GsFirstRunDialogPrivate
+struct _GsFirstRunDialog
 {
+       GtkDialog        parent_instance;
+
        GtkWidget       *button;
 };
 
-G_DEFINE_TYPE_WITH_PRIVATE (GsFirstRunDialog, gs_first_run_dialog, GTK_TYPE_DIALOG)
+G_DEFINE_TYPE (GsFirstRunDialog, gs_first_run_dialog, GTK_TYPE_DIALOG)
 
 static void
 button_clicked_cb (GtkWidget *widget, GsFirstRunDialog *dialog)
@@ -41,16 +43,15 @@ button_clicked_cb (GtkWidget *widget, GsFirstRunDialog *dialog)
 static void
 gs_first_run_dialog_init (GsFirstRunDialog *dialog)
 {
-       GsFirstRunDialogPrivate *priv = gs_first_run_dialog_get_instance_private (dialog);
        GtkWidget *button_label;
 
        gtk_widget_init_template (GTK_WIDGET (dialog));
 
-       button_label = gtk_bin_get_child (GTK_BIN (priv->button));
+       button_label = gtk_bin_get_child (GTK_BIN (dialog->button));
        gtk_widget_set_margin_start (button_label, 16);
        gtk_widget_set_margin_end (button_label, 16);
 
-       g_signal_connect (priv->button, "clicked", G_CALLBACK (button_clicked_cb), dialog);
+       g_signal_connect (dialog->button, "clicked", G_CALLBACK (button_clicked_cb), dialog);
 }
 
 static void
@@ -60,7 +61,7 @@ gs_first_run_dialog_class_init (GsFirstRunDialogClass *klass)
 
        gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/Software/gs-first-run-dialog.ui");
 
-       gtk_widget_class_bind_template_child_private (widget_class, GsFirstRunDialog, button);
+       gtk_widget_class_bind_template_child (widget_class, GsFirstRunDialog, button);
 }
 
 GtkWidget *
diff --git a/src/gs-first-run-dialog.h b/src/gs-first-run-dialog.h
index dd3922e..b906097 100644
--- a/src/gs-first-run-dialog.h
+++ b/src/gs-first-run-dialog.h
@@ -24,32 +24,16 @@
 
 #include <gtk/gtk.h>
 
-#define GS_TYPE_FIRST_RUN_DIALOG               (gs_first_run_dialog_get_type())
-#define GS_FIRST_RUN_DIALOG(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj), GS_TYPE_FIRST_RUN_DIALOG, 
GsFirstRunDialog))
-#define GS_FIRST_RUN_DIALOG_CLASS(cls)         (G_TYPE_CHECK_CLASS_CAST((cls), GS_TYPE_FIRST_RUN_DIALOG, 
GsFirstRunDialogClass))
-#define GS_IS_FIRST_RUN_DIALOG(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), GS_TYPE_FIRST_RUN_DIALOG))
-#define GS_IS_FIRST_RUN_DIALOG_CLASS(cls)      (G_TYPE_CHECK_CLASS_TYPE((cls), GS_TYPE_FIRST_RUN_DIALOG))
-#define GS_FIRST_RUN_DIALOG_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS((obj), GS_TYPE_FIRST_RUN_DIALOG, 
GsFirstRunDialogClass))
-
 G_BEGIN_DECLS
 
-typedef struct _GsFirstRunDialog               GsFirstRunDialog;
-typedef struct _GsFirstRunDialogClass          GsFirstRunDialogClass;
-typedef struct _GsFirstRunDialogPrivate                GsFirstRunDialogPrivate;
-
-struct _GsFirstRunDialog
-{
-       GtkDialog        parent;
-};
+#define GS_TYPE_FIRST_RUN_DIALOG (gs_first_run_dialog_get_type ())
 
-struct _GsFirstRunDialogClass
-{
-       GtkDialogClass   parent_class;
-};
+G_DECLARE_FINAL_TYPE (GsFirstRunDialog, gs_first_run_dialog, GS, FIRST_RUN_DIALOG, GtkDialog)
 
-GType           gs_first_run_dialog_get_type   (void);
 GtkWidget      *gs_first_run_dialog_new        (void);
 
+G_END_DECLS
+
 #endif /* GS_FIRST_RUN_DIALOG_H */
 
 /* vim: set noexpandtab: */


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