From 294702d3f170350534f4505d862c19e0699f8fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 24 Sep 2015 20:07:44 +0200 Subject: [PATCH] shell: Use G_DECLARE_*_TYPE macros Cut down on boilerplate by using the (no longer that) new helper macros. We don't care about breaking ABI in private libraries, so use G_DECLARE_FINAL_TYPE even where the class struct used to be exposed in the header, except for types we inherit from ourselves (obviously) or where the class exposes any vfuncs (where changes could affect inheritance in extensions). --- src/shell-app-system.c | 9 +++++ src/shell-app-system.h | 26 ++------------ src/shell-app-usage.h | 18 ++-------- src/shell-app.h | 21 ++--------- src/shell-embedded-window.c | 50 +++++++++++++++++--------- src/shell-embedded-window.h | 22 ++---------- src/shell-generic-container.c | 9 +++++ src/shell-generic-container.h | 28 ++------------- src/shell-global.h | 18 ++-------- src/shell-glsl-quad.c | 18 ++++++---- src/shell-glsl-quad.h | 22 ++---------- src/shell-gtk-embed.c | 65 +++++++++++++++++++--------------- src/shell-gtk-embed.h | 21 ++--------- src/shell-keyring-prompt.c | 6 ---- src/shell-keyring-prompt.h | 8 ++--- src/shell-mount-operation.c | 9 +++++ src/shell-mount-operation.h | 27 ++------------ src/shell-perf-log.c | 5 --- src/shell-perf-log.h | 13 ++----- src/shell-recorder.c | 5 --- src/shell-recorder.h | 13 ++----- src/shell-screenshot.c | 5 +-- src/shell-screenshot.h | 16 ++------- src/shell-secure-text-buffer.c | 7 ---- src/shell-secure-text-buffer.h | 8 ++--- src/shell-stack.c | 9 +++-- src/shell-stack.h | 27 ++------------ src/shell-tray-icon.c | 9 +++++ src/shell-tray-icon.h | 27 ++------------ src/shell-tray-manager.c | 9 +++++ src/shell-tray-manager.h | 27 ++------------ src/shell-window-tracker.h | 20 ++--------- src/shell-wm.h | 19 ++-------- 33 files changed, 183 insertions(+), 413 deletions(-) diff --git a/src/shell-app-system.c b/src/shell-app-system.c index 108b616c4..ef86f866c 100644 --- a/src/shell-app-system.c +++ b/src/shell-app-system.c @@ -37,6 +37,15 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; +typedef struct _ShellAppSystemPrivate ShellAppSystemPrivate; + +struct _ShellAppSystem +{ + GObject parent; + + ShellAppSystemPrivate *priv; +}; + struct _ShellAppSystemPrivate { GHashTable *running_apps; GHashTable *id_to_app; diff --git a/src/shell-app-system.h b/src/shell-app-system.h index f9ed003cb..445671f5b 100644 --- a/src/shell-app-system.h +++ b/src/shell-app-system.h @@ -8,30 +8,10 @@ #include "shell-app.h" -#define SHELL_TYPE_APP_SYSTEM (shell_app_system_get_type ()) -#define SHELL_APP_SYSTEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SHELL_TYPE_APP_SYSTEM, ShellAppSystem)) -#define SHELL_APP_SYSTEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_APP_SYSTEM, ShellAppSystemClass)) -#define SHELL_IS_APP_SYSTEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SHELL_TYPE_APP_SYSTEM)) -#define SHELL_IS_APP_SYSTEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_APP_SYSTEM)) -#define SHELL_APP_SYSTEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_APP_SYSTEM, ShellAppSystemClass)) +#define SHELL_TYPE_APP_SYSTEM (shell_app_system_get_type ()) +G_DECLARE_FINAL_TYPE (ShellAppSystem, shell_app_system, + SHELL, APP_SYSTEM, GObject) -typedef struct _ShellAppSystem ShellAppSystem; -typedef struct _ShellAppSystemClass ShellAppSystemClass; -typedef struct _ShellAppSystemPrivate ShellAppSystemPrivate; - -struct _ShellAppSystem -{ - GObject parent; - - ShellAppSystemPrivate *priv; -}; - -struct _ShellAppSystemClass -{ - GObjectClass parent_class; -}; - -GType shell_app_system_get_type (void) G_GNUC_CONST; ShellAppSystem *shell_app_system_get_default (void); ShellApp *shell_app_system_lookup_app (ShellAppSystem *system, diff --git a/src/shell-app-usage.h b/src/shell-app-usage.h index 4afdbb3ec..18ff2cdc8 100644 --- a/src/shell-app-usage.h +++ b/src/shell-app-usage.h @@ -7,23 +7,9 @@ G_BEGIN_DECLS -typedef struct _ShellAppUsage ShellAppUsage; -typedef struct _ShellAppUsageClass ShellAppUsageClass; -typedef struct _ShellAppUsagePrivate ShellAppUsagePrivate; - #define SHELL_TYPE_APP_USAGE (shell_app_usage_get_type ()) -#define SHELL_APP_USAGE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), SHELL_TYPE_APP_USAGE, ShellAppUsage)) -#define SHELL_APP_USAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_APP_USAGE, ShellAppUsageClass)) -#define SHELL_IS_APP_USAGE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), SHELL_TYPE_APP_USAGE)) -#define SHELL_IS_APP_USAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_APP_USAGE)) -#define SHELL_APP_USAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_APP_USAGE, ShellAppUsageClass)) - -struct _ShellAppUsageClass -{ - GObjectClass parent_class; -}; - -GType shell_app_usage_get_type (void) G_GNUC_CONST; +G_DECLARE_FINAL_TYPE (ShellAppUsage, shell_app_usage, + SHELL, APP_USAGE, GObject) ShellAppUsage* shell_app_usage_get_default(void); diff --git a/src/shell-app.h b/src/shell-app.h index 42594cb44..7fc582a2a 100644 --- a/src/shell-app.h +++ b/src/shell-app.h @@ -9,23 +9,8 @@ G_BEGIN_DECLS -typedef struct _ShellApp ShellApp; -typedef struct _ShellAppClass ShellAppClass; -typedef struct _ShellAppPrivate ShellAppPrivate; -typedef struct _ShellAppAction ShellAppAction; - -#define SHELL_TYPE_APP (shell_app_get_type ()) -#define SHELL_APP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), SHELL_TYPE_APP, ShellApp)) -#define SHELL_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_APP, ShellAppClass)) -#define SHELL_IS_APP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), SHELL_TYPE_APP)) -#define SHELL_IS_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_APP)) -#define SHELL_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_APP, ShellAppClass)) - -struct _ShellAppClass -{ - GObjectClass parent_class; - -}; +#define SHELL_TYPE_APP (shell_app_get_type ()) +G_DECLARE_FINAL_TYPE (ShellApp, shell_app, SHELL, APP, GObject) typedef enum { SHELL_APP_STATE_STOPPED, @@ -33,8 +18,6 @@ typedef enum { SHELL_APP_STATE_RUNNING } ShellAppState; -GType shell_app_get_type (void) G_GNUC_CONST; - const char *shell_app_get_id (ShellApp *app); GDesktopAppInfo *shell_app_get_app_info (ShellApp *app); diff --git a/src/shell-embedded-window.c b/src/shell-embedded-window.c index 26468f6ae..3719577d1 100644 --- a/src/shell-embedded-window.c +++ b/src/shell-embedded-window.c @@ -27,6 +27,8 @@ enum { PROP_0 }; +typedef struct _ShellEmbeddedWindowPrivate ShellEmbeddedWindowPrivate; + struct _ShellEmbeddedWindowPrivate { ShellGtkEmbed *actor; @@ -49,19 +51,22 @@ static void shell_embedded_window_show (GtkWidget *widget) { ShellEmbeddedWindow *window = SHELL_EMBEDDED_WINDOW (widget); + ShellEmbeddedWindowPrivate *priv; GtkWidgetClass *widget_class; + priv = shell_embedded_window_get_instance_private (window); + /* Skip GtkWindow, but run the default GtkWidget handling which * marks the widget visible */ widget_class = g_type_class_peek (GTK_TYPE_WIDGET); widget_class->show (widget); - if (window->priv->actor) + if (priv->actor) { /* Size is 0x0 if the GtkWindow is not shown */ - clutter_actor_queue_relayout (CLUTTER_ACTOR (window->priv->actor)); + clutter_actor_queue_relayout (CLUTTER_ACTOR (priv->actor)); - if (clutter_actor_is_realized (CLUTTER_ACTOR (window->priv->actor))) + if (clutter_actor_is_realized (CLUTTER_ACTOR (priv->actor))) gtk_widget_map (widget); } } @@ -70,9 +75,12 @@ static void shell_embedded_window_hide (GtkWidget *widget) { ShellEmbeddedWindow *window = SHELL_EMBEDDED_WINDOW (widget); + ShellEmbeddedWindowPrivate *priv; - if (window->priv->actor) - clutter_actor_queue_relayout (CLUTTER_ACTOR (window->priv->actor)); + priv = shell_embedded_window_get_instance_private (window); + + if (priv->actor) + clutter_actor_queue_relayout (CLUTTER_ACTOR (priv->actor)); GTK_WIDGET_CLASS (shell_embedded_window_parent_class)->hide (widget); } @@ -92,6 +100,9 @@ static void shell_embedded_window_check_resize (GtkContainer *container) { ShellEmbeddedWindow *window = SHELL_EMBEDDED_WINDOW (container); + ShellEmbeddedWindowPrivate *priv; + + priv = shell_embedded_window_get_instance_private (window); /* Check resize is called when a resize is queued on something * inside the GtkWindow; we need to make sure that in response @@ -99,8 +110,8 @@ shell_embedded_window_check_resize (GtkContainer *container) * gtk_widget_size_allocate() are called; we defer to the Clutter * logic and assume it will do the right thing. */ - if (window->priv->actor) - clutter_actor_queue_relayout (CLUTTER_ACTOR (window->priv->actor)); + if (priv->actor) + clutter_actor_queue_relayout (CLUTTER_ACTOR (priv->actor)); } static GObject * @@ -148,7 +159,6 @@ shell_embedded_window_class_init (ShellEmbeddedWindowClass *klass) static void shell_embedded_window_init (ShellEmbeddedWindow *window) { - window->priv = shell_embedded_window_get_instance_private (window); } /* @@ -160,9 +170,12 @@ _shell_embedded_window_set_actor (ShellEmbeddedWindow *window, ShellGtkEmbed *actor) { + ShellEmbeddedWindowPrivate *priv; + g_return_if_fail (SHELL_IS_EMBEDDED_WINDOW (window)); - window->priv->actor = actor; + priv = shell_embedded_window_get_instance_private (window); + priv->actor = actor; if (actor && clutter_actor_is_mapped (CLUTTER_ACTOR (actor)) && @@ -177,20 +190,23 @@ _shell_embedded_window_allocate (ShellEmbeddedWindow *window, int width, int height) { + ShellEmbeddedWindowPrivate *priv; GtkAllocation allocation; g_return_if_fail (SHELL_IS_EMBEDDED_WINDOW (window)); - if (window->priv->position.x == x && - window->priv->position.y == y && - window->priv->position.width == width && - window->priv->position.height == height) + priv = shell_embedded_window_get_instance_private (window); + + if (priv->position.x == x && + priv->position.y == y && + priv->position.width == width && + priv->position.height == height) return; - window->priv->position.x = x; - window->priv->position.y = y; - window->priv->position.width = width; - window->priv->position.height = height; + priv->position.x = x; + priv->position.y = y; + priv->position.width = width; + priv->position.height = height; if (gtk_widget_get_realized (GTK_WIDGET (window))) gdk_window_move_resize (gtk_widget_get_window (GTK_WIDGET (window)), diff --git a/src/shell-embedded-window.h b/src/shell-embedded-window.h index fde8006c6..835165ba9 100644 --- a/src/shell-embedded-window.h +++ b/src/shell-embedded-window.h @@ -5,31 +5,15 @@ #include #include -#define SHELL_TYPE_EMBEDDED_WINDOW (shell_embedded_window_get_type ()) -#define SHELL_EMBEDDED_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SHELL_TYPE_EMBEDDED_WINDOW, ShellEmbeddedWindow)) -#define SHELL_EMBEDDED_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_EMBEDDED_WINDOW, ShellEmbeddedWindowClass)) -#define SHELL_IS_EMBEDDED_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SHELL_TYPE_EMBEDDED_WINDOW)) -#define SHELL_IS_EMBEDDED_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_EMBEDDED_WINDOW)) -#define SHELL_EMBEDDED_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_EMBEDDED_WINDOW, ShellEmbeddedWindowClass)) - -typedef struct _ShellEmbeddedWindow ShellEmbeddedWindow; -typedef struct _ShellEmbeddedWindowClass ShellEmbeddedWindowClass; - -typedef struct _ShellEmbeddedWindowPrivate ShellEmbeddedWindowPrivate; - -struct _ShellEmbeddedWindow -{ - GtkWindow parent; - - ShellEmbeddedWindowPrivate *priv; -}; +#define SHELL_TYPE_EMBEDDED_WINDOW (shell_embedded_window_get_type ()) +G_DECLARE_DERIVABLE_TYPE (ShellEmbeddedWindow, shell_embedded_window, + SHELL, EMBEDDED_WINDOW, GtkWindow) struct _ShellEmbeddedWindowClass { GtkWindowClass parent_class; }; -GType shell_embedded_window_get_type (void) G_GNUC_CONST; GtkWidget *shell_embedded_window_new (void); #endif /* __SHELL_EMBEDDED_WINDOW_H__ */ diff --git a/src/shell-generic-container.c b/src/shell-generic-container.c index aff6a050e..35aaa8447 100644 --- a/src/shell-generic-container.c +++ b/src/shell-generic-container.c @@ -23,6 +23,15 @@ static void shell_generic_container_iface_init (ClutterContainerIface *iface); +typedef struct _ShellGenericContainerPrivate ShellGenericContainerPrivate; + +struct _ShellGenericContainer +{ + StWidget parent; + + ShellGenericContainerPrivate *priv; +}; + struct _ShellGenericContainerPrivate { GHashTable *skip_paint; }; diff --git a/src/shell-generic-container.h b/src/shell-generic-container.h index 93637bb37..61b551d36 100644 --- a/src/shell-generic-container.h +++ b/src/shell-generic-container.h @@ -4,12 +4,9 @@ #include "st.h" -#define SHELL_TYPE_GENERIC_CONTAINER (shell_generic_container_get_type ()) -#define SHELL_GENERIC_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SHELL_TYPE_GENERIC_CONTAINER, ShellGenericContainer)) -#define SHELL_GENERIC_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_GENERIC_CONTAINER, ShellGenericContainerClass)) -#define SHELL_IS_GENERIC_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SHELL_TYPE_GENERIC_CONTAINER)) -#define SHELL_IS_GENERIC_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_GENERIC_CONTAINER)) -#define SHELL_GENERIC_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_GENERIC_CONTAINER, ShellGenericContainerClass)) +#define SHELL_TYPE_GENERIC_CONTAINER (shell_generic_container_get_type ()) +G_DECLARE_FINAL_TYPE (ShellGenericContainer, shell_generic_container, + SHELL, GENERIC_CONTAINER, StWidget) typedef struct { float min_size; @@ -22,25 +19,6 @@ typedef struct { #define SHELL_TYPE_GENERIC_CONTAINER_ALLOCATION (shell_generic_container_allocation_get_type ()) GType shell_generic_container_allocation_get_type (void); -typedef struct _ShellGenericContainer ShellGenericContainer; -typedef struct _ShellGenericContainerClass ShellGenericContainerClass; - -typedef struct _ShellGenericContainerPrivate ShellGenericContainerPrivate; - -struct _ShellGenericContainer -{ - StWidget parent; - - ShellGenericContainerPrivate *priv; -}; - -struct _ShellGenericContainerClass -{ - StWidgetClass parent_class; -}; - -GType shell_generic_container_get_type (void) G_GNUC_CONST; - guint shell_generic_container_get_n_skip_paint (ShellGenericContainer *self); gboolean shell_generic_container_get_skip_paint (ShellGenericContainer *self, diff --git a/src/shell-global.h b/src/shell-global.h index b10c5e608..c043f4714 100644 --- a/src/shell-global.h +++ b/src/shell-global.h @@ -10,22 +10,8 @@ G_BEGIN_DECLS -typedef struct _ShellGlobal ShellGlobal; -typedef struct _ShellGlobalClass ShellGlobalClass; - -#define SHELL_TYPE_GLOBAL (shell_global_get_type ()) -#define SHELL_GLOBAL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), SHELL_TYPE_GLOBAL, ShellGlobal)) -#define SHELL_GLOBAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_GLOBAL, ShellGlobalClass)) -#define SHELL_IS_GLOBAL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), SHELL_TYPE_GLOBAL)) -#define SHELL_IS_GLOBAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_GLOBAL)) -#define SHELL_GLOBAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_GLOBAL, ShellGlobalClass)) - -struct _ShellGlobalClass -{ - GObjectClass parent_class; -}; - -GType shell_global_get_type (void) G_GNUC_CONST; +#define SHELL_TYPE_GLOBAL (shell_global_get_type ()) +G_DECLARE_FINAL_TYPE (ShellGlobal, shell_global, SHELL, GLOBAL, GObject) ShellGlobal *shell_global_get (void); diff --git a/src/shell-glsl-quad.c b/src/shell-glsl-quad.c index 0c021d57f..b6c591ad3 100644 --- a/src/shell-glsl-quad.c +++ b/src/shell-glsl-quad.c @@ -16,6 +16,7 @@ #include #include "shell-glsl-quad.h" +typedef struct _ShellGLSLQuadPrivate ShellGLSLQuadPrivate; struct _ShellGLSLQuadPrivate { CoglPipeline *pipeline; @@ -38,7 +39,7 @@ shell_glsl_quad_paint (ClutterActor *actor) guint8 paint_opacity; ClutterActorBox box; - priv = self->priv; + priv = shell_glsl_quad_get_instance_private (self); paint_opacity = clutter_actor_get_paint_opacity (actor); clutter_actor_get_allocation_box (actor, &box); @@ -106,7 +107,7 @@ shell_glsl_quad_dispose (GObject *gobject) ShellGLSLQuad *self = SHELL_GLSL_QUAD (gobject); ShellGLSLQuadPrivate *priv; - priv = self->priv; + priv = shell_glsl_quad_get_instance_private (self); g_clear_pointer (&priv->pipeline, cogl_object_unref); @@ -116,7 +117,6 @@ shell_glsl_quad_dispose (GObject *gobject) static void shell_glsl_quad_init (ShellGLSLQuad *quad) { - quad->priv = shell_glsl_quad_get_instance_private (quad); } static void @@ -124,6 +124,7 @@ shell_glsl_quad_constructed (GObject *object) { ShellGLSLQuad *self; ShellGLSLQuadClass *klass; + ShellGLSLQuadPrivate *priv; CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ()); @@ -135,6 +136,7 @@ shell_glsl_quad_constructed (GObject *object) */ klass = SHELL_GLSL_QUAD_GET_CLASS (object); self = SHELL_GLSL_QUAD (object); + priv = shell_glsl_quad_get_instance_private (self); if (G_UNLIKELY (klass->base_pipeline == NULL)) { @@ -145,9 +147,9 @@ shell_glsl_quad_constructed (GObject *object) klass->build_pipeline (self); } - self->priv->pipeline = cogl_pipeline_copy (klass->base_pipeline); + priv->pipeline = cogl_pipeline_copy (klass->base_pipeline); - cogl_pipeline_set_layer_null_texture (self->priv->pipeline, 0, COGL_TEXTURE_TYPE_2D); + cogl_pipeline_set_layer_null_texture (priv->pipeline, 0, COGL_TEXTURE_TYPE_2D); } static void @@ -175,7 +177,8 @@ int shell_glsl_quad_get_uniform_location (ShellGLSLQuad *quad, const char *name) { - return cogl_pipeline_get_uniform_location (quad->priv->pipeline, name); + ShellGLSLQuadPrivate *priv = shell_glsl_quad_get_instance_private (quad); + return cogl_pipeline_get_uniform_location (priv->pipeline, name); } /** @@ -193,7 +196,8 @@ shell_glsl_quad_set_uniform_float (ShellGLSLQuad *quad, int total_count, const float *value) { - cogl_pipeline_set_uniform_float (quad->priv->pipeline, uniform, + ShellGLSLQuadPrivate *priv = shell_glsl_quad_get_instance_private (quad); + cogl_pipeline_set_uniform_float (priv->pipeline, uniform, n_components, total_count / n_components, value); } diff --git a/src/shell-glsl-quad.h b/src/shell-glsl-quad.h index f2b19bcd2..da2c480dd 100644 --- a/src/shell-glsl-quad.h +++ b/src/shell-glsl-quad.h @@ -26,23 +26,9 @@ typedef enum { SHELL_SNIPPET_HOOK_TEXTURE_LOOKUP } ShellSnippetHook; -#define SHELL_TYPE_GLSL_QUAD (shell_glsl_quad_get_type ()) -#define SHELL_GLSL_QUAD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SHELL_TYPE_GLSL_QUAD, ShellGLSLQuad)) -#define SHELL_GLSL_QUAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_GLSL_QUAD, ShellGLSLQuadClass)) -#define SHELL_IS_GLSL_QUAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SHELL_TYPE_GLSL_QUAD)) -#define SHELL_IS_GLSL_QUAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_GLSL_QUAD)) -#define SHELL_GLSL_QUAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_GLSL_QUAD, ShellGLSLQuadClass)) - -typedef struct _ShellGLSLQuad ShellGLSLQuad; -typedef struct _ShellGLSLQuadClass ShellGLSLQuadClass; -typedef struct _ShellGLSLQuadPrivate ShellGLSLQuadPrivate; - -struct _ShellGLSLQuad -{ - ClutterActor parent; - - ShellGLSLQuadPrivate *priv; -}; +#define SHELL_TYPE_GLSL_QUAD (shell_glsl_quad_get_type ()) +G_DECLARE_DERIVABLE_TYPE (ShellGLSLQuad, shell_glsl_quad, + SHELL, GLSL_QUAD, ClutterActor) struct _ShellGLSLQuadClass { @@ -53,8 +39,6 @@ struct _ShellGLSLQuadClass void (*build_pipeline) (ShellGLSLQuad *effect); }; -GType shell_glsl_quad_get_type (void) G_GNUC_CONST; - void shell_glsl_quad_add_glsl_snippet (ShellGLSLQuad *quad, ShellSnippetHook hook, const char *declarations, diff --git a/src/shell-gtk-embed.c b/src/shell-gtk-embed.c index 6b87553e4..3f306136f 100644 --- a/src/shell-gtk-embed.c +++ b/src/shell-gtk-embed.c @@ -15,6 +15,8 @@ enum { PROP_WINDOW }; +typedef struct _ShellGtkEmbedPrivate ShellGtkEmbedPrivate; + struct _ShellGtkEmbedPrivate { ShellEmbeddedWindow *window; @@ -40,7 +42,7 @@ shell_gtk_embed_on_window_destroy (GtkWidget *object, static void shell_gtk_embed_remove_window_actor (ShellGtkEmbed *embed) { - ShellGtkEmbedPrivate *priv = embed->priv; + ShellGtkEmbedPrivate *priv = shell_gtk_embed_get_instance_private (embed); if (priv->window_actor) { @@ -60,7 +62,7 @@ shell_gtk_embed_window_created_cb (MetaDisplay *display, MetaWindow *window, ShellGtkEmbed *embed) { - ShellGtkEmbedPrivate *priv = embed->priv; + ShellGtkEmbedPrivate *priv = shell_gtk_embed_get_instance_private (embed); Window xwindow = meta_window_get_xwindow (window); GdkWindow *gdk_window = gtk_widget_get_window (GTK_WIDGET (priv->window)); @@ -119,11 +121,12 @@ static void shell_gtk_embed_on_window_mapped (GtkWidget *object, ShellGtkEmbed *embed) { + ShellGtkEmbedPrivate *priv = shell_gtk_embed_get_instance_private (embed); MetaDisplay *display = shell_global_get_display (shell_global_get ()); /* Listen for new windows so we can detect when Mutter has created a MutterWindow for this window */ - embed->priv->window_created_handler = + priv->window_created_handler = g_signal_connect (display, "window-created", G_CALLBACK (shell_gtk_embed_window_created_cb), @@ -134,44 +137,45 @@ static void shell_gtk_embed_set_window (ShellGtkEmbed *embed, ShellEmbeddedWindow *window) { + ShellGtkEmbedPrivate *priv = shell_gtk_embed_get_instance_private (embed); MetaDisplay *display = shell_global_get_display (shell_global_get ()); - if (embed->priv->window) + if (priv->window) { - if (embed->priv->window_created_handler) + if (priv->window_created_handler) { g_signal_handler_disconnect (display, - embed->priv->window_created_handler); - embed->priv->window_created_handler = 0; + priv->window_created_handler); + priv->window_created_handler = 0; } shell_gtk_embed_remove_window_actor (embed); - _shell_embedded_window_set_actor (embed->priv->window, NULL); + _shell_embedded_window_set_actor (priv->window, NULL); - g_object_unref (embed->priv->window); + g_object_unref (priv->window); - g_signal_handlers_disconnect_by_func (embed->priv->window, + g_signal_handlers_disconnect_by_func (priv->window, (gpointer)shell_gtk_embed_on_window_destroy, embed); - g_signal_handlers_disconnect_by_func (embed->priv->window, + g_signal_handlers_disconnect_by_func (priv->window, (gpointer)shell_gtk_embed_on_window_mapped, embed); } - embed->priv->window = window; + priv->window = window; - if (embed->priv->window) + if (priv->window) { - g_object_ref (embed->priv->window); + g_object_ref (priv->window); - _shell_embedded_window_set_actor (embed->priv->window, embed); + _shell_embedded_window_set_actor (priv->window, embed); - g_signal_connect (embed->priv->window, "destroy", + g_signal_connect (priv->window, "destroy", G_CALLBACK (shell_gtk_embed_on_window_destroy), embed); - g_signal_connect (embed->priv->window, "map", + g_signal_connect (priv->window, "map", G_CALLBACK (shell_gtk_embed_on_window_mapped), embed); } @@ -205,11 +209,12 @@ shell_gtk_embed_get_property (GObject *object, GParamSpec *pspec) { ShellGtkEmbed *embed = SHELL_GTK_EMBED (object); + ShellGtkEmbedPrivate *priv = shell_gtk_embed_get_instance_private (embed); switch (prop_id) { case PROP_WINDOW: - g_value_set_object (value, embed->priv->window); + g_value_set_object (value, priv->window); break; default: @@ -225,12 +230,13 @@ shell_gtk_embed_get_preferred_width (ClutterActor *actor, float *natural_width_p) { ShellGtkEmbed *embed = SHELL_GTK_EMBED (actor); + ShellGtkEmbedPrivate *priv = shell_gtk_embed_get_instance_private (embed); - if (embed->priv->window - && gtk_widget_get_visible (GTK_WIDGET (embed->priv->window))) + if (priv->window + && gtk_widget_get_visible (GTK_WIDGET (priv->window))) { GtkRequisition min_req, natural_req; - gtk_widget_get_preferred_size (GTK_WIDGET (embed->priv->window), &min_req, &natural_req); + gtk_widget_get_preferred_size (GTK_WIDGET (priv->window), &min_req, &natural_req); *min_width_p = min_req.width; *natural_width_p = natural_req.width; @@ -246,12 +252,13 @@ shell_gtk_embed_get_preferred_height (ClutterActor *actor, float *natural_height_p) { ShellGtkEmbed *embed = SHELL_GTK_EMBED (actor); + ShellGtkEmbedPrivate *priv = shell_gtk_embed_get_instance_private (embed); - if (embed->priv->window - && gtk_widget_get_visible (GTK_WIDGET (embed->priv->window))) + if (priv->window + && gtk_widget_get_visible (GTK_WIDGET (priv->window))) { GtkRequisition min_req, natural_req; - gtk_widget_get_preferred_size (GTK_WIDGET (embed->priv->window), &min_req, &natural_req); + gtk_widget_get_preferred_size (GTK_WIDGET (priv->window), &min_req, &natural_req); *min_height_p = min_req.height; *natural_height_p = natural_req.height; @@ -266,6 +273,7 @@ shell_gtk_embed_allocate (ClutterActor *actor, ClutterAllocationFlags flags) { ShellGtkEmbed *embed = SHELL_GTK_EMBED (actor); + ShellGtkEmbedPrivate *priv = shell_gtk_embed_get_instance_private (embed); float wx = 0.0, wy = 0.0, x, y, ax, ay; CLUTTER_ACTOR_CLASS (shell_gtk_embed_parent_class)-> @@ -285,7 +293,7 @@ shell_gtk_embed_allocate (ClutterActor *actor, actor = clutter_actor_get_parent (actor); } - _shell_embedded_window_allocate (embed->priv->window, + _shell_embedded_window_allocate (priv->window, (int)(0.5 + wx), (int)(0.5 + wy), box->x2 - box->x1, box->y2 - box->y1); @@ -295,8 +303,9 @@ static void shell_gtk_embed_map (ClutterActor *actor) { ShellGtkEmbed *embed = SHELL_GTK_EMBED (actor); + ShellGtkEmbedPrivate *priv = shell_gtk_embed_get_instance_private (embed); - _shell_embedded_window_map (embed->priv->window); + _shell_embedded_window_map (priv->window); CLUTTER_ACTOR_CLASS (shell_gtk_embed_parent_class)->map (actor); } @@ -305,8 +314,9 @@ static void shell_gtk_embed_unmap (ClutterActor *actor) { ShellGtkEmbed *embed = SHELL_GTK_EMBED (actor); + ShellGtkEmbedPrivate *priv = shell_gtk_embed_get_instance_private (embed); - _shell_embedded_window_unmap (embed->priv->window); + _shell_embedded_window_unmap (priv->window); CLUTTER_ACTOR_CLASS (shell_gtk_embed_parent_class)->unmap (actor); } @@ -349,7 +359,6 @@ shell_gtk_embed_class_init (ShellGtkEmbedClass *klass) static void shell_gtk_embed_init (ShellGtkEmbed *embed) { - embed->priv = shell_gtk_embed_get_instance_private (embed); } /* diff --git a/src/shell-gtk-embed.h b/src/shell-gtk-embed.h index fb6943e54..4cfc489be 100644 --- a/src/shell-gtk-embed.h +++ b/src/shell-gtk-embed.h @@ -6,30 +6,15 @@ #include "shell-embedded-window.h" -#define SHELL_TYPE_GTK_EMBED (shell_gtk_embed_get_type ()) -#define SHELL_GTK_EMBED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SHELL_TYPE_GTK_EMBED, ShellGtkEmbed)) -#define SHELL_GTK_EMBED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_GTK_EMBED, ShellGtkEmbedClass)) -#define SHELL_IS_GTK_EMBED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SHELL_TYPE_GTK_EMBED)) -#define SHELL_IS_GTK_EMBED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_GTK_EMBED)) -#define SHELL_GTK_EMBED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_GTK_EMBED, ShellGtkEmbedClass)) - -typedef struct _ShellGtkEmbed ShellGtkEmbed; -typedef struct _ShellGtkEmbedClass ShellGtkEmbedClass; -typedef struct _ShellGtkEmbedPrivate ShellGtkEmbedPrivate; - -struct _ShellGtkEmbed -{ - ClutterClone parent; - - ShellGtkEmbedPrivate *priv; -}; +#define SHELL_TYPE_GTK_EMBED (shell_gtk_embed_get_type ()) +G_DECLARE_DERIVABLE_TYPE (ShellGtkEmbed, shell_gtk_embed, + SHELL, GTK_EMBED, ClutterClone) struct _ShellGtkEmbedClass { ClutterCloneClass parent_class; }; -GType shell_gtk_embed_get_type (void) G_GNUC_CONST; ClutterActor *shell_gtk_embed_new (ShellEmbeddedWindow *window); #endif /* __SHELL_GTK_EMBED_H__ */ diff --git a/src/shell-keyring-prompt.c b/src/shell-keyring-prompt.c index 85b4e00e0..d91e4c398 100644 --- a/src/shell-keyring-prompt.c +++ b/src/shell-keyring-prompt.c @@ -32,7 +32,6 @@ #include -typedef struct _ShellPasswordPromptClass ShellPasswordPromptClass; typedef struct _ShellPasswordPromptPrivate ShellPasswordPromptPrivate; typedef enum @@ -65,11 +64,6 @@ struct _ShellKeyringPrompt gboolean shown; }; -typedef struct _ShellKeyringPromptClass -{ - GObjectClass parent_class; -} ShellKeyringPromptClass; - enum { PROP_0, PROP_TITLE, diff --git a/src/shell-keyring-prompt.h b/src/shell-keyring-prompt.h index f96b5bc33..fcacf4c57 100644 --- a/src/shell-keyring-prompt.h +++ b/src/shell-keyring-prompt.h @@ -32,11 +32,9 @@ G_BEGIN_DECLS typedef struct _ShellKeyringPrompt ShellKeyringPrompt; -#define SHELL_TYPE_KEYRING_PROMPT (shell_keyring_prompt_get_type ()) -#define SHELL_KEYRING_PROMPT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SHELL_TYPE_KEYRING_PROMPT, ShellKeyringPrompt)) -#define SHELL_IS_KEYRING_PROMPT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SHELL_TYPE_KEYRING_PROMPT)) - -GType shell_keyring_prompt_get_type (void) G_GNUC_CONST; +#define SHELL_TYPE_KEYRING_PROMPT (shell_keyring_prompt_get_type ()) +G_DECLARE_FINAL_TYPE (ShellKeyringPrompt, shell_keyring_prompt, + SHELL, KEYRING_PROMPT, GObject) ShellKeyringPrompt * shell_keyring_prompt_new (void); diff --git a/src/shell-mount-operation.c b/src/shell-mount-operation.c index e1e3d3903..4579aaf90 100644 --- a/src/shell-mount-operation.c +++ b/src/shell-mount-operation.c @@ -41,6 +41,15 @@ enum { static guint signals[NUM_SIGNALS] = { 0, }; +typedef struct _ShellMountOperationPrivate ShellMountOperationPrivate; + +struct _ShellMountOperation +{ + GMountOperation parent_instance; + + ShellMountOperationPrivate *priv; +}; + struct _ShellMountOperationPrivate { GArray *pids; gchar **choices; diff --git a/src/shell-mount-operation.h b/src/shell-mount-operation.h index 2ad2d6de6..c4019a5f0 100644 --- a/src/shell-mount-operation.h +++ b/src/shell-mount-operation.h @@ -26,31 +26,10 @@ G_BEGIN_DECLS -#define SHELL_TYPE_MOUNT_OPERATION (shell_mount_operation_get_type ()) -#define SHELL_MOUNT_OPERATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SHELL_TYPE_MOUNT_OPERATION, ShellMountOperation)) -#define SHELL_MOUNT_OPERATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SHELL_TYPE_MOUNT_OPERATION, ShellMountOperationClass)) -#define SHELL_IS_MOUNT_OPERATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SHELL_TYPE_MOUNT_OPERATION)) -#define SHELL_IS_MOUNT_OPERATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SHELL_TYPE_MOUNT_OPERATION)) -#define SHELL_MOUNT_OPERATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), SHELL_TYPE_MOUNT_OPERATION, ShellMountOperationClass)) +#define SHELL_TYPE_MOUNT_OPERATION (shell_mount_operation_get_type ()) +G_DECLARE_FINAL_TYPE (ShellMountOperation, shell_mount_operation, + SHELL, MOUNT_OPERATION, GMountOperation) -typedef struct _ShellMountOperation ShellMountOperation; -typedef struct _ShellMountOperationClass ShellMountOperationClass; -typedef struct _ShellMountOperationPrivate ShellMountOperationPrivate; - -struct _ShellMountOperation -{ - GMountOperation parent_instance; - - ShellMountOperationPrivate *priv; -}; - -struct _ShellMountOperationClass -{ - GMountOperationClass parent_class; -}; - - -GType shell_mount_operation_get_type (void); GMountOperation *shell_mount_operation_new (void); GArray * shell_mount_operation_get_show_processes_pids (ShellMountOperation *self); diff --git a/src/shell-perf-log.c b/src/shell-perf-log.c index 5cf0cbb6f..cca3dc5b1 100644 --- a/src/shell-perf-log.c +++ b/src/shell-perf-log.c @@ -53,11 +53,6 @@ struct _ShellPerfLog guint enabled : 1; }; -struct _ShellPerfLogClass -{ - GObjectClass parent_class; -}; - struct _ShellPerfEvent { guint16 id; diff --git a/src/shell-perf-log.h b/src/shell-perf-log.h index a71f373f0..45d07a591 100644 --- a/src/shell-perf-log.h +++ b/src/shell-perf-log.h @@ -7,17 +7,8 @@ G_BEGIN_DECLS -typedef struct _ShellPerfLog ShellPerfLog; -typedef struct _ShellPerfLogClass ShellPerfLogClass; - -#define SHELL_TYPE_PERF_LOG (shell_perf_log_get_type ()) -#define SHELL_PERF_LOG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), SHELL_TYPE_PERF_LOG, ShellPerfLog)) -#define SHELL_PERF_LOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_PERF_LOG, ShellPerfLogClass)) -#define SHELL_IS_PERF_LOG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), SHELL_TYPE_PERF_LOG)) -#define SHELL_IS_PERF_LOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_PERF_LOG)) -#define SHELL_PERF_LOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_PERF_LOG, ShellPerfLogClass)) - -GType shell_perf_log_get_type (void) G_GNUC_CONST; +#define SHELL_TYPE_PERF_LOG (shell_perf_log_get_type ()) +G_DECLARE_FINAL_TYPE (ShellPerfLog, shell_perf_log, SHELL, PERF_LOG, GObject) ShellPerfLog *shell_perf_log_get_default (void); diff --git a/src/shell-recorder.c b/src/shell-recorder.c index e6d43778f..8a907a93e 100644 --- a/src/shell-recorder.c +++ b/src/shell-recorder.c @@ -33,11 +33,6 @@ typedef enum { typedef struct _RecorderPipeline RecorderPipeline; -struct _ShellRecorderClass -{ - GObjectClass parent_class; -}; - struct _ShellRecorder { GObject parent; diff --git a/src/shell-recorder.h b/src/shell-recorder.h index c761125e7..c1e0e6368 100644 --- a/src/shell-recorder.h +++ b/src/shell-recorder.h @@ -16,17 +16,8 @@ G_BEGIN_DECLS * directory named after the date, but the encoding and output can * be configured. */ -typedef struct _ShellRecorder ShellRecorder; -typedef struct _ShellRecorderClass ShellRecorderClass; - -#define SHELL_TYPE_RECORDER (shell_recorder_get_type ()) -#define SHELL_RECORDER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), SHELL_TYPE_RECORDER, ShellRecorder)) -#define SHELL_RECORDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_RECORDER, ShellRecorderClass)) -#define SHELL_IS_RECORDER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), SHELL_TYPE_RECORDER)) -#define SHELL_IS_RECORDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_RECORDER)) -#define SHELL_RECORDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_RECORDER, ShellRecorderClass)) - -GType shell_recorder_get_type (void) G_GNUC_CONST; +#define SHELL_TYPE_RECORDER (shell_recorder_get_type ()) +G_DECLARE_FINAL_TYPE (ShellRecorder, shell_recorder, SHELL, RECORDER, GObject) ShellRecorder *shell_recorder_new (ClutterStage *stage); diff --git a/src/shell-screenshot.c b/src/shell-screenshot.c index 076ea3f07..c5a4dd6ec 100644 --- a/src/shell-screenshot.c +++ b/src/shell-screenshot.c @@ -14,10 +14,7 @@ #define A11Y_APPS_SCHEMA "org.gnome.desktop.a11y.applications" #define MAGNIFIER_ACTIVE_KEY "screen-magnifier-enabled" -struct _ShellScreenshotClass -{ - GObjectClass parent_class; -}; +typedef struct _ShellScreenshotPrivate ShellScreenshotPrivate; struct _ShellScreenshot { diff --git a/src/shell-screenshot.h b/src/shell-screenshot.h index 0b8ab1c61..df00568f7 100644 --- a/src/shell-screenshot.h +++ b/src/shell-screenshot.h @@ -10,19 +10,9 @@ * areas or windows and write them out as png files. * */ - -typedef struct _ShellScreenshot ShellScreenshot; -typedef struct _ShellScreenshotPrivate ShellScreenshotPrivate; -typedef struct _ShellScreenshotClass ShellScreenshotClass; - -#define SHELL_TYPE_SCREENSHOT (shell_screenshot_get_type ()) -#define SHELL_SCREENSHOT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), SHELL_TYPE_SCREENSHOT, ShellScreenshot)) -#define SHELL_SCREENSHOT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_SCREENSHOT, ShellScreenshotClass)) -#define SHELL_IS_SCREENSHOT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), SHELL_TYPE_SCREENSHOT)) -#define SHELL_IS_SCREENSHOT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_SCREENSHOT)) -#define SHELL_SCREENSHOT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_SCREENSHOT, ShellScreenshotClass)) - -GType shell_screenshot_get_type (void) G_GNUC_CONST; +#define SHELL_TYPE_SCREENSHOT (shell_screenshot_get_type ()) +G_DECLARE_FINAL_TYPE (ShellScreenshot, shell_screenshot, + SHELL, SCREENSHOT, GObject) ShellScreenshot *shell_screenshot_new (void); diff --git a/src/shell-secure-text-buffer.c b/src/shell-secure-text-buffer.c index c46a8c41d..0f33a5df9 100644 --- a/src/shell-secure-text-buffer.c +++ b/src/shell-secure-text-buffer.c @@ -30,9 +30,6 @@ #include -typedef struct _ShellSecureTextBuffer ShellSecureTextBuffer; -typedef struct _ShellSecureTextBufferClass ShellSecureTextBufferClass; - struct _ShellSecureTextBuffer { ClutterTextBuffer parent; gchar *text; @@ -41,10 +38,6 @@ struct _ShellSecureTextBuffer { guint text_chars; }; -struct _ShellSecureTextBufferClass { - ClutterTextBufferClass parent_class; -}; - /* Initial size of buffer, in bytes */ #define MIN_SIZE 16 diff --git a/src/shell-secure-text-buffer.h b/src/shell-secure-text-buffer.h index 06238a675..6685b72ad 100644 --- a/src/shell-secure-text-buffer.h +++ b/src/shell-secure-text-buffer.h @@ -28,11 +28,9 @@ G_BEGIN_DECLS -#define SHELL_TYPE_SECURE_TEXT_BUFFER (shell_secure_text_buffer_get_type ()) -#define SHELL_SECURE_TEXT_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SHELL_TYPE_SECURE_TEXT_BUFFER, ShellSecureTextBuffer)) -#define SHELL_IS_SECURE_TEXT_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SHELL_TYPE_SECURE_TEXT_BUFFER)) - -GType shell_secure_text_buffer_get_type (void) G_GNUC_CONST; +#define SHELL_TYPE_SECURE_TEXT_BUFFER (shell_secure_text_buffer_get_type ()) +G_DECLARE_FINAL_TYPE (ShellSecureTextBuffer, shell_secure_text_buffer, + SHELL, SECURE_TEXT_BUFFER, ClutterTextBuffer) ClutterTextBuffer * shell_secure_text_buffer_new (void); diff --git a/src/shell-stack.c b/src/shell-stack.c index 8b8d542d9..f04bb58df 100644 --- a/src/shell-stack.c +++ b/src/shell-stack.c @@ -16,9 +16,12 @@ #include "shell-stack.h" -G_DEFINE_TYPE (ShellStack, - shell_stack, - ST_TYPE_WIDGET); +struct _ShellStack +{ + StWidget parent; +}; + +G_DEFINE_TYPE (ShellStack, shell_stack, ST_TYPE_WIDGET); static void shell_stack_allocate (ClutterActor *self, diff --git a/src/shell-stack.h b/src/shell-stack.h index 73df5185c..e54160db9 100644 --- a/src/shell-stack.h +++ b/src/shell-stack.h @@ -5,30 +5,7 @@ #include "st.h" #include -#define SHELL_TYPE_STACK (shell_stack_get_type ()) -#define SHELL_STACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SHELL_TYPE_STACK, ShellStack)) -#define SHELL_STACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_STACK, ShellStackClass)) -#define SHELL_IS_STACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SHELL_TYPE_STACK)) -#define SHELL_IS_STACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_STACK)) -#define SHELL_STACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_STACK, ShellStackClass)) - -typedef struct _ShellStack ShellStack; -typedef struct _ShellStackClass ShellStackClass; - -typedef struct _ShellStackPrivate ShellStackPrivate; - -struct _ShellStack -{ - StWidget parent; - - ShellStackPrivate *priv; -}; - -struct _ShellStackClass -{ - StWidgetClass parent_class; -}; - -GType shell_stack_get_type (void) G_GNUC_CONST; +#define SHELL_TYPE_STACK (shell_stack_get_type ()) +G_DECLARE_FINAL_TYPE (ShellStack, shell_stack, SHELL, STACK, StWidget) #endif /* __SHELL_STACK_H__ */ diff --git a/src/shell-tray-icon.c b/src/shell-tray-icon.c index a75c3c16d..2397117c7 100644 --- a/src/shell-tray-icon.c +++ b/src/shell-tray-icon.c @@ -17,6 +17,15 @@ enum { PROP_WM_CLASS }; +typedef struct _ShellTrayIconPrivate ShellTrayIconPrivate; + +struct _ShellTrayIcon +{ + ShellGtkEmbed parent; + + ShellTrayIconPrivate *priv; +}; + struct _ShellTrayIconPrivate { NaTrayChild *socket; diff --git a/src/shell-tray-icon.h b/src/shell-tray-icon.h index 565b3060a..f0e119114 100644 --- a/src/shell-tray-icon.h +++ b/src/shell-tray-icon.h @@ -4,31 +4,10 @@ #include "shell-gtk-embed.h" -#define SHELL_TYPE_TRAY_ICON (shell_tray_icon_get_type ()) -#define SHELL_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SHELL_TYPE_TRAY_ICON, ShellTrayIcon)) -#define SHELL_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_TRAY_ICON, ShellTrayIconClass)) -#define SHELL_IS_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SHELL_TYPE_TRAY_ICON)) -#define SHELL_IS_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_TRAY_ICON)) -#define SHELL_TRAY_ICON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_TRAY_ICON, ShellTrayIconClass)) +#define SHELL_TYPE_TRAY_ICON (shell_tray_icon_get_type ()) +G_DECLARE_FINAL_TYPE (ShellTrayIcon, shell_tray_icon, + SHELL, TRAY_ICON, ShellGtkEmbed) -typedef struct _ShellTrayIcon ShellTrayIcon; -typedef struct _ShellTrayIconClass ShellTrayIconClass; -typedef struct _ShellTrayIconPrivate ShellTrayIconPrivate; - -struct _ShellTrayIcon -{ - ShellGtkEmbed parent; - - ShellTrayIconPrivate *priv; -}; - -struct _ShellTrayIconClass -{ - ShellGtkEmbedClass parent_class; -}; - - -GType shell_tray_icon_get_type (void) G_GNUC_CONST; ClutterActor *shell_tray_icon_new (ShellEmbeddedWindow *window); void shell_tray_icon_click (ShellTrayIcon *icon, diff --git a/src/shell-tray-manager.c b/src/shell-tray-manager.c index 5fe165ebe..45de21f25 100644 --- a/src/shell-tray-manager.c +++ b/src/shell-tray-manager.c @@ -15,6 +15,15 @@ #include "shell-embedded-window.h" #include "shell-global.h" +typedef struct _ShellTrayManagerPrivate ShellTrayManagerPrivate; + +struct _ShellTrayManager +{ + GObject parent_instance; + + ShellTrayManagerPrivate *priv; +}; + struct _ShellTrayManagerPrivate { NaTrayManager *na_manager; ClutterColor bg_color; diff --git a/src/shell-tray-manager.h b/src/shell-tray-manager.h index 0f281dcf4..efc40decf 100644 --- a/src/shell-tray-manager.h +++ b/src/shell-tray-manager.h @@ -8,30 +8,9 @@ G_BEGIN_DECLS -#define SHELL_TYPE_TRAY_MANAGER (shell_tray_manager_get_type ()) -#define SHELL_TRAY_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SHELL_TYPE_TRAY_MANAGER, ShellTrayManager)) -#define SHELL_TRAY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_TRAY_MANAGER, ShellTrayManagerClass)) -#define SHELL_IS_TRAY_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SHELL_TYPE_TRAY_MANAGER)) -#define SHELL_IS_TRAY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_TRAY_MANAGER)) -#define SHELL_TRAY_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_TRAY_MANAGER, ShellTrayManagerClass)) - -typedef struct _ShellTrayManager ShellTrayManager; -typedef struct _ShellTrayManagerPrivate ShellTrayManagerPrivate; -typedef struct _ShellTrayManagerClass ShellTrayManagerClass; - -struct _ShellTrayManager -{ - GObject parent_instance; - - ShellTrayManagerPrivate *priv; -}; - -struct _ShellTrayManagerClass -{ - GObjectClass parent_class; -}; - -GType shell_tray_manager_get_type (void); +#define SHELL_TYPE_TRAY_MANAGER (shell_tray_manager_get_type ()) +G_DECLARE_FINAL_TYPE (ShellTrayManager, shell_tray_manager, + SHELL, TRAY_MANAGER, GObject) ShellTrayManager *shell_tray_manager_new (void); void shell_tray_manager_manage_screen (ShellTrayManager *manager, diff --git a/src/shell-window-tracker.h b/src/shell-window-tracker.h index e75e3794a..b32c20364 100644 --- a/src/shell-window-tracker.h +++ b/src/shell-window-tracker.h @@ -11,23 +11,9 @@ G_BEGIN_DECLS -typedef struct _ShellWindowTracker ShellWindowTracker; -typedef struct _ShellWindowTrackerClass ShellWindowTrackerClass; -typedef struct _ShellWindowTrackerPrivate ShellWindowTrackerPrivate; - -#define SHELL_TYPE_WINDOW_TRACKER (shell_window_tracker_get_type ()) -#define SHELL_WINDOW_TRACKER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), SHELL_TYPE_WINDOW_TRACKER, ShellWindowTracker)) -#define SHELL_WINDOW_TRACKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_WINDOW_TRACKER, ShellWindowTrackerClass)) -#define SHELL_IS_WINDOW_TRACKER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), SHELL_TYPE_WINDOW_TRACKER)) -#define SHELL_IS_WINDOW_TRACKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_WINDOW_TRACKER)) -#define SHELL_WINDOW_TRACKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_WINDOW_TRACKER, ShellWindowTrackerClass)) - -struct _ShellWindowTrackerClass -{ - GObjectClass parent_class; -}; - -GType shell_window_tracker_get_type (void) G_GNUC_CONST; +#define SHELL_TYPE_WINDOW_TRACKER (shell_window_tracker_get_type ()) +G_DECLARE_FINAL_TYPE (ShellWindowTracker, shell_window_tracker, + SHELL, WINDOW_TRACKER, GObject) ShellWindowTracker* shell_window_tracker_get_default(void); diff --git a/src/shell-wm.h b/src/shell-wm.h index 57b8c630e..ddfe0958a 100644 --- a/src/shell-wm.h +++ b/src/shell-wm.h @@ -7,23 +7,8 @@ G_BEGIN_DECLS -typedef struct _ShellWM ShellWM; -typedef struct _ShellWMClass ShellWMClass; - -#define SHELL_TYPE_WM (shell_wm_get_type ()) -#define SHELL_WM(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), SHELL_TYPE_WM, ShellWM)) -#define SHELL_WM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SHELL_TYPE_WM, ShellWMClass)) -#define SHELL_IS_WM(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), SHELL_TYPE_WM)) -#define SHELL_IS_WM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SHELL_TYPE_WM)) -#define SHELL_WM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SHELL_TYPE_WM, ShellWMClass)) - -struct _ShellWMClass -{ - GObjectClass parent_class; - -}; - -GType shell_wm_get_type (void) G_GNUC_CONST; +#define SHELL_TYPE_WM (shell_wm_get_type ()) +G_DECLARE_FINAL_TYPE (ShellWM, shell_wm, SHELL, WM, GObject) ShellWM *shell_wm_new (MetaPlugin *plugin);