[gdm/wip/nacho/session-worker-job-cleanup: 2/2] session-worker-job: minor cleanups
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm/wip/nacho/session-worker-job-cleanup: 2/2] session-worker-job: minor cleanups
- Date: Tue, 18 Oct 2022 11:03:51 +0000 (UTC)
commit 788a38b7079c681ad83d6be905aab0f2048867ac
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date: Mon Oct 3 09:52:14 2022 +0200
session-worker-job: minor cleanups
daemon/gdm-session-worker-job.c | 79 ++++++++++++++---------------------------
1 file changed, 26 insertions(+), 53 deletions(-)
---
diff --git a/daemon/gdm-session-worker-job.c b/daemon/gdm-session-worker-job.c
index 3ac018fc1..6597f3cca 100644
--- a/daemon/gdm-session-worker-job.c
+++ b/daemon/gdm-session-worker-job.c
@@ -82,10 +82,6 @@ enum {
static guint signals [LAST_SIGNAL] = { 0, };
-static void gdm_session_worker_job_class_init (GdmSessionWorkerJobClass *klass);
-static void gdm_session_worker_job_init (GdmSessionWorkerJob *session_worker_job);
-static void gdm_session_worker_job_finalize (GObject *object);
-
G_DEFINE_TYPE (GdmSessionWorkerJob, gdm_session_worker_job, G_TYPE_OBJECT)
static void
@@ -184,6 +180,7 @@ copy_environment_to_hash (GdmSessionWorkerJob *job,
} else {
environment = g_get_environ ();
}
+
for (i = 0; environment[i]; i++) {
char **parts;
@@ -211,7 +208,7 @@ get_job_arguments (GdmSessionWorkerJob *job,
args = NULL;
argv = NULL;
error = NULL;
- if (! g_shell_parse_argv (job->command, NULL, &argv, &error)) {
+ if (!g_shell_parse_argv (job->command, NULL, &argv, &error)) {
g_warning ("Could not parse command: %s", error->message);
g_error_free (error);
goto out;
@@ -322,13 +319,9 @@ gboolean
gdm_session_worker_job_start (GdmSessionWorkerJob *session_worker_job,
const char *name)
{
- gboolean res;
-
g_debug ("GdmSessionWorkerJob: Starting worker...");
- res = gdm_session_worker_job_spawn (session_worker_job, name);
-
- return res;
+ return gdm_session_worker_job_spawn (session_worker_job, name);
}
static void
@@ -421,6 +414,24 @@ gdm_session_worker_job_set_environment (GdmSessionWorkerJob *session_worker_job,
session_worker_job->environment = g_strdupv ((char **) environment);
}
+static void
+gdm_session_worker_job_finalize (GObject *object)
+{
+ GdmSessionWorkerJob *session_worker_job;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (GDM_IS_SESSION_WORKER_JOB (object));
+
+ session_worker_job = GDM_SESSION_WORKER_JOB (object);
+
+ gdm_session_worker_job_stop (session_worker_job);
+
+ g_free (session_worker_job->command);
+ g_free (session_worker_job->server_address);
+
+ G_OBJECT_CLASS (gdm_session_worker_job_parent_class)->finalize (object);
+}
+
static void
gdm_session_worker_job_set_property (GObject *object,
guint prop_id,
@@ -473,18 +484,12 @@ gdm_session_worker_job_get_property (GObject *object,
}
}
-static GObject *
-gdm_session_worker_job_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties)
+static void
+gdm_session_worker_job_init (GdmSessionWorkerJob *session_worker_job)
{
- GdmSessionWorkerJob *session_worker_job;
-
- session_worker_job = GDM_SESSION_WORKER_JOB (G_OBJECT_CLASS
(gdm_session_worker_job_parent_class)->constructor (type,
-
n_construct_properties,
-
construct_properties));
+ session_worker_job->pid = -1;
- return G_OBJECT (session_worker_job);
+ session_worker_job->command = g_strdup (LIBEXECDIR "/gdm-session-worker");
}
static void
@@ -494,7 +499,6 @@ gdm_session_worker_job_class_init (GdmSessionWorkerJobClass *klass)
object_class->get_property = gdm_session_worker_job_get_property;
object_class->set_property = gdm_session_worker_job_set_property;
- object_class->constructor = gdm_session_worker_job_constructor;
object_class->finalize = gdm_session_worker_job_finalize;
g_object_class_install_property (object_class,
@@ -552,39 +556,8 @@ gdm_session_worker_job_class_init (GdmSessionWorkerJobClass *klass)
G_TYPE_INT);
}
-static void
-gdm_session_worker_job_init (GdmSessionWorkerJob *session_worker_job)
-{
- session_worker_job->pid = -1;
-
- session_worker_job->command = g_strdup (LIBEXECDIR "/gdm-session-worker");
-}
-
-static void
-gdm_session_worker_job_finalize (GObject *object)
-{
- GdmSessionWorkerJob *session_worker_job;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GDM_IS_SESSION_WORKER_JOB (object));
-
- session_worker_job = GDM_SESSION_WORKER_JOB (object);
-
- gdm_session_worker_job_stop (session_worker_job);
-
- g_free (session_worker_job->command);
- g_free (session_worker_job->server_address);
-
- G_OBJECT_CLASS (gdm_session_worker_job_parent_class)->finalize (object);
-}
-
GdmSessionWorkerJob *
gdm_session_worker_job_new (void)
{
- GObject *object;
-
- object = g_object_new (GDM_TYPE_SESSION_WORKER_JOB,
- NULL);
-
- return GDM_SESSION_WORKER_JOB (object);
+ return g_object_new (GDM_TYPE_SESSION_WORKER_JOB, NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]