[gdm/wip/kill-user-sessions: 1/3] session-worker: expose worker state enum to type system



commit 007c3c6d11e8704242631d1d1bab6b492e2936d3
Author: Ray Strode <rstrode redhat com>
Date:   Mon Jun 24 14:48:23 2019 -0400

    session-worker: expose worker state enum to type system
    
    We're going to need to access the worker state as a property on
    the worker object.
    
    This commit hooks it up to glib-mkenums so the requisite goo can
    get generated

 daemon/Makefile.am                        | 10 ++++++++
 daemon/gdm-session-worker-enum-types.c.in | 42 +++++++++++++++++++++++++++++++
 daemon/gdm-session-worker-enum-types.h.in | 24 ++++++++++++++++++
 daemon/gdm-session-worker.c               | 16 +++---------
 daemon/gdm-session-worker.h               | 12 +++++++++
 5 files changed, 92 insertions(+), 12 deletions(-)
---
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 5e9eb5e0..12ea53d7 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -40,6 +40,7 @@ BUILT_SOURCES =                                       \
        gdm-session-glue.h                      \
        gdm-session-worker-glue.h               \
        gdm-session-enum-types.h                \
+       gdm-session-worker-enum-types.h         \
        $(NULL)
 
 gdm-session-enum-types.h: gdm-session-enum-types.h.in gdm-session.h
@@ -48,6 +49,12 @@ gdm-session-enum-types.h: gdm-session-enum-types.h.in gdm-session.h
 gdm-session-enum-types.c: gdm-session-enum-types.c.in gdm-session.h
        $(AM_V_GEN) glib-mkenums --template $^ > $@
 
+gdm-session-worker-enum-types.h: gdm-session-worker-enum-types.h.in gdm-session-worker.h
+       $(AM_V_GEN) glib-mkenums --template $^ > $@
+
+gdm-session-worker-enum-types.c: gdm-session-worker-enum-types.c.in gdm-session-worker.h
+       $(AM_V_GEN) glib-mkenums --template $^ > $@
+
 gdm-display-glue.c gdm-display-glue.h: gdm-display.xml Makefile.am
        $(AM_V_GEN)gdbus-codegen                                        \
                --c-namespace=GdmDBus                                   \
@@ -144,6 +151,7 @@ nodist_gdm_session_worker_SOURCES =         \
        gdm-session-worker-glue.c               \
        gdm-session-worker-glue.h               \
        gdm-session-enum-types.c                \
+       gdm-session-worker-enum-types.c         \
        gdm-session-enum-types.h                \
        $(NULL)
 
@@ -298,4 +306,6 @@ EXTRA_DIST =                                \
        gdm-local-display-factory.xml   \
        gdm-session-enum-types.c.in     \
        gdm-session-enum-types.h.in     \
+       gdm-session-worker-enum-types.c.in      \
+       gdm-session-worker-enum-types.h.in      \
        $(NULL)
diff --git a/daemon/gdm-session-worker-enum-types.c.in b/daemon/gdm-session-worker-enum-types.c.in
new file mode 100644
index 00000000..c0286907
--- /dev/null
+++ b/daemon/gdm-session-worker-enum-types.c.in
@@ -0,0 +1,42 @@
+/*** BEGIN file-header ***/
+
+#include <glib-object.h>
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+#include "@filename@"
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name@_get_type (void) G_GNUC_CONST;
+
+GType
+@enum_name@_get_type (void)
+{
+        static GType etype = 0;
+
+        if (G_UNLIKELY(etype == 0)) {
+                static const G@Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+                { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+                { 0, NULL, NULL }
+        };
+
+        etype = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
+    }
+
+    return etype;
+}
+
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+ /**/
+/*** END file-tail ***/
diff --git a/daemon/gdm-session-worker-enum-types.h.in b/daemon/gdm-session-worker-enum-types.h.in
new file mode 100644
index 00000000..64f4b4bb
--- /dev/null
+++ b/daemon/gdm-session-worker-enum-types.h.in
@@ -0,0 +1,24 @@
+/*** BEGIN file-header ***/
+#ifndef GDM_SESSION_WORKER_ENUM_TYPES_H
+#define GDM_SESSION_WORKER_ENUM_TYPES_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name@_get_type (void) G_GNUC_CONST;
+#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* GDM_SESSION_WORKER_ENUM_TYPES_H */
+/*** END file-tail ***/
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index a5f90c4b..27d1ff5e 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -110,17 +110,6 @@
 #define RELEASE_DISPLAY_SIGNAL (SIGRTMAX)
 #define ACQUIRE_DISPLAY_SIGNAL (SIGRTMAX - 1)
 
-enum {
-        GDM_SESSION_WORKER_STATE_NONE = 0,
-        GDM_SESSION_WORKER_STATE_SETUP_COMPLETE,
-        GDM_SESSION_WORKER_STATE_AUTHENTICATED,
-        GDM_SESSION_WORKER_STATE_AUTHORIZED,
-        GDM_SESSION_WORKER_STATE_ACCREDITED,
-        GDM_SESSION_WORKER_STATE_ACCOUNT_DETAILS_SAVED,
-        GDM_SESSION_WORKER_STATE_SESSION_OPENED,
-        GDM_SESSION_WORKER_STATE_SESSION_STARTED
-};
-
 typedef struct
 {
         GdmSessionWorker *worker;
@@ -132,7 +121,7 @@ typedef struct
 
 struct GdmSessionWorkerPrivate
 {
-        int               state;
+        GdmSessionWorkerState state;
 
         int               exit_code;
 
@@ -2495,6 +2484,9 @@ gdm_session_worker_get_property (GObject    *object,
         case PROP_IS_REAUTH_SESSION:
                 g_value_set_boolean (value, self->priv->is_reauth_session);
                 break;
+        case PROP_STATE:
+                g_value_set_int (value, self->priv->state);
+                break;
         default:
                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
                 break;
diff --git a/daemon/gdm-session-worker.h b/daemon/gdm-session-worker.h
index 5603e80e..2814eab4 100644
--- a/daemon/gdm-session-worker.h
+++ b/daemon/gdm-session-worker.h
@@ -25,6 +25,7 @@
 
 #include "gdm-session-worker-glue.h"
 #include "gdm-session-worker-common.h"
+#include "gdm-session-worker-enum-types.h"
 
 G_BEGIN_DECLS
 
@@ -35,6 +36,17 @@ G_BEGIN_DECLS
 #define GDM_IS_SESSION_WORKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDM_TYPE_SESSION_WORKER))
 #define GDM_SESSION_WORKER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GDM_TYPE_SESSION_WORKER, 
GdmSessionWorkerClass))
 
+typedef enum {
+        GDM_SESSION_WORKER_STATE_NONE = 0,
+        GDM_SESSION_WORKER_STATE_SETUP_COMPLETE,
+        GDM_SESSION_WORKER_STATE_AUTHENTICATED,
+        GDM_SESSION_WORKER_STATE_AUTHORIZED,
+        GDM_SESSION_WORKER_STATE_ACCREDITED,
+        GDM_SESSION_WORKER_STATE_ACCOUNT_DETAILS_SAVED,
+        GDM_SESSION_WORKER_STATE_SESSION_OPENED,
+        GDM_SESSION_WORKER_STATE_SESSION_STARTED
+} GdmSessionWorkerState;
+
 typedef struct GdmSessionWorkerPrivate GdmSessionWorkerPrivate;
 
 typedef struct


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