diff options
author | Mohammed Sadiq <sadiq@sadiqpk.org> | 2016-09-06 23:26:22 +0530 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2016-09-10 09:01:08 -0400 |
commit | 22ae9d0884fffb61ee826ec450e8d62ad1cdb957 (patch) | |
tree | 079de6f4aabf11fe90a4b159fd486dfbc234ba95 /examples/application1 | |
parent | d817d525e6bbc4a5abeb304f037d30a29c6c76b4 (diff) | |
download | gtk+-22ae9d0884fffb61ee826ec450e8d62ad1cdb957.tar.gz |
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
Diffstat (limited to 'examples/application1')
-rw-r--r-- | examples/application1/exampleapp.c | 5 | ||||
-rw-r--r-- | examples/application1/exampleapp.h | 8 | ||||
-rw-r--r-- | examples/application1/exampleappwin.c | 5 | ||||
-rw-r--r-- | examples/application1/exampleappwin.h | 7 |
4 files changed, 2 insertions, 23 deletions
diff --git a/examples/application1/exampleapp.c b/examples/application1/exampleapp.c index 6c4c5ed3cc..565bc35c75 100644 --- a/examples/application1/exampleapp.c +++ b/examples/application1/exampleapp.c @@ -8,11 +8,6 @@ struct _ExampleApp GtkApplication parent; }; -struct _ExampleAppClass -{ - GtkApplicationClass parent_class; -}; - G_DEFINE_TYPE(ExampleApp, example_app, GTK_TYPE_APPLICATION); static void diff --git a/examples/application1/exampleapp.h b/examples/application1/exampleapp.h index 824049d699..f7b837fbd5 100644 --- a/examples/application1/exampleapp.h +++ b/examples/application1/exampleapp.h @@ -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); diff --git a/examples/application1/exampleappwin.c b/examples/application1/exampleappwin.c index a4e9733e34..24dd05dd9f 100644 --- a/examples/application1/exampleappwin.c +++ b/examples/application1/exampleappwin.c @@ -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 diff --git a/examples/application1/exampleappwin.h b/examples/application1/exampleappwin.h index ed4b34fcf5..786338d083 100644 --- a/examples/application1/exampleappwin.h +++ b/examples/application1/exampleappwin.h @@ -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); |