[gdm/wip/wayland-rebase: 5/9] daemon: rename gdm-slave-proxy to gdm-slave-job



commit 406c17ca26e13e0dbe8861a65aa9b3da64d4ee45
Author: Ray Strode <rstrode redhat com>
Date:   Tue Sep 17 18:42:29 2013 -0400

    daemon: rename gdm-slave-proxy to gdm-slave-job
    
    It doesn't actually proxy calls to the slave, so it's misnamed.

 daemon/Makefile.am                            |    4 +-
 daemon/gdm-display.c                          |   48 ++++++------
 daemon/{gdm-slave-proxy.c => gdm-slave-job.c} |  108 ++++++++++++------------
 daemon/gdm-slave-job.h                        |   65 +++++++++++++++
 daemon/gdm-slave-proxy.h                      |   65 ---------------
 5 files changed, 145 insertions(+), 145 deletions(-)
---
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index eb9f56d..282d198 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -321,8 +321,8 @@ gdm_SOURCES =                       \
        gdm-transient-display.h         \
        gdm-manager.c                   \
        gdm-manager.h                   \
-       gdm-slave-proxy.c               \
-       gdm-slave-proxy.h               \
+       gdm-slave-job.c                 \
+       gdm-slave-job.h                 \
        gdm-dbus-util.c                 \
        gdm-dbus-util.h                 \
        $(NULL)
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
index 2e28cac..f037655 100644
--- a/daemon/gdm-display.c
+++ b/daemon/gdm-display.c
@@ -41,7 +41,7 @@
 #include "gdm-settings-direct.h"
 #include "gdm-settings-keys.h"
 
-#include "gdm-slave-proxy.h"
+#include "gdm-slave-job.h"
 #include "gdm-slave-glue.h"
 #include "gdm-dbus-util.h"
 
@@ -71,7 +71,7 @@ struct GdmDisplayPrivate
         gboolean              is_local;
         guint                 finish_idle_id;
 
-        GdmSlaveProxy        *slave_proxy;
+        GdmSlaveJob          *slave_job;
         char                 *slave_bus_name;
         GdmDBusSlave         *slave_bus_proxy;
         int                   slave_name_id;
@@ -585,9 +585,9 @@ queue_finish (GdmDisplay *display)
 }
 
 static void
-slave_exited (GdmSlaveProxy       *proxy,
-              int                  code,
-              GdmDisplay          *display)
+slave_exited (GdmSlaveJob       *job,
+              int                code,
+              GdmDisplay        *display)
 {
         g_debug ("GdmDisplay: Slave exited: %d", code);
 
@@ -595,9 +595,9 @@ slave_exited (GdmSlaveProxy       *proxy,
 }
 
 static void
-slave_died (GdmSlaveProxy       *proxy,
-            int                  signum,
-            GdmDisplay          *display)
+slave_died (GdmSlaveJob       *job,
+            int                signum,
+            GdmDisplay        *display)
 {
         g_debug ("GdmDisplay: Slave died: %d", signum);
 
@@ -626,7 +626,7 @@ gdm_display_real_prepare (GdmDisplay *display)
 
         g_debug ("GdmDisplay: prepare display");
 
-        g_assert (display->priv->slave_proxy == NULL);
+        g_assert (display->priv->slave_job == NULL);
 
         if (!gdm_display_create_authority (display)) {
                 g_warning ("Unable to set up access control for display %d",
@@ -636,12 +636,12 @@ gdm_display_real_prepare (GdmDisplay *display)
 
         _gdm_display_set_status (display, GDM_DISPLAY_PREPARED);
 
-        display->priv->slave_proxy = gdm_slave_proxy_new ();
-        g_signal_connect (display->priv->slave_proxy,
+        display->priv->slave_job = gdm_slave_job_new ();
+        g_signal_connect (display->priv->slave_job,
                           "exited",
                           G_CALLBACK (slave_exited),
                           display);
-        g_signal_connect (display->priv->slave_proxy,
+        g_signal_connect (display->priv->slave_job,
                           "died",
                           G_CALLBACK (slave_died),
                           display);
@@ -649,13 +649,13 @@ gdm_display_real_prepare (GdmDisplay *display)
         log_file = g_strdup_printf ("%s-slave.log", display->priv->x11_display_name);
         log_path = g_build_filename (LOGDIR, log_file, NULL);
         g_free (log_file);
-        gdm_slave_proxy_set_log_path (display->priv->slave_proxy, log_path);
+        gdm_slave_job_set_log_path (display->priv->slave_job, log_path);
         g_free (log_path);
 
         command = g_strdup_printf ("%s --display-id %s",
                                    display->priv->slave_command,
                                    display->priv->id);
-        gdm_slave_proxy_set_command (display->priv->slave_proxy, command);
+        gdm_slave_job_set_command (display->priv->slave_job, command);
         g_free (command);
 
         return TRUE;
@@ -695,11 +695,11 @@ gdm_display_real_manage (GdmDisplay *display)
                 }
         }
 
-        g_assert (display->priv->slave_proxy != NULL);
+        g_assert (display->priv->slave_job != NULL);
 
         g_timer_start (display->priv->slave_timer);
 
-        gdm_slave_proxy_start (display->priv->slave_proxy);
+        gdm_slave_job_start (display->priv->slave_job);
 
         return TRUE;
 }
@@ -759,11 +759,11 @@ gdm_display_real_unmanage (GdmDisplay *display)
 
         g_timer_stop (display->priv->slave_timer);
 
-        if (display->priv->slave_proxy != NULL) {
-                gdm_slave_proxy_stop (display->priv->slave_proxy);
+        if (display->priv->slave_job != NULL) {
+                gdm_slave_job_stop (display->priv->slave_job);
 
-                g_object_unref (display->priv->slave_proxy);
-                display->priv->slave_proxy = NULL;
+                g_object_unref (display->priv->slave_job);
+                display->priv->slave_job = NULL;
         }
 
         if (display->priv->user_access_file != NULL) {
@@ -1439,11 +1439,11 @@ gdm_display_dispose (GObject *object)
                 display->priv->finish_idle_id = 0;
         }
 
-        if (display->priv->slave_proxy != NULL) {
-                gdm_slave_proxy_stop (display->priv->slave_proxy);
+        if (display->priv->slave_job != NULL) {
+                gdm_slave_job_stop (display->priv->slave_job);
 
-                g_object_unref (display->priv->slave_proxy);
-                display->priv->slave_proxy = NULL;
+                g_object_unref (display->priv->slave_job);
+                display->priv->slave_job = NULL;
         }
 
         if (display->priv->user_access_file != NULL) {
diff --git a/daemon/gdm-slave-proxy.c b/daemon/gdm-slave-job.c
similarity index 79%
rename from daemon/gdm-slave-proxy.c
rename to daemon/gdm-slave-job.c
index 887a4f0..58ac630 100644
--- a/daemon/gdm-slave-proxy.c
+++ b/daemon/gdm-slave-job.c
@@ -41,13 +41,13 @@
 
 #include "gdm-common.h"
 
-#include "gdm-slave-proxy.h"
+#include "gdm-slave-job.h"
 
-#define GDM_SLAVE_PROXY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_SLAVE_PROXY, 
GdmSlaveProxyPrivate))
+#define GDM_SLAVE_JOB_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_SLAVE_JOB, 
GdmSlaveJobPrivate))
 
 #define MAX_LOGS 5
 
-struct GdmSlaveProxyPrivate
+struct GdmSlaveJobPrivate
 {
         char    *command;
         char    *log_path;
@@ -69,18 +69,18 @@ enum {
 
 static guint signals [LAST_SIGNAL] = { 0, };
 
-static void     gdm_slave_proxy_class_init      (GdmSlaveProxyClass *klass);
-static void     gdm_slave_proxy_init            (GdmSlaveProxy      *slave);
-static void     gdm_slave_proxy_finalize        (GObject            *object);
+static void     gdm_slave_job_class_init      (GdmSlaveJobClass *klass);
+static void     gdm_slave_job_init            (GdmSlaveJob      *slave);
+static void     gdm_slave_job_finalize        (GObject            *object);
 
-G_DEFINE_TYPE (GdmSlaveProxy, gdm_slave_proxy, G_TYPE_OBJECT)
+G_DEFINE_TYPE (GdmSlaveJob, gdm_slave_job, G_TYPE_OBJECT)
 
 static void
 child_watch (GPid           pid,
              int            status,
-             GdmSlaveProxy *slave)
+             GdmSlaveJob *slave)
 {
-        g_debug ("GdmSlaveProxy: slave (pid:%d) done (%s:%d)",
+        g_debug ("GdmSlaveJob: slave (pid:%d) done (%s:%d)",
                  (int) pid,
                  WIFEXITED (status) ? "status"
                  : WIFSIGNALED (status) ? "signal"
@@ -221,19 +221,19 @@ spawn_command_line_async (const char *command_line,
 }
 
 static void
-clear_child_watch (GdmSlaveProxy *slave)
+clear_child_watch (GdmSlaveJob *slave)
 {
         slave->priv->child_watch_id = 0;
         g_object_unref (slave);
 }
 
 static gboolean
-spawn_slave (GdmSlaveProxy *slave)
+spawn_slave (GdmSlaveJob *slave)
 {
         gboolean    result;
         GError     *error;
 
-        g_debug ("GdmSlaveProxy: Running command: %s", slave->priv->command);
+        g_debug ("GdmSlaveJob: Running command: %s", slave->priv->command);
 
         error = NULL;
         result = spawn_command_line_async (slave->priv->command,
@@ -247,7 +247,7 @@ spawn_slave (GdmSlaveProxy *slave)
                 goto out;
         }
 
-        g_debug ("GdmSlaveProxy: Started slave with pid %d", slave->priv->pid);
+        g_debug ("GdmSlaveJob: Started slave with pid %d", slave->priv->pid);
 
         slave->priv->child_watch_id = g_child_watch_add_full (G_PRIORITY_DEFAULT,
                                                               slave->priv->pid,
@@ -264,7 +264,7 @@ spawn_slave (GdmSlaveProxy *slave)
 }
 
 static void
-kill_slave (GdmSlaveProxy *slave)
+kill_slave (GdmSlaveJob *slave)
 {
         int res;
 
@@ -280,7 +280,7 @@ kill_slave (GdmSlaveProxy *slave)
 
                 exit_status = gdm_wait_on_pid (slave->priv->pid);
 
-                g_debug ("GdmSlaveProxy: slave died with exit status %d", exit_status);
+                g_debug ("GdmSlaveJob: slave died with exit status %d", exit_status);
 
                 g_spawn_close_pid (slave->priv->pid);
                 slave->priv->pid = 0;
@@ -288,9 +288,9 @@ kill_slave (GdmSlaveProxy *slave)
 }
 
 gboolean
-gdm_slave_proxy_start (GdmSlaveProxy *slave)
+gdm_slave_job_start (GdmSlaveJob *slave)
 {
-        gdm_slave_proxy_stop (slave);
+        gdm_slave_job_stop (slave);
 
         spawn_slave (slave);
 
@@ -298,9 +298,9 @@ gdm_slave_proxy_start (GdmSlaveProxy *slave)
 }
 
 gboolean
-gdm_slave_proxy_stop (GdmSlaveProxy *slave)
+gdm_slave_job_stop (GdmSlaveJob *slave)
 {
-        g_debug ("GdmSlaveProxy: Killing slave");
+        g_debug ("GdmSlaveJob: Killing slave");
 
         if (slave->priv->child_watch_id > 0) {
                 g_source_remove (slave->priv->child_watch_id);
@@ -313,7 +313,7 @@ gdm_slave_proxy_stop (GdmSlaveProxy *slave)
 }
 
 void
-gdm_slave_proxy_set_command (GdmSlaveProxy *slave,
+gdm_slave_job_set_command (GdmSlaveJob *slave,
                              const char    *command)
 {
         g_free (slave->priv->command);
@@ -321,7 +321,7 @@ gdm_slave_proxy_set_command (GdmSlaveProxy *slave,
 }
 
 void
-gdm_slave_proxy_set_log_path (GdmSlaveProxy *slave,
+gdm_slave_job_set_log_path (GdmSlaveJob *slave,
                               const char    *path)
 {
         g_free (slave->priv->log_path);
@@ -329,21 +329,21 @@ gdm_slave_proxy_set_log_path (GdmSlaveProxy *slave,
 }
 
 static void
-gdm_slave_proxy_set_property (GObject      *object,
+gdm_slave_job_set_property (GObject      *object,
                               guint         prop_id,
                               const GValue *value,
                               GParamSpec   *pspec)
 {
-        GdmSlaveProxy *self;
+        GdmSlaveJob *self;
 
-        self = GDM_SLAVE_PROXY (object);
+        self = GDM_SLAVE_JOB (object);
 
         switch (prop_id) {
         case PROP_COMMAND:
-                gdm_slave_proxy_set_command (self, g_value_get_string (value));
+                gdm_slave_job_set_command (self, g_value_get_string (value));
                 break;
         case PROP_LOG_PATH:
-                gdm_slave_proxy_set_log_path (self, g_value_get_string (value));
+                gdm_slave_job_set_log_path (self, g_value_get_string (value));
                 break;
         default:
                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -352,14 +352,14 @@ gdm_slave_proxy_set_property (GObject      *object,
 }
 
 static void
-gdm_slave_proxy_get_property (GObject    *object,
+gdm_slave_job_get_property (GObject    *object,
                               guint       prop_id,
                               GValue     *value,
                               GParamSpec *pspec)
 {
-        GdmSlaveProxy *self;
+        GdmSlaveJob *self;
 
-        self = GDM_SLAVE_PROXY (object);
+        self = GDM_SLAVE_JOB (object);
 
         switch (prop_id) {
         case PROP_COMMAND:
@@ -375,29 +375,29 @@ gdm_slave_proxy_get_property (GObject    *object,
 }
 
 static void
-gdm_slave_proxy_dispose (GObject *object)
+gdm_slave_job_dispose (GObject *object)
 {
-        GdmSlaveProxy *slave;
+        GdmSlaveJob *slave;
 
-        slave = GDM_SLAVE_PROXY (object);
+        slave = GDM_SLAVE_JOB (object);
 
-        g_debug ("GdmSlaveProxy: Disposing slave proxy");
-        gdm_slave_proxy_stop (slave);
+        g_debug ("GdmSlaveJob: Disposing slave job");
+        gdm_slave_job_stop (slave);
 
-        G_OBJECT_CLASS (gdm_slave_proxy_parent_class)->dispose (object);
+        G_OBJECT_CLASS (gdm_slave_job_parent_class)->dispose (object);
 }
 
 static void
-gdm_slave_proxy_class_init (GdmSlaveProxyClass *klass)
+gdm_slave_job_class_init (GdmSlaveJobClass *klass)
 {
         GObjectClass    *object_class = G_OBJECT_CLASS (klass);
 
-        object_class->get_property = gdm_slave_proxy_get_property;
-        object_class->set_property = gdm_slave_proxy_set_property;
-        object_class->dispose = gdm_slave_proxy_dispose;
-        object_class->finalize = gdm_slave_proxy_finalize;
+        object_class->get_property = gdm_slave_job_get_property;
+        object_class->set_property = gdm_slave_job_set_property;
+        object_class->dispose = gdm_slave_job_dispose;
+        object_class->finalize = gdm_slave_job_finalize;
 
-        g_type_class_add_private (klass, sizeof (GdmSlaveProxyPrivate));
+        g_type_class_add_private (klass, sizeof (GdmSlaveJobPrivate));
 
         g_object_class_install_property (object_class,
                                          PROP_COMMAND,
@@ -418,7 +418,7 @@ gdm_slave_proxy_class_init (GdmSlaveProxyClass *klass)
                 g_signal_new ("exited",
                               G_OBJECT_CLASS_TYPE (object_class),
                               G_SIGNAL_RUN_FIRST,
-                              G_STRUCT_OFFSET (GdmSlaveProxyClass, exited),
+                              G_STRUCT_OFFSET (GdmSlaveJobClass, exited),
                               NULL,
                               NULL,
                               g_cclosure_marshal_VOID__INT,
@@ -430,7 +430,7 @@ gdm_slave_proxy_class_init (GdmSlaveProxyClass *klass)
                 g_signal_new ("died",
                               G_OBJECT_CLASS_TYPE (object_class),
                               G_SIGNAL_RUN_FIRST,
-                              G_STRUCT_OFFSET (GdmSlaveProxyClass, died),
+                              G_STRUCT_OFFSET (GdmSlaveJobClass, died),
                               NULL,
                               NULL,
                               g_cclosure_marshal_VOID__INT,
@@ -440,39 +440,39 @@ gdm_slave_proxy_class_init (GdmSlaveProxyClass *klass)
 }
 
 static void
-gdm_slave_proxy_init (GdmSlaveProxy *slave)
+gdm_slave_job_init (GdmSlaveJob *slave)
 {
 
-        slave->priv = GDM_SLAVE_PROXY_GET_PRIVATE (slave);
+        slave->priv = GDM_SLAVE_JOB_GET_PRIVATE (slave);
 
         slave->priv->pid = -1;
 }
 
 static void
-gdm_slave_proxy_finalize (GObject *object)
+gdm_slave_job_finalize (GObject *object)
 {
-        GdmSlaveProxy *slave;
+        GdmSlaveJob *slave;
 
         g_return_if_fail (object != NULL);
-        g_return_if_fail (GDM_IS_SLAVE_PROXY (object));
+        g_return_if_fail (GDM_IS_SLAVE_JOB (object));
 
-        slave = GDM_SLAVE_PROXY (object);
+        slave = GDM_SLAVE_JOB (object);
 
         g_return_if_fail (slave->priv != NULL);
 
         g_free (slave->priv->command);
         g_free (slave->priv->log_path);
 
-        G_OBJECT_CLASS (gdm_slave_proxy_parent_class)->finalize (object);
+        G_OBJECT_CLASS (gdm_slave_job_parent_class)->finalize (object);
 }
 
-GdmSlaveProxy *
-gdm_slave_proxy_new (void)
+GdmSlaveJob *
+gdm_slave_job_new (void)
 {
         GObject *object;
 
-        object = g_object_new (GDM_TYPE_SLAVE_PROXY,
+        object = g_object_new (GDM_TYPE_SLAVE_JOB,
                                NULL);
 
-        return GDM_SLAVE_PROXY (object);
+        return GDM_SLAVE_JOB (object);
 }
diff --git a/daemon/gdm-slave-job.h b/daemon/gdm-slave-job.h
new file mode 100644
index 0000000..65bf00d
--- /dev/null
+++ b/daemon/gdm-slave-job.h
@@ -0,0 +1,65 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann jhu edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+
+#ifndef __GDM_SLAVE_JOB_H
+#define __GDM_SLAVE_JOB_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GDM_TYPE_SLAVE_JOB         (gdm_slave_job_get_type ())
+#define GDM_SLAVE_JOB(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_SLAVE_JOB, GdmSlaveJob))
+#define GDM_SLAVE_JOB_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_SLAVE_JOB, GdmSlaveJobClass))
+#define GDM_IS_SLAVE_JOB(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_SLAVE_JOB))
+#define GDM_IS_SLAVE_JOB_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_SLAVE_JOB))
+#define GDM_SLAVE_JOB_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_SLAVE_JOB, GdmSlaveJobClass))
+
+typedef struct GdmSlaveJobPrivate GdmSlaveJobPrivate;
+
+typedef struct
+{
+        GObject               parent;
+        GdmSlaveJobPrivate *priv;
+} GdmSlaveJob;
+
+typedef struct
+{
+        GObjectClass   parent_class;
+        void (* exited)            (GdmSlaveJob  *job,
+                                    int           exit_code);
+
+        void (* died)              (GdmSlaveJob  *job,
+                                    int           signal_number);
+} GdmSlaveJobClass;
+
+GType               gdm_slave_job_get_type     (void);
+GdmSlaveJob *     gdm_slave_job_new          (void);
+void                gdm_slave_job_set_command  (GdmSlaveJob *slave,
+                                                const char  *command);
+void                gdm_slave_job_set_log_path (GdmSlaveJob *slave,
+                                                const char  *path);
+gboolean            gdm_slave_job_start        (GdmSlaveJob *slave);
+gboolean            gdm_slave_job_stop         (GdmSlaveJob *slave);
+
+G_END_DECLS
+
+#endif /* __GDM_SLAVE_JOB_H */


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