[gdm/wip/nielsdg/add-private-deprecated: 7/20] legacy-display: use G_DECLARE_FINAL_TYPE



commit 1f84bd9735a472ae3648f7c7a98f54bd3911d32d
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Sun Dec 23 14:34:15 2018 +0100

    legacy-display: use G_DECLARE_FINAL_TYPE

 daemon/gdm-legacy-display.c | 35 +++++++++++++++--------------------
 daemon/gdm-legacy-display.h | 23 ++---------------------
 2 files changed, 17 insertions(+), 41 deletions(-)
---
diff --git a/daemon/gdm-legacy-display.c b/daemon/gdm-legacy-display.c
index 0dd8c734..e53d82b2 100644
--- a/daemon/gdm-legacy-display.c
+++ b/daemon/gdm-legacy-display.c
@@ -45,10 +45,10 @@
 #include "gdm-settings-direct.h"
 #include "gdm-settings-keys.h"
 
-#define GDM_LEGACY_DISPLAY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_LEGACY_DISPLAY, 
GdmLegacyDisplayPrivate))
-
-struct GdmLegacyDisplayPrivate
+struct _GdmLegacyDisplay
 {
+        GdmDisplay           parent;
+
         GdmDBusLocalDisplay *skeleton;
 
         GdmServer           *server;
@@ -70,10 +70,10 @@ gdm_legacy_display_constructor (GType                  type,
                                                                                                      
n_construct_properties,
                                                                                                      
construct_properties));
 
-        display->priv->skeleton = GDM_DBUS_LOCAL_DISPLAY (gdm_dbus_local_display_skeleton_new ());
+        display->skeleton = GDM_DBUS_LOCAL_DISPLAY (gdm_dbus_local_display_skeleton_new ());
 
         g_dbus_object_skeleton_add_interface (gdm_display_get_object_skeleton (GDM_DISPLAY (display)),
-                                              G_DBUS_INTERFACE_SKELETON (display->priv->skeleton));
+                                              G_DBUS_INTERFACE_SKELETON (display->skeleton));
 
         return G_OBJECT (display);
 }
@@ -83,8 +83,8 @@ gdm_legacy_display_finalize (GObject *object)
 {
         GdmLegacyDisplay *display = GDM_LEGACY_DISPLAY (object);
 
-        g_clear_object (&display->priv->skeleton);
-        g_clear_object (&display->priv->server);
+        g_clear_object (&display->skeleton);
+        g_clear_object (&display->server);
 
         G_OBJECT_CLASS (gdm_legacy_display_parent_class)->finalize (object);
 }
@@ -205,7 +205,7 @@ gdm_legacy_display_manage (GdmDisplay *display)
                       "is-initial", &is_initial,
                       NULL);
 
-        self->priv->server = gdm_server_new (display_name, seat_id, auth_file, is_initial);
+        self->server = gdm_server_new (display_name, seat_id, auth_file, is_initial);
 
         g_free (display_name);
         g_free (auth_file);
@@ -213,25 +213,25 @@ gdm_legacy_display_manage (GdmDisplay *display)
 
         disable_tcp = TRUE;
         if (gdm_settings_direct_get_boolean (GDM_KEY_DISALLOW_TCP, &disable_tcp)) {
-                g_object_set (self->priv->server,
+                g_object_set (self->server,
                               "disable-tcp", disable_tcp,
                               NULL);
         }
 
-        g_signal_connect (self->priv->server,
+        g_signal_connect (self->server,
                           "exited",
                           G_CALLBACK (on_server_exited),
                           self);
-        g_signal_connect (self->priv->server,
+        g_signal_connect (self->server,
                           "died",
                           G_CALLBACK (on_server_died),
                           self);
-        g_signal_connect (self->priv->server,
+        g_signal_connect (self->server,
                           "ready",
                           G_CALLBACK (on_server_ready),
                           self);
 
-        res = gdm_server_start (self->priv->server);
+        res = gdm_server_start (self->server);
         if (! res) {
                 g_warning (_("Could not start the X "
                              "server (your graphical environment) "
@@ -259,8 +259,6 @@ gdm_legacy_display_class_init (GdmLegacyDisplayClass *klass)
 
         display_class->prepare = gdm_legacy_display_prepare;
         display_class->manage = gdm_legacy_display_manage;
-
-        g_type_class_add_private (klass, sizeof (GdmLegacyDisplayPrivate));
 }
 
 static void
@@ -272,8 +270,8 @@ on_display_status_changed (GdmLegacyDisplay *self)
 
         switch (status) {
             case GDM_DISPLAY_UNMANAGED:
-                if (self->priv->server != NULL)
-                        gdm_server_stop (self->priv->server);
+                if (self->server != NULL)
+                        gdm_server_stop (self->server);
                 break;
             default:
                 break;
@@ -283,9 +281,6 @@ on_display_status_changed (GdmLegacyDisplay *self)
 static void
 gdm_legacy_display_init (GdmLegacyDisplay *legacy_display)
 {
-
-        legacy_display->priv = GDM_LEGACY_DISPLAY_GET_PRIVATE (legacy_display);
-
         g_signal_connect (legacy_display, "notify::status",
                           G_CALLBACK (on_display_status_changed),
                           NULL);
diff --git a/daemon/gdm-legacy-display.h b/daemon/gdm-legacy-display.h
index 050a14ee..9f98c830 100644
--- a/daemon/gdm-legacy-display.h
+++ b/daemon/gdm-legacy-display.h
@@ -27,28 +27,9 @@
 
 G_BEGIN_DECLS
 
-#define GDM_TYPE_LEGACY_DISPLAY         (gdm_legacy_display_get_type ())
-#define GDM_LEGACY_DISPLAY(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_LEGACY_DISPLAY, 
GdmLegacyDisplay))
-#define GDM_LEGACY_DISPLAY_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_LEGACY_DISPLAY, 
GdmLegacyDisplayClass))
-#define GDM_IS_LEGACY_DISPLAY(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_LEGACY_DISPLAY))
-#define GDM_IS_LEGACY_DISPLAY_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_LEGACY_DISPLAY))
-#define GDM_LEGACY_DISPLAY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_LEGACY_DISPLAY, 
GdmLegacyDisplayClass))
+#define GDM_TYPE_LEGACY_DISPLAY (gdm_legacy_display_get_type ())
+G_DECLARE_FINAL_TYPE (GdmLegacyDisplay, gdm_legacy_display, GDM, LEGACY_DISPLAY, GdmDisplay)
 
-typedef struct GdmLegacyDisplayPrivate GdmLegacyDisplayPrivate;
-
-typedef struct
-{
-        GdmDisplay               parent;
-        GdmLegacyDisplayPrivate *priv;
-} GdmLegacyDisplay;
-
-typedef struct
-{
-        GdmDisplayClass   parent_class;
-
-} GdmLegacyDisplayClass;
-
-GType               gdm_legacy_display_get_type                (void);
 GdmDisplay *        gdm_legacy_display_new                     (int display_number);
 
 


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