Commit 22ae9d08 authored by Mohammed Sadiq's avatar Mohammed Sadiq Committed by Matthias Clasen
Browse files

examples: use G_DECLARE_FINAL_TYPE in applications

G_DECLARE_FINAL_TYPE was introduced in glib 2.44.
We shall use that now so that lots of boilerplate code can
be reduced.

https://bugzilla.gnome.org/show_bug.cgi?id=770278
parent d817d525
......@@ -8,11 +8,6 @@ struct _ExampleApp
GtkApplication parent;
};
struct _ExampleAppClass
{
GtkApplicationClass parent_class;
};
G_DEFINE_TYPE(ExampleApp, example_app, GTK_TYPE_APPLICATION);
static void
......
......@@ -5,14 +5,8 @@
#define EXAMPLE_APP_TYPE (example_app_get_type ())
#define EXAMPLE_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_TYPE, ExampleApp))
G_DECLARE_FINAL_TYPE (ExampleApp, example_app, EXAMPLE, APP, GtkApplication)
typedef struct _ExampleApp ExampleApp;
typedef struct _ExampleAppClass ExampleAppClass;
GType example_app_get_type (void);
ExampleApp *example_app_new (void);
......
......@@ -8,11 +8,6 @@ struct _ExampleAppWindow
GtkApplicationWindow parent;
};
struct _ExampleAppWindowClass
{
GtkApplicationWindowClass parent_class;
};
G_DEFINE_TYPE(ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW);
static void
......
......@@ -6,14 +6,9 @@
#define EXAMPLE_APP_WINDOW_TYPE (example_app_window_get_type ())
#define EXAMPLE_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_WINDOW_TYPE, ExampleAppWindow))
G_DECLARE_FINAL_TYPE (ExampleAppWindow, example_app_window, EXAMPLE, APP_WINDOW, GtkApplicationWindow)
typedef struct _ExampleAppWindow ExampleAppWindow;
typedef struct _ExampleAppWindowClass ExampleAppWindowClass;
GType example_app_window_get_type (void);
ExampleAppWindow *example_app_window_new (ExampleApp *app);
void example_app_window_open (ExampleAppWindow *win,
GFile *file);
......
......@@ -9,11 +9,6 @@ struct _ExampleApp
GtkApplication parent;
};
struct _ExampleAppClass
{
GtkApplicationClass parent_class;
};
G_DEFINE_TYPE(ExampleApp, example_app, GTK_TYPE_APPLICATION);
static void
......
......@@ -5,14 +5,9 @@
#define EXAMPLE_APP_TYPE (example_app_get_type ())
#define EXAMPLE_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_TYPE, ExampleApp))
G_DECLARE_FINAL_TYPE (ExampleApp, example_app, EXAMPLE, APP, GtkApplication)
typedef struct _ExampleApp ExampleApp;
typedef struct _ExampleAppClass ExampleAppClass;
GType example_app_get_type (void);
ExampleApp *example_app_new (void);
......
......@@ -9,11 +9,6 @@ struct _ExampleAppPrefs
GtkDialog parent;
};
struct _ExampleAppPrefsClass
{
GtkDialogClass parent_class;
};
typedef struct _ExampleAppPrefsPrivate ExampleAppPrefsPrivate;
struct _ExampleAppPrefsPrivate
......
......@@ -6,14 +6,9 @@
#define EXAMPLE_APP_PREFS_TYPE (example_app_prefs_get_type ())
#define EXAMPLE_APP_PREFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_PREFS_TYPE, ExampleAppPrefs))
G_DECLARE_FINAL_TYPE (ExampleAppPrefs, example_app_prefs, EXAMPLE, APP_PREFS, GtkDialog)
typedef struct _ExampleAppPrefs ExampleAppPrefs;
typedef struct _ExampleAppPrefsClass ExampleAppPrefsClass;
GType example_app_prefs_get_type (void);
ExampleAppPrefs *example_app_prefs_new (ExampleAppWindow *win);
......
......@@ -8,11 +8,6 @@ struct _ExampleAppWindow
GtkApplicationWindow parent;
};
struct _ExampleAppWindowClass
{
GtkApplicationWindowClass parent_class;
};
typedef struct _ExampleAppWindowPrivate ExampleAppWindowPrivate;
struct _ExampleAppWindowPrivate
......
......@@ -6,14 +6,8 @@
#define EXAMPLE_APP_WINDOW_TYPE (example_app_window_get_type ())
#define EXAMPLE_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_WINDOW_TYPE, ExampleAppWindow))
G_DECLARE_FINAL_TYPE (ExampleAppWindow, example_app_window, EXAMPLE, APP_WINDOW, GtkApplicationWindow)
typedef struct _ExampleAppWindow ExampleAppWindow;
typedef struct _ExampleAppWindowClass ExampleAppWindowClass;
GType example_app_window_get_type (void);
ExampleAppWindow *example_app_window_new (ExampleApp *app);
void example_app_window_open (ExampleAppWindow *win,
GFile *file);
......
......@@ -8,11 +8,6 @@ struct _ExampleApp
GtkApplication parent;
};
struct _ExampleAppClass
{
GtkApplicationClass parent_class;
};
G_DEFINE_TYPE(ExampleApp, example_app, GTK_TYPE_APPLICATION);
static void
......
......@@ -5,14 +5,9 @@
#define EXAMPLE_APP_TYPE (example_app_get_type ())
#define EXAMPLE_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_TYPE, ExampleApp))
G_DECLARE_FINAL_TYPE (ExampleApp, example_app, EXAMPLE, APP, GtkApplication)
typedef struct _ExampleApp ExampleApp;
typedef struct _ExampleAppClass ExampleAppClass;
GType example_app_get_type (void);
ExampleApp *example_app_new (void);
......
......@@ -8,11 +8,6 @@ struct _ExampleAppWindow
GtkApplicationWindow parent;
};
struct _ExampleAppWindowClass
{
GtkApplicationWindowClass parent_class;
};
G_DEFINE_TYPE(ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW);
static void
......
......@@ -6,14 +6,9 @@
#define EXAMPLE_APP_WINDOW_TYPE (example_app_window_get_type ())
#define EXAMPLE_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_WINDOW_TYPE, ExampleAppWindow))
G_DECLARE_FINAL_TYPE (ExampleAppWindow, example_app_window, EXAMPLE, APP_WINDOW, GtkApplicationWindow)
typedef struct _ExampleAppWindow ExampleAppWindow;
typedef struct _ExampleAppWindowClass ExampleAppWindowClass;
GType example_app_window_get_type (void);
ExampleAppWindow *example_app_window_new (ExampleApp *app);
void example_app_window_open (ExampleAppWindow *win,
GFile *file);
......
......@@ -8,11 +8,6 @@ struct _ExampleApp
GtkApplication parent;
};
struct _ExampleAppClass
{
GtkApplicationClass parent_class;
};
G_DEFINE_TYPE(ExampleApp, example_app, GTK_TYPE_APPLICATION);
static void
......
......@@ -5,14 +5,9 @@
#define EXAMPLE_APP_TYPE (example_app_get_type ())
#define EXAMPLE_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_TYPE, ExampleApp))
G_DECLARE_FINAL_TYPE (ExampleApp, example_app, EXAMPLE, APP, GtkApplication)
typedef struct _ExampleApp ExampleApp;
typedef struct _ExampleAppClass ExampleAppClass;
GType example_app_get_type (void);
ExampleApp *example_app_new (void);
......
......@@ -8,11 +8,6 @@ struct _ExampleAppWindow
GtkApplicationWindow parent;
};
struct _ExampleAppWindowClass
{
GtkApplicationWindowClass parent_class;
};
typedef struct _ExampleAppWindowPrivate ExampleAppWindowPrivate;
struct _ExampleAppWindowPrivate
......
......@@ -6,14 +6,9 @@
#define EXAMPLE_APP_WINDOW_TYPE (example_app_window_get_type ())
#define EXAMPLE_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_WINDOW_TYPE, ExampleAppWindow))
G_DECLARE_FINAL_TYPE (ExampleAppWindow, example_app_window, EXAMPLE, APP_WINDOW, GtkApplicationWindow)
typedef struct _ExampleAppWindow ExampleAppWindow;
typedef struct _ExampleAppWindowClass ExampleAppWindowClass;
GType example_app_window_get_type (void);
ExampleAppWindow *example_app_window_new (ExampleApp *app);
void example_app_window_open (ExampleAppWindow *win,
GFile *file);
......
......@@ -8,11 +8,6 @@ struct _ExampleApp
GtkApplication parent;
};
struct _ExampleAppClass
{
GtkApplicationClass parent_class;
};
G_DEFINE_TYPE(ExampleApp, example_app, GTK_TYPE_APPLICATION);
static void
......
......@@ -5,14 +5,9 @@
#define EXAMPLE_APP_TYPE (example_app_get_type ())
#define EXAMPLE_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_TYPE, ExampleApp))
G_DECLARE_FINAL_TYPE (ExampleApp, example_app, EXAMPLE, APP, GtkApplication)
typedef struct _ExampleApp ExampleApp;
typedef struct _ExampleAppClass ExampleAppClass;
GType example_app_get_type (void);
ExampleApp *example_app_new (void);
......
......@@ -8,11 +8,6 @@ struct _ExampleAppWindow
GtkApplicationWindow parent;
};
struct _ExampleAppWindowClass
{
GtkApplicationWindowClass parent_class;
};
typedef struct _ExampleAppWindowPrivate ExampleAppWindowPrivate;
struct _ExampleAppWindowPrivate
......
......@@ -6,14 +6,9 @@
#define EXAMPLE_APP_WINDOW_TYPE (example_app_window_get_type ())
#define EXAMPLE_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_WINDOW_TYPE, ExampleAppWindow))
G_DECLARE_FINAL_TYPE (ExampleAppWindow, example_app_window, EXAMPLE, APP_WINDOW, GtkApplicationWindow)
typedef struct _ExampleAppWindow ExampleAppWindow;
typedef struct _ExampleAppWindowClass ExampleAppWindowClass;
GType example_app_window_get_type (void);
ExampleAppWindow *example_app_window_new (ExampleApp *app);
void example_app_window_open (ExampleAppWindow *win,
GFile *file);
......
......@@ -8,11 +8,6 @@ struct _ExampleApp
GtkApplication parent;
};
struct _ExampleAppClass
{
GtkApplicationClass parent_class;
};
G_DEFINE_TYPE(ExampleApp, example_app, GTK_TYPE_APPLICATION);
static void
......
......@@ -5,14 +5,9 @@
#define EXAMPLE_APP_TYPE (example_app_get_type ())
#define EXAMPLE_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_TYPE, ExampleApp))
G_DECLARE_FINAL_TYPE (ExampleApp, example_app, EXAMPLE, APP, GtkApplication)
typedef struct _ExampleApp ExampleApp;
typedef struct _ExampleAppClass ExampleAppClass;
GType example_app_get_type (void);
ExampleApp *example_app_new (void);
......
......@@ -8,11 +8,6 @@ struct _ExampleAppWindow
GtkApplicationWindow parent;
};
struct _ExampleAppWindowClass
{
GtkApplicationWindowClass parent_class;
};
typedef struct _ExampleAppWindowPrivate ExampleAppWindowPrivate;
struct _ExampleAppWindowPrivate
......
......@@ -6,14 +6,9 @@
#define EXAMPLE_APP_WINDOW_TYPE (example_app_window_get_type ())
#define EXAMPLE_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_WINDOW_TYPE, ExampleAppWindow))
G_DECLARE_FINAL_TYPE (ExampleAppWindow, example_app_window, EXAMPLE, APP_WINDOW, GtkApplicationWindow)
typedef struct _ExampleAppWindow ExampleAppWindow;
typedef struct _ExampleAppWindowClass ExampleAppWindowClass;
GType example_app_window_get_type (void);
ExampleAppWindow *example_app_window_new (ExampleApp *app);
void example_app_window_open (ExampleAppWindow *win,
GFile *file);
......
......@@ -4,16 +4,11 @@
#include "exampleappwin.h"
#include "exampleappprefs.h"
struct ExampleApp
struct _ExampleApp
{
GtkApplication parent;
};
struct ExampleAppClass
{
GtkApplicationClass parent_class;
};
G_DEFINE_TYPE(ExampleApp, example_app, GTK_TYPE_APPLICATION);
static void
......
......@@ -5,14 +5,9 @@
#define EXAMPLE_APP_TYPE (example_app_get_type ())
#define EXAMPLE_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_TYPE, ExampleApp))
G_DECLARE_FINAL_TYPE (ExampleApp, example_app, EXAMPLE, APP, GtkApplication)
typedef struct ExampleApp ExampleApp;
typedef struct ExampleAppClass ExampleAppClass;
GType example_app_get_type (void);
ExampleApp *example_app_new (void);
......
......@@ -9,11 +9,6 @@ struct _ExampleAppPrefs
GtkDialog parent;
};
struct _ExampleAppPrefsClass
{
GtkDialogClass parent_class;
};
typedef struct _ExampleAppPrefsPrivate ExampleAppPrefsPrivate;
struct _ExampleAppPrefsPrivate
......
......@@ -6,14 +6,9 @@
#define EXAMPLE_APP_PREFS_TYPE (example_app_prefs_get_type ())
#define EXAMPLE_APP_PREFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_PREFS_TYPE, ExampleAppPrefs))
G_DECLARE_FINAL_TYPE (ExampleAppPrefs, example_app_prefs, EXAMPLE, APP_PREFS, GtkDialog)
typedef struct _ExampleAppPrefs ExampleAppPrefs;
typedef struct _ExampleAppPrefsClass ExampleAppPrefsClass;
GType example_app_prefs_get_type (void);
ExampleAppPrefs *example_app_prefs_new (ExampleAppWindow *win);
......
......@@ -3,16 +3,11 @@
#include "exampleapp.h"
#include "exampleappwin.h"
struct ExampleAppWindow
struct _ExampleAppWindow
{
GtkApplicationWindow parent;
};
struct ExampleAppWindowClass
{
GtkApplicationWindowClass parent_class;
};
typedef struct ExampleAppWindowPrivate ExampleAppWindowPrivate;
struct ExampleAppWindowPrivate
......
......@@ -6,14 +6,9 @@
#define EXAMPLE_APP_WINDOW_TYPE (example_app_window_get_type ())
#define EXAMPLE_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_WINDOW_TYPE, ExampleAppWindow))
G_DECLARE_FINAL_TYPE (ExampleAppWindow, example_app_window, EXAMPLE, APP_WINDOW, GtkApplicationWindow)
typedef struct ExampleAppWindow ExampleAppWindow;
typedef struct ExampleAppWindowClass ExampleAppWindowClass;
GType example_app_window_get_type (void);
ExampleAppWindow *example_app_window_new (ExampleApp *app);
void example_app_window_open (ExampleAppWindow *win,
GFile *file);
......
......@@ -9,11 +9,6 @@ struct _ExampleApp
GtkApplication parent;
};
struct _ExampleAppClass
{
GtkApplicationClass parent_class;
};
G_DEFINE_TYPE(ExampleApp, example_app, GTK_TYPE_APPLICATION);
static void
......
......@@ -5,14 +5,9 @@
#define EXAMPLE_APP_TYPE (example_app_get_type ())
#define EXAMPLE_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_TYPE, ExampleApp))
G_DECLARE_FINAL_TYPE (ExampleApp, example_app, EXAMPLE, APP, GtkApplication)
typedef struct _ExampleApp ExampleApp;
typedef struct _ExampleAppClass ExampleAppClass;
GType example_app_get_type (void);
ExampleApp *example_app_new (void);
......
......@@ -9,11 +9,6 @@ struct _ExampleAppPrefs
GtkDialog parent;
};
struct _ExampleAppPrefsClass
{
GtkDialogClass parent_class;
};
typedef struct _ExampleAppPrefsPrivate ExampleAppPrefsPrivate;
struct _ExampleAppPrefsPrivate
......
......@@ -6,14 +6,9 @@
#define EXAMPLE_APP_PREFS_TYPE (example_app_prefs_get_type ())
#define EXAMPLE_APP_PREFS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_PREFS_TYPE, ExampleAppPrefs))
G_DECLARE_FINAL_TYPE (ExampleAppPrefs, example_app_prefs, EXAMPLE, APP_PREFS, GtkDialog)
typedef struct _ExampleAppPrefs ExampleAppPrefs;
typedef struct _ExampleAppPrefsClass ExampleAppPrefsClass;
GType example_app_prefs_get_type (void);
ExampleAppPrefs *example_app_prefs_new (ExampleAppWindow *win);
......
......@@ -8,11 +8,6 @@ struct _ExampleAppWindow
GtkApplicationWindow parent;
};
struct _ExampleAppWindowClass
{
GtkApplicationWindowClass parent_class;
};
typedef struct _ExampleAppWindowPrivate ExampleAppWindowPrivate;
struct _ExampleAppWindowPrivate
......
......@@ -6,14 +6,9 @@
#define EXAMPLE_APP_WINDOW_TYPE (example_app_window_get_type ())
#define EXAMPLE_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_WINDOW_TYPE, ExampleAppWindow))
G_DECLARE_FINAL_TYPE (ExampleAppWindow, example_app_window, EXAMPLE, APP_WINDOW, GtkApplicationWindow)
typedef struct _ExampleAppWindow ExampleAppWindow;
typedef struct _ExampleAppWindowClass ExampleAppWindowClass;
GType example_app_window_get_type (void);
ExampleAppWindow *example_app_window_new (ExampleApp *app);
void example_app_window_open (ExampleAppWindow *win,
GFile *file);
......
......@@ -9,11 +9,6 @@ struct _ExampleApp
GtkApplication parent;
};
struct _ExampleAppClass
{
GtkApplicationClass parent_class;
};
G_DEFINE_TYPE(ExampleApp, example_app, GTK_TYPE_APPLICATION);
static void
......
......@@ -5,14 +5,9 @@
#define EXAMPLE_APP_TYPE (example_app_get_type ())
#define EXAMPLE_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EXAMPLE_APP_TYPE, ExampleApp))
G_DECLARE_FINAL_TYPE (ExampleApp, example_app, EXAMPLE, APP, GtkApplication)
typedef struct _ExampleApp ExampleApp;
typedef struct _ExampleAppClass ExampleAppClass;
GType example_app_get_type