summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2018-01-17 16:45:54 +1300
committerRobert Ancell <robert.ancell@canonical.com>2018-01-17 16:45:54 +1300
commitd96600f3bcde7e120389effd8b145980c6e8757f (patch)
tree42ca66565b778989c86fc728613bd3ed5cb52bf6
parent491bea8d41638478be477e72fb21f30f886a4d10 (diff)
downloadlightdm-git-d96600f3bcde7e120389effd8b145980c6e8757f.tar.gz
Move liblightdm variable declarations from the start of files.
-rw-r--r--common/user-list.c4
-rw-r--r--liblightdm-gobject/greeter.c384
-rw-r--r--liblightdm-gobject/language.c32
-rw-r--r--liblightdm-gobject/layout.c50
-rw-r--r--liblightdm-gobject/power.c90
-rw-r--r--liblightdm-gobject/session.c93
-rw-r--r--liblightdm-gobject/system.c22
-rw-r--r--liblightdm-gobject/user.c21
-rw-r--r--po/lightdm.pot2
9 files changed, 226 insertions, 472 deletions
diff --git a/common/user-list.c b/common/user-list.c
index b8ae30b7..ca48b4ba 100644
--- a/common/user-list.c
+++ b/common/user-list.c
@@ -1016,9 +1016,7 @@ common_user_list_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- CommonUserList *self;
-
- self = COMMON_USER_LIST (object);
+ CommonUserList *self = COMMON_USER_LIST (object);
switch (prop_id)
{
diff --git a/liblightdm-gobject/greeter.c b/liblightdm-gobject/greeter.c
index 531a507a..21b43739 100644
--- a/liblightdm-gobject/greeter.c
+++ b/liblightdm-gobject/greeter.c
@@ -31,34 +31,34 @@
* {
* GMainLoop *main_loop;
* LightDMGreeter *greeter
- *
+ *
* main_loop = g_main_loop_new ();
- *
+ *
* greeter = lightdm_greeter_new ();
* g_object_connect (greeter, "show-prompt", G_CALLBACK (show_prompt_cb), NULL);
* g_object_connect (greeter, "authentication-complete", G_CALLBACK (authentication_complete_cb), NULL);
- *
+ *
* // Connect to LightDM daemon
* if (!lightdm_greeter_connect_to_daemon_sync (greeter, NULL))
* return EXIT_FAILURE;
- *
+ *
* // Start authentication
* lightdm_greeter_authenticate (greeter, NULL);
- *
+ *
* g_main_loop_run (main_loop);
- *
+ *
* return EXIT_SUCCESS;
* }
- *
+ *
* static void show_prompt_cb (LightDMGreeter *greeter, const char *text, LightDMPromptType type)
* {
* // Show the user the message and prompt for some response
* gchar *secret = prompt_user (text, type);
- *
+ *
* // Give the result to the user
* lightdm_greeter_respond (greeter, response);
* }
- *
+ *
* static void authentication_complete_cb (LightDMGreeter *greeter)
* {
* // Start the session
@@ -236,7 +236,7 @@ lightdm_greeter_error_get_type (void)
{ LIGHTDM_GREETER_ERROR_CONNECTION_FAILED, "LIGHTDM_GREETER_ERROR_CONNECTION_FAILED", "connection-failed" },
{ LIGHTDM_GREETER_ERROR_SESSION_FAILED, "LIGHTDM_GREETER_ERROR_SESSION_FAILED", "session-failed" },
{ LIGHTDM_GREETER_ERROR_NO_AUTOLOGIN, "LIGHTDM_GREETER_ERROR_NO_AUTOLOGIN", "no-autologin" },
- { LIGHTDM_GREETER_ERROR_INVALID_USER, "LIGHTDM_GREETER_ERROR_INVALID_USER", "invalid-user" },
+ { LIGHTDM_GREETER_ERROR_INVALID_USER, "LIGHTDM_GREETER_ERROR_INVALID_USER", "invalid-user" },
{ 0, NULL, NULL }
};
enum_type = g_enum_register_static (g_intern_static_string ("LightDMGreeterError"), values);
@@ -249,7 +249,7 @@ GType
lightdm_prompt_type_get_type (void)
{
static GType enum_type = 0;
-
+
if (G_UNLIKELY(enum_type == 0)) {
static const GEnumValue values[] = {
{ LIGHTDM_PROMPT_TYPE_QUESTION, "LIGHTDM_PROMPT_TYPE_QUESTION", "question" },
@@ -266,7 +266,7 @@ GType
lightdm_message_type_get_type (void)
{
static GType enum_type = 0;
-
+
if (G_UNLIKELY(enum_type == 0)) {
static const GEnumValue values[] = {
{ LIGHTDM_MESSAGE_TYPE_INFO, "LIGHTDM_MESSAGE_TYPE_INFO", "info" },
@@ -304,11 +304,9 @@ lightdm_greeter_new (void)
void
lightdm_greeter_set_resettable (LightDMGreeter *greeter, gboolean resettable)
{
- LightDMGreeterPrivate *priv;
-
g_return_if_fail (LIGHTDM_IS_GREETER (greeter));
- priv = GET_PRIVATE (greeter);
+ LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
g_return_if_fail (!priv->connected);
priv->resettable = resettable;
@@ -317,9 +315,7 @@ lightdm_greeter_set_resettable (LightDMGreeter *greeter, gboolean resettable)
static Request *
request_new (LightDMGreeter *greeter, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
{
- Request *request;
-
- request = g_object_new (request_get_type (), NULL);
+ Request *request = g_object_new (request_get_type (), NULL);
request->greeter = greeter;
if (cancellable)
request->cancellable = g_object_ref (cancellable);
@@ -393,7 +389,6 @@ static gboolean
write_string (guint8 *buffer, gint buffer_length, const gchar *value, gsize *offset, GError **error)
{
gint length = 0;
-
if (value)
length = strlen (value);
if (!write_int (buffer, buffer_length, length, offset, error))
@@ -414,17 +409,14 @@ write_string (guint8 *buffer, gint buffer_length, const gchar *value, gsize *off
static guint32
read_int (guint8 *message, gsize message_length, gsize *offset)
{
- guint32 value;
- guint8 *buffer;
-
if (message_length - *offset < int_length ())
{
g_warning ("Not enough space for int, need %i, got %zi", int_length (), message_length - *offset);
return 0;
}
- buffer = message + *offset;
- value = buffer[0] << 24 | buffer[1] << 16 | buffer[2] << 8 | buffer[3];
+ const guint8 *buffer = message + *offset;
+ guint32 value = buffer[0] << 24 | buffer[1] << 16 | buffer[2] << 8 | buffer[3];
*offset += int_length ();
return value;
@@ -433,17 +425,14 @@ read_int (guint8 *message, gsize message_length, gsize *offset)
static gchar *
read_string (guint8 *message, gsize message_length, gsize *offset)
{
- guint32 length;
- gchar *value;
-
- length = read_int (message, message_length, offset);
+ guint32 length = read_int (message, message_length, offset);
if (message_length - *offset < length)
{
g_warning ("Not enough space for string, need %u, got %zu", length, message_length - *offset);
return g_strdup ("");
}
- value = g_malloc (sizeof (gchar) * (length + 1));
+ gchar *value = g_malloc (sizeof (gchar) * (length + 1));
memcpy (value, message + *offset, length);
value[length] = '\0';
*offset += length;
@@ -478,15 +467,14 @@ static gboolean
connect_to_daemon (LightDMGreeter *greeter, GError **error)
{
LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
- const gchar *to_server_fd, *from_server_fd, *pipe_path;
if (priv->to_server_channel || priv->from_server_channel)
return TRUE;
- /* Use private connection if one exists */
- to_server_fd = g_getenv ("LIGHTDM_TO_SERVER_FD");
- from_server_fd = g_getenv ("LIGHTDM_FROM_SERVER_FD");
- pipe_path = g_getenv ("LIGHTDM_GREETER_PIPE");
+ /* Use private connection if one exists */
+ const gchar *to_server_fd = g_getenv ("LIGHTDM_TO_SERVER_FD");
+ const gchar *from_server_fd = g_getenv ("LIGHTDM_FROM_SERVER_FD");
+ const gchar *pipe_path = g_getenv ("LIGHTDM_GREETER_PIPE");
if (to_server_fd && from_server_fd)
{
priv->to_server_channel = g_io_channel_unix_new (atoi (to_server_fd));
@@ -494,17 +482,12 @@ connect_to_daemon (LightDMGreeter *greeter, GError **error)
}
else if (pipe_path)
{
- GSocketAddress *address;
- gboolean result;
-
priv->socket = g_socket_new (G_SOCKET_FAMILY_UNIX, G_SOCKET_TYPE_STREAM, G_SOCKET_PROTOCOL_DEFAULT, error);
if (!priv->socket)
return FALSE;
- address = g_unix_socket_address_new (pipe_path);
- result = g_socket_connect (priv->socket, address, NULL, error);
- g_object_unref (address);
- if (!result)
+ g_autoptr(GSocketAddress) address = g_unix_socket_address_new (pipe_path);
+ if (!g_socket_connect (priv->socket, address, NULL, error))
return FALSE;
priv->from_server_channel = g_io_channel_unix_new (g_socket_get_fd (priv->socket));
@@ -530,10 +513,6 @@ static gboolean
send_message (LightDMGreeter *greeter, guint8 *message, gsize message_length, GError **error)
{
LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
- gchar *data;
- gsize data_length;
- guint32 stated_length;
- g_autoptr(GError) flush_error = NULL;
if (!connect_to_daemon (greeter, error))
return FALSE;
@@ -543,7 +522,7 @@ send_message (LightDMGreeter *greeter, guint8 *message, gsize message_length, GE
rest. If we say we're sending less than we do, we confuse the heck out
of lightdm, as it starts reading headers from the middle of our
messages. */
- stated_length = HEADER_SIZE + get_message_length (message, message_length);
+ guint32 stated_length = HEADER_SIZE + get_message_length (message, message_length);
if (stated_length != message_length)
{
g_set_error (error, LIGHTDM_GREETER_ERROR, LIGHTDM_GREETER_ERROR_COMMUNICATION_ERROR,
@@ -552,28 +531,27 @@ send_message (LightDMGreeter *greeter, guint8 *message, gsize message_length, GE
return FALSE;
}
- data = (gchar *) message;
- data_length = message_length;
+ gchar *data = (gchar *) message;
+ gsize data_length = message_length;
while (data_length > 0)
{
- GIOStatus status;
gsize n_written;
g_autoptr(GError) write_error = NULL;
-
- status = g_io_channel_write_chars (priv->to_server_channel, data, data_length, &n_written, &write_error);
+ GIOStatus status = g_io_channel_write_chars (priv->to_server_channel, data, data_length, &n_written, &write_error);
if (write_error)
g_set_error (error, LIGHTDM_GREETER_ERROR, LIGHTDM_GREETER_ERROR_COMMUNICATION_ERROR,
"Failed to write to daemon: %s",
write_error->message);
- if (status == G_IO_STATUS_AGAIN)
+ if (status == G_IO_STATUS_AGAIN)
continue;
- if (status != G_IO_STATUS_NORMAL)
+ if (status != G_IO_STATUS_NORMAL)
return FALSE;
data_length -= n_written;
data += n_written;
}
g_debug ("Wrote %zi bytes to daemon", message_length);
+ g_autoptr(GError) flush_error = NULL;
if (!g_io_channel_flush (priv->to_server_channel, &flush_error))
{
g_set_error (error, LIGHTDM_GREETER_ERROR, LIGHTDM_GREETER_ERROR_COMMUNICATION_ERROR,
@@ -589,46 +567,34 @@ static void
handle_connected (LightDMGreeter *greeter, gboolean v2, guint8 *message, gsize message_length, gsize *offset)
{
LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
- g_autoptr(GString) debug_string = NULL;
int timeout;
Request *request;
- debug_string = g_string_new ("Connected");
+ g_autoptr(GString) debug_string = g_string_new ("Connected");
if (v2)
{
- guint32 i, n_env;
- gchar *version;
-
priv->api_version = read_int (message, message_length, offset);
g_string_append_printf (debug_string, " api=%u", priv->api_version);
- version = read_string (message, message_length, offset);
+ g_autofree gchar *version = read_string (message, message_length, offset);
g_string_append_printf (debug_string, " version=%s", version);
- g_free (version);
- n_env = read_int (message, message_length, offset);
- for (i = 0; i < n_env; i++)
+ guint32 n_env = read_int (message, message_length, offset);
+ for (guint32 i = 0; i < n_env; i++)
{
- gchar *name, *value;
-
- name = read_string (message, message_length, offset);
- value = read_string (message, message_length, offset);
+ gchar *name = read_string (message, message_length, offset);
+ gchar *value = read_string (message, message_length, offset);
g_hash_table_insert (priv->hints, name, value);
g_string_append_printf (debug_string, " %s=%s", name, value);
}
}
else
{
- gchar *version;
-
priv->api_version = 0;
- version = read_string (message, message_length, offset);
+ g_autofree gchar *version = read_string (message, message_length, offset);
g_string_append_printf (debug_string, " version=%s", version);
- g_free (version);
while (*offset < message_length)
{
- gchar *name, *value;
-
- name = read_string (message, message_length, offset);
- value = read_string (message, message_length, offset);
+ gchar *name = read_string (message, message_length, offset);
+ gchar *value = read_string (message, message_length, offset);
g_hash_table_insert (priv->hints, name, value);
g_string_append_printf (debug_string, " %s=%s", name, value);
}
@@ -660,10 +626,8 @@ static void
handle_prompt_authentication (LightDMGreeter *greeter, guint8 *message, gsize message_length, gsize *offset)
{
LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
- guint32 sequence_number, n_messages, i;
- gchar *username;
- sequence_number = read_int (message, message_length, offset);
+ guint32 sequence_number = read_int (message, message_length, offset);
if (sequence_number != priv->authenticate_sequence_number)
{
g_debug ("Ignoring prompt authentication with invalid sequence number %d", sequence_number);
@@ -677,29 +641,26 @@ handle_prompt_authentication (LightDMGreeter *greeter, guint8 *message, gsize me
}
/* Update username */
- username = read_string (message, message_length, offset);
+ g_autofree gchar *username = read_string (message, message_length, offset);
if (strcmp (username, "") == 0)
{
g_free (username);
username = NULL;
}
g_free (priv->authentication_user);
- priv->authentication_user = username;
+ priv->authentication_user = g_steal_pointer (&username);
g_list_free_full (priv->responses_received, g_free);
priv->responses_received = NULL;
priv->n_responses_waiting = 0;
- n_messages = read_int (message, message_length, offset);
+ guint32 n_messages = read_int (message, message_length, offset);
g_debug ("Prompt user with %d message(s)", n_messages);
- for (i = 0; i < n_messages; i++)
+ for (guint32 i = 0; i < n_messages; i++)
{
- int style;
- gchar *text;
-
- style = read_int (message, message_length, offset);
- text = read_string (message, message_length, offset);
+ int style = read_int (message, message_length, offset);
+ g_autofree gchar *text = read_string (message, message_length, offset);
// FIXME: Should stop on prompts?
switch (style)
@@ -719,8 +680,6 @@ handle_prompt_authentication (LightDMGreeter *greeter, guint8 *message, gsize me
g_signal_emit (G_OBJECT (greeter), signals[SHOW_MESSAGE], 0, text, LIGHTDM_MESSAGE_TYPE_INFO);
break;
}
-
- g_free (text);
}
}
@@ -728,19 +687,16 @@ static void
handle_end_authentication (LightDMGreeter *greeter, guint8 *message, gsize message_length, gsize *offset)
{
LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
- guint32 sequence_number, return_code;
- gchar *username;
-
- sequence_number = read_int (message, message_length, offset);
+ guint32 sequence_number = read_int (message, message_length, offset);
if (sequence_number != priv->authenticate_sequence_number)
{
g_debug ("Ignoring end authentication with invalid sequence number %d", sequence_number);
return;
}
- username = read_string (message, message_length, offset);
- return_code = read_int (message, message_length, offset);
+ g_autofree gchar *username = read_string (message, message_length, offset);
+ guint32 return_code = read_int (message, message_length, offset);
g_debug ("Authentication complete for user %s with return code %d", username, return_code);
@@ -751,7 +707,7 @@ handle_end_authentication (LightDMGreeter *greeter, guint8 *message, gsize messa
username = NULL;
}
g_free (priv->authentication_user);
- priv->authentication_user = username;
+ priv->authentication_user = g_steal_pointer (&username);
priv->cancelling_authentication = FALSE;
priv->is_authenticated = (return_code == 0);
@@ -770,17 +726,14 @@ static void
handle_reset (LightDMGreeter *greeter, guint8 *message, gsize message_length, gsize *offset)
{
LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
- g_autoptr(GString) hint_string = NULL;
g_hash_table_remove_all (priv->hints);
- hint_string = g_string_new ("");
+ g_autoptr(GString) hint_string = g_string_new ("");
while (*offset < message_length)
{
- gchar *name, *value;
-
- name = read_string (message, message_length, offset);
- value = read_string (message, message_length, offset);
+ gchar *name = read_string (message, message_length, offset);
+ gchar *value = read_string (message, message_length, offset);
g_hash_table_insert (priv->hints, name, value);
g_string_append_printf (hint_string, " %s=%s", name, value);
}
@@ -794,15 +747,12 @@ static void
handle_session_result (LightDMGreeter *greeter, guint8 *message, gsize message_length, gsize *offset)
{
LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
- Request *request;
/* Notify asynchronous caller */
- request = g_list_nth_data (priv->start_session_requests, 0);
+ Request *request = g_list_nth_data (priv->start_session_requests, 0);
if (request)
{
- guint32 return_code;
-
- return_code = read_int (message, message_length, offset);
+ guint32 return_code = read_int (message, message_length, offset);
if (return_code == 0)
request->result = TRUE;
else
@@ -818,10 +768,9 @@ static void
handle_shared_dir_result (LightDMGreeter *greeter, guint8 *message, gsize message_length, gsize *offset)
{
LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
- Request *request;
/* Notify asynchronous caller */
- request = g_list_nth_data (priv->ensure_shared_data_dir_requests, 0);
+ Request *request = g_list_nth_data (priv->ensure_shared_data_dir_requests, 0);
if (request)
{
request->dir = read_string (message, message_length, offset);
@@ -843,9 +792,7 @@ static void
handle_message (LightDMGreeter *greeter, guint8 *message, gsize message_length)
{
gsize offset = 0;
- guint32 id;
-
- id = read_int (message, message_length, &offset);
+ guint32 id = read_int (message, message_length, &offset);
read_int (message, message_length, &offset);
switch (id)
{
@@ -883,22 +830,20 @@ static gboolean
recv_message (LightDMGreeter *greeter, gboolean block, guint8 **message, gsize *length, GError **error)
{
LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
- gsize n_to_read, n_read;
if (!connect_to_daemon (greeter, error))
return FALSE;
/* Read the header, or the whole message if we already have that */
- n_to_read = HEADER_SIZE;
+ gsize n_to_read = HEADER_SIZE;
if (priv->n_read >= HEADER_SIZE)
n_to_read += get_message_length (priv->read_buffer, priv->n_read);
do
{
- GIOStatus status;
+ gsize n_read;
g_autoptr(GError) read_error = NULL;
-
- status = g_io_channel_read_chars (priv->from_server_channel,
+ GIOStatus status = g_io_channel_read_chars (priv->from_server_channel,
(gchar *) priv->read_buffer + priv->n_read,
n_to_read - priv->n_read,
&n_read,
@@ -959,11 +904,11 @@ static gboolean
from_server_cb (GIOChannel *source, GIOCondition condition, gpointer data)
{
LightDMGreeter *greeter = data;
+
+ /* Read one message and process it */
g_autofree guint8 *message = NULL;
gsize message_length;
g_autoptr(GError) error = NULL;
-
- /* Read one message and process it */
if (!recv_message (greeter, FALSE, &message, &message_length, &error))
{
// FIXME: Should push this up to the client somehow
@@ -980,10 +925,9 @@ from_server_cb (GIOChannel *source, GIOCondition condition, gpointer data)
static gboolean
send_connect (LightDMGreeter *greeter, gboolean resettable, GError **error)
{
+ g_debug ("Connecting to display manager...");
guint8 message[MAX_MESSAGE_LENGTH];
gsize offset = 0;
-
- g_debug ("Connecting to display manager...");
return write_header (message, MAX_MESSAGE_LENGTH, GREETER_MESSAGE_CONNECT, string_length (VERSION) + int_length () * 2, &offset, error) &&
write_string (message, MAX_MESSAGE_LENGTH, VERSION, &offset, error) &&
write_int (message, MAX_MESSAGE_LENGTH, resettable ? 1 : 0, &offset, error) &&
@@ -994,14 +938,13 @@ send_connect (LightDMGreeter *greeter, gboolean resettable, GError **error)
static gboolean
send_start_session (LightDMGreeter *greeter, const gchar *session, GError **error)
{
- guint8 message[MAX_MESSAGE_LENGTH];
- gsize offset = 0;
-
if (session)
g_debug ("Starting session %s", session);
else
g_debug ("Starting default session");
+ guint8 message[MAX_MESSAGE_LENGTH];
+ gsize offset = 0;
return write_header (message, MAX_MESSAGE_LENGTH, GREETER_MESSAGE_START_SESSION, string_length (session), &offset, error) &&
write_string (message, MAX_MESSAGE_LENGTH, session, &offset, error) &&
send_message (greeter, message, offset, error);
@@ -1010,11 +953,10 @@ send_start_session (LightDMGreeter *greeter, const gchar *session, GError **erro
static gboolean
send_ensure_shared_data_dir (LightDMGreeter *greeter, const gchar *username, GError **error)
{
- guint8 message[MAX_MESSAGE_LENGTH];
- gsize offset = 0;
-
g_debug ("Ensuring data directory for user %s", username);
+ guint8 message[MAX_MESSAGE_LENGTH];
+ gsize offset = 0;
return write_header (message, MAX_MESSAGE_LENGTH, GREETER_MESSAGE_ENSURE_SHARED_DIR, string_length (username), &offset, error) &&
write_string (message, MAX_MESSAGE_LENGTH, username, &offset, error) &&
send_message (greeter, message, offset, error);
@@ -1036,15 +978,12 @@ send_ensure_shared_data_dir (LightDMGreeter *greeter, const gchar *username, GEr
void
lightdm_greeter_connect_to_daemon (LightDMGreeter *greeter, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
{
- LightDMGreeterPrivate *priv;
- Request *request;
- GError *error = NULL;
-
g_return_if_fail (LIGHTDM_IS_GREETER (greeter));
- priv = GET_PRIVATE (greeter);
+ LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
- request = request_new (greeter, cancellable, callback, user_data);
+ Request *request = request_new (greeter, cancellable, callback, user_data);
+ GError *error = NULL;
if (send_connect (greeter, priv->resettable, &error))
priv->connect_requests = g_list_append (priv->connect_requests, request);
else
@@ -1068,10 +1007,9 @@ lightdm_greeter_connect_to_daemon (LightDMGreeter *greeter, GCancellable *cancel
gboolean
lightdm_greeter_connect_to_daemon_finish (LightDMGreeter *greeter, GAsyncResult *result, GError **error)
{
- Request *request = REQUEST (result);
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
+ Request *request = REQUEST (result);
if (request->error)
g_propagate_error (error, request->error);
return request->result;
@@ -1089,27 +1027,22 @@ lightdm_greeter_connect_to_daemon_finish (LightDMGreeter *greeter, GAsyncResult
gboolean
lightdm_greeter_connect_to_daemon_sync (LightDMGreeter *greeter, GError **error)
{
- LightDMGreeterPrivate *priv;
- Request *request;
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
- priv = GET_PRIVATE (greeter);
+ LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
/* Read until we are connected */
if (!send_connect (greeter, priv->resettable, error))
return FALSE;
- request = request_new (greeter, NULL, NULL, NULL);
+ Request *request = request_new (greeter, NULL, NULL, NULL);
priv->connect_requests = g_list_append (priv->connect_requests, g_object_ref (request));
do
{
- guint8 *message;
+ g_autofree guint8 *message = NULL;
gsize message_length;
-
if (!recv_message (greeter, TRUE, &message, &message_length, error))
return FALSE;
handle_message (greeter, message, message_length);
- g_free (message);
} while (!request->complete);
return lightdm_greeter_connect_to_daemon_finish (greeter, G_ASYNC_RESULT (request), error);
@@ -1163,6 +1096,13 @@ lightdm_greeter_get_default_session_hint (LightDMGreeter *greeter)
return lightdm_greeter_get_hint (greeter, "default-session");
}
+static gboolean
+get_boolean_hint (LightDMGreeter *greeter, const gchar *name)
+{
+ const gchar *value = lightdm_greeter_get_hint (greeter, name);
+ return g_strcmp0 (value, "true") == 0;
+}
+
/**
* lightdm_greeter_get_hide_users_hint:
* @greeter: A #LightDMGreeter
@@ -1180,12 +1120,8 @@ lightdm_greeter_get_default_session_hint (LightDMGreeter *greeter)
gboolean
lightdm_greeter_get_hide_users_hint (LightDMGreeter *greeter)
{
- const gchar *value;
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
- value = lightdm_greeter_get_hint (greeter, "hide-users");
-
- return g_strcmp0 (value, "true") == 0;
+ return get_boolean_hint (greeter, "hide-users");
}
/**
@@ -1202,12 +1138,8 @@ lightdm_greeter_get_hide_users_hint (LightDMGreeter *greeter)
gboolean
lightdm_greeter_get_show_manual_login_hint (LightDMGreeter *greeter)
{
- const gchar *value;
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
- value = lightdm_greeter_get_hint (greeter, "show-manual-login");
-
- return g_strcmp0 (value, "true") == 0;
+ return get_boolean_hint (greeter, "show-manual-login");
}
/**
@@ -1222,12 +1154,8 @@ lightdm_greeter_get_show_manual_login_hint (LightDMGreeter *greeter)
gboolean
lightdm_greeter_get_show_remote_login_hint (LightDMGreeter *greeter)
{
- const gchar *value;
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
- value = lightdm_greeter_get_hint (greeter, "show-remote-login");
-
- return g_strcmp0 (value, "true") == 0;
+ return get_boolean_hint (greeter, "show-remote-login");
}
/**
@@ -1241,12 +1169,8 @@ lightdm_greeter_get_show_remote_login_hint (LightDMGreeter *greeter)
gboolean
lightdm_greeter_get_lock_hint (LightDMGreeter *greeter)
{
- const gchar *value;
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
- value = lightdm_greeter_get_hint (greeter, "lock-screen");
-
- return g_strcmp0 (value, "true") == 0;
+ return get_boolean_hint (greeter, "lock-screen");
}
/**
@@ -1294,12 +1218,8 @@ lightdm_greeter_get_select_user_hint (LightDMGreeter *greeter)
gboolean
lightdm_greeter_get_select_guest_hint (LightDMGreeter *greeter)
{
- const gchar *value;
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
- value = lightdm_greeter_get_hint (greeter, "select-guest");
-
- return g_strcmp0 (value, "true") == 0;
+ return get_boolean_hint (greeter, "select-guest");
}
/**
@@ -1343,12 +1263,8 @@ lightdm_greeter_get_autologin_session_hint (LightDMGreeter *greeter)
gboolean
lightdm_greeter_get_autologin_guest_hint (LightDMGreeter *greeter)
{
- const gchar *value;
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
- value = lightdm_greeter_get_hint (greeter, "autologin-guest");
-
- return g_strcmp0 (value, "true") == 0;
+ return get_boolean_hint (greeter, "autologin-guest");
}
/**
@@ -1362,11 +1278,10 @@ lightdm_greeter_get_autologin_guest_hint (LightDMGreeter *greeter)
gint
lightdm_greeter_get_autologin_timeout_hint (LightDMGreeter *greeter)
{
- const gchar *value;
- gint timeout = 0;
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
- value = lightdm_greeter_get_hint (greeter, "autologin-timeout");
+
+ const gchar *value = lightdm_greeter_get_hint (greeter, "autologin-timeout");
+ gint timeout = 0;
if (value)
timeout = atoi (value);
if (timeout < 0)
@@ -1384,11 +1299,9 @@ lightdm_greeter_get_autologin_timeout_hint (LightDMGreeter *greeter)
void
lightdm_greeter_cancel_autologin (LightDMGreeter *greeter)
{
- LightDMGreeterPrivate *priv;
-
g_return_if_fail (LIGHTDM_IS_GREETER (greeter));
- priv = GET_PRIVATE (greeter);
+ LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
if (priv->autologin_timeout)
g_source_remove (priv->autologin_timeout);
@@ -1408,13 +1321,9 @@ lightdm_greeter_cancel_autologin (LightDMGreeter *greeter)
gboolean
lightdm_greeter_authenticate (LightDMGreeter *greeter, const gchar *username, GError **error)
{
- LightDMGreeterPrivate *priv;
- guint8 message[MAX_MESSAGE_LENGTH];
- gsize offset = 0;
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
- priv = GET_PRIVATE (greeter);
+ LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
g_return_val_if_fail (priv->connected, FALSE);
@@ -1429,6 +1338,8 @@ lightdm_greeter_authenticate (LightDMGreeter *greeter, const gchar *username, GE
}
g_debug ("Starting authentication for user %s...", username);
+ guint8 message[MAX_MESSAGE_LENGTH];
+ gsize offset = 0;
return write_header (message, MAX_MESSAGE_LENGTH, GREETER_MESSAGE_AUTHENTICATE, int_length () + string_length (username), &offset, error) &&
write_int (message, MAX_MESSAGE_LENGTH, priv->authenticate_sequence_number, &offset, error) &&
write_string (message, MAX_MESSAGE_LENGTH, username, &offset, error) &&
@@ -1447,13 +1358,9 @@ lightdm_greeter_authenticate (LightDMGreeter *greeter, const gchar *username, GE
gboolean
lightdm_greeter_authenticate_as_guest (LightDMGreeter *greeter, GError **error)
{
- LightDMGreeterPrivate *priv;
- guint8 message[MAX_MESSAGE_LENGTH];
- gsize offset = 0;
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
- priv = GET_PRIVATE (greeter);
+ LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
g_return_val_if_fail (priv->connected, FALSE);
@@ -1465,6 +1372,8 @@ lightdm_greeter_authenticate_as_guest (LightDMGreeter *greeter, GError **error)
priv->authentication_user = NULL;
g_debug ("Starting authentication for guest account...");
+ guint8 message[MAX_MESSAGE_LENGTH];
+ gsize offset = 0;
return write_header (message, MAX_MESSAGE_LENGTH, GREETER_MESSAGE_AUTHENTICATE_AS_GUEST, int_length (), &offset, error) &&
write_int (message, MAX_MESSAGE_LENGTH, priv->authenticate_sequence_number, &offset, error) &&
send_message (greeter, message, offset, error);
@@ -1482,9 +1391,7 @@ lightdm_greeter_authenticate_as_guest (LightDMGreeter *greeter, GError **error)
gboolean
lightdm_greeter_authenticate_autologin (LightDMGreeter *greeter, GError **error)
{
- const gchar *user;
-
- user = lightdm_greeter_get_autologin_user_hint (greeter);
+ const gchar *user = lightdm_greeter_get_autologin_user_hint (greeter);
if (lightdm_greeter_get_autologin_guest_hint (greeter))
return lightdm_greeter_authenticate_as_guest (greeter, error);
else if (user)
@@ -1511,13 +1418,9 @@ lightdm_greeter_authenticate_autologin (LightDMGreeter *greeter, GError **error)
gboolean
lightdm_greeter_authenticate_remote (LightDMGreeter *greeter, const gchar *session, const gchar *username, GError **error)
{
- LightDMGreeterPrivate *priv;
- guint8 message[MAX_MESSAGE_LENGTH];
- gsize offset = 0;
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
- priv = GET_PRIVATE (greeter);
+ LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
g_return_val_if_fail (priv->connected, FALSE);
@@ -1533,6 +1436,8 @@ lightdm_greeter_authenticate_remote (LightDMGreeter *greeter, const gchar *sessi
else
g_debug ("Starting authentication for remote session %s...", session);
+ guint8 message[MAX_MESSAGE_LENGTH];
+ gsize offset = 0;
return write_header (message, MAX_MESSAGE_LENGTH, GREETER_MESSAGE_AUTHENTICATE_REMOTE, int_length () + string_length (session) + string_length (username), &offset, error) &&
write_int (message, MAX_MESSAGE_LENGTH, priv->authenticate_sequence_number, &offset, error) &&
write_string (message, MAX_MESSAGE_LENGTH, session, &offset, error) &&
@@ -1553,14 +1458,10 @@ lightdm_greeter_authenticate_remote (LightDMGreeter *greeter, const gchar *sessi
gboolean
lightdm_greeter_respond (LightDMGreeter *greeter, const gchar *response, GError **error)
{
- LightDMGreeterPrivate *priv;
- guint8 message[MAX_MESSAGE_LENGTH];
- gsize offset = 0;
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
g_return_val_if_fail (response != NULL, FALSE);
- priv = GET_PRIVATE (greeter);
+ LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
g_return_val_if_fail (priv->connected, FALSE);
g_return_val_if_fail (priv->n_responses_waiting > 0, FALSE);
@@ -1568,21 +1469,20 @@ lightdm_greeter_respond (LightDMGreeter *greeter, const gchar *response, GError
priv->n_responses_waiting--;
priv->responses_received = g_list_append (priv->responses_received, g_strdup (response));
+ guint8 message[MAX_MESSAGE_LENGTH];
+ gsize offset = 0;
if (priv->n_responses_waiting == 0)
{
- guint32 msg_length;
- GList *iter;
-
g_debug ("Providing response to display manager");
- msg_length = int_length ();
- for (iter = priv->responses_received; iter; iter = iter->next)
+ guint32 msg_length = int_length ();
+ for (GList *iter = priv->responses_received; iter; iter = iter->next)
msg_length += string_length ((gchar *)iter->data);
if (!write_header (message, MAX_MESSAGE_LENGTH, GREETER_MESSAGE_CONTINUE_AUTHENTICATION, msg_length, &offset, error) ||
!write_int (message, MAX_MESSAGE_LENGTH, g_list_length (priv->responses_received), &offset, error))
return FALSE;
- for (iter = priv->responses_received; iter; iter = iter->next)
+ for (GList *iter = priv->responses_received; iter; iter = iter->next)
{
if (!write_string (message, MAX_MESSAGE_LENGTH, (gchar *)iter->data, &offset, error))
return FALSE;
@@ -1609,17 +1509,15 @@ lightdm_greeter_respond (LightDMGreeter *greeter, const gchar *response, GError
gboolean
lightdm_greeter_cancel_authentication (LightDMGreeter *greeter, GError **error)
{
- LightDMGreeterPrivate *priv;
- guint8 message[MAX_MESSAGE_LENGTH];
- gsize offset = 0;
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
- priv = GET_PRIVATE (greeter);
+ LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
g_return_val_if_fail (priv->connected, FALSE);
priv->cancelling_authentication = TRUE;
+ guint8 message[MAX_MESSAGE_LENGTH];
+ gsize offset = 0;
return write_header (message, MAX_MESSAGE_LENGTH, GREETER_MESSAGE_CANCEL_AUTHENTICATION, 0, &offset, error) &&
send_message (greeter, message, offset, error);
}
@@ -1682,16 +1580,14 @@ lightdm_greeter_get_authentication_user (LightDMGreeter *greeter)
gboolean
lightdm_greeter_set_language (LightDMGreeter *greeter, const gchar *language, GError **error)
{
- LightDMGreeterPrivate *priv;
- guint8 message[MAX_MESSAGE_LENGTH];
- gsize offset = 0;
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
- priv = GET_PRIVATE (greeter);
+ LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
g_return_val_if_fail (priv->connected, FALSE);
+ guint8 message[MAX_MESSAGE_LENGTH];
+ gsize offset = 0;
return write_header (message, MAX_MESSAGE_LENGTH, GREETER_MESSAGE_SET_LANGUAGE, string_length (language), &offset, error) &&
write_string (message, MAX_MESSAGE_LENGTH, language, &offset, error) &&
send_message (greeter, message, offset, error);
@@ -1714,16 +1610,13 @@ lightdm_greeter_set_language (LightDMGreeter *greeter, const gchar *language, GE
void
lightdm_greeter_start_session (LightDMGreeter *greeter, const gchar *session, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
{
- LightDMGreeterPrivate *priv;
- Request *request;
- GError *error = NULL;
-
g_return_if_fail (LIGHTDM_IS_GREETER (greeter));
- priv = GET_PRIVATE (greeter);
+ LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
- request = request_new (greeter, cancellable, callback, user_data);
+ Request *request = request_new (greeter, cancellable, callback, user_data);
priv->start_session_requests = g_list_append (priv->start_session_requests, request);
+ GError *error = NULL;
if (!send_start_session (greeter, session, &error))
{
request->error = error;
@@ -1744,11 +1637,10 @@ lightdm_greeter_start_session (LightDMGreeter *greeter, const gchar *session, GC
gboolean
lightdm_greeter_start_session_finish (LightDMGreeter *greeter, GAsyncResult *result, GError **error)
{
- Request *request = REQUEST (result);
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
- if (request->error)
+ Request *request = REQUEST (result);
+ if (request->error)
g_propagate_error (error, request->error);
return request->result;
}
@@ -1766,12 +1658,9 @@ lightdm_greeter_start_session_finish (LightDMGreeter *greeter, GAsyncResult *res
gboolean
lightdm_greeter_start_session_sync (LightDMGreeter *greeter, const gchar *session, GError **error)
{
- LightDMGreeterPrivate *priv;
- Request *request;
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
- priv = GET_PRIVATE (greeter);
+ LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
g_return_val_if_fail (priv->connected, FALSE);
g_return_val_if_fail (priv->is_authenticated, FALSE);
@@ -1779,17 +1668,15 @@ lightdm_greeter_start_session_sync (LightDMGreeter *greeter, const gchar *sessio
/* Read until the session is started */
if (!send_start_session (greeter, session, error))
return FALSE;
- request = request_new (greeter, NULL, NULL, NULL);
+ Request *request = request_new (greeter, NULL, NULL, NULL);
priv->start_session_requests = g_list_append (priv->start_session_requests, g_object_ref (request));
do
{
- guint8 *message;
+ g_autofree guint8 *message = NULL;
gsize message_length;
-
if (!recv_message (greeter, TRUE, &message, &message_length, error))
return FALSE;
handle_message (greeter, message, message_length);
- g_free (message);
} while (!request->complete);
return lightdm_greeter_start_session_finish (greeter, G_ASYNC_RESULT (request), error);
@@ -1817,16 +1704,13 @@ lightdm_greeter_start_session_sync (LightDMGreeter *greeter, const gchar *sessio
void
lightdm_greeter_ensure_shared_data_dir (LightDMGreeter *greeter, const gchar *username, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
{
- LightDMGreeterPrivate *priv;
- Request *request;
- GError *error = NULL;
-
g_return_if_fail (LIGHTDM_IS_GREETER (greeter));
- priv = GET_PRIVATE (greeter);
+ LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
- request = request_new (greeter, cancellable, callback, user_data);
+ Request *request = request_new (greeter, cancellable, callback, user_data);
priv->ensure_shared_data_dir_requests = g_list_append (priv->ensure_shared_data_dir_requests, request);
+ GError *error = NULL;
if (!send_ensure_shared_data_dir (greeter, username, &error))
{
request->error = error;
@@ -1847,10 +1731,9 @@ lightdm_greeter_ensure_shared_data_dir (LightDMGreeter *greeter, const gchar *us
gchar *
lightdm_greeter_ensure_shared_data_dir_finish (LightDMGreeter *greeter, GAsyncResult *result, GError **error)
{
- Request *request = REQUEST (result);
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), NULL);
+ Request *request = REQUEST (result);
if (request->error)
g_propagate_error (error, request->error);
return g_strdup (request->dir);
@@ -1878,29 +1761,24 @@ lightdm_greeter_ensure_shared_data_dir_finish (LightDMGreeter *greeter, GAsyncRe
gchar *
lightdm_greeter_ensure_shared_data_dir_sync (LightDMGreeter *greeter, const gchar *username, GError **error)
{
- LightDMGreeterPrivate *priv;
- Request *request;
-
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), NULL);
- priv = GET_PRIVATE (greeter);
+ LightDMGreeterPrivate *priv = GET_PRIVATE (greeter);
g_return_val_if_fail (priv->connected, NULL);
/* Read until a response */
if (!send_ensure_shared_data_dir (greeter, username, error))
return NULL;
- request = request_new (greeter, NULL, NULL, NULL);
+ Request *request = request_new (greeter, NULL, NULL, NULL);
priv->ensure_shared_data_dir_requests = g_list_append (priv->ensure_shared_data_dir_requests, g_object_ref (request));
do
{
- guint8 *message;
+ g_autofree guint8 *message = NULL;
gsize message_length;
-
if (!recv_message (greeter, TRUE, &message, &message_length, error))
return FALSE;
handle_message (greeter, message, message_length);
- g_free (message);
} while (!request->complete);
return lightdm_greeter_ensure_shared_data_dir_finish (greeter, G_ASYNC_RESULT (request), error);
@@ -1930,9 +1808,7 @@ lightdm_greeter_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- LightDMGreeter *self;
-
- self = LIGHTDM_GREETER (object);
+ LightDMGreeter *self = LIGHTDM_GREETER (object);
switch (prop_id) {
case PROP_DEFAULT_SESSION_HINT:
diff --git a/liblightdm-gobject/language.c b/liblightdm-gobject/language.c
index 615d289d..c6717199 100644
--- a/liblightdm-gobject/language.c
+++ b/liblightdm-gobject/language.c
@@ -21,7 +21,7 @@
* @short_description: Get information on available languages
* @include: lightdm.h
*
- * #LightDMLanguage is an object that describes a language that is available on the system.
+ * #LightDMLanguage is an object that describes a language that is available on the system.
*/
/**
@@ -60,33 +60,25 @@ static GList *languages = NULL;
static void
update_languages (void)
{
- gchar *command = "locale -a";
+ if (have_languages)
+ return;
+
+ const gchar *command = "locale -a";
g_autofree gchar *stdout_text = NULL;
g_autofree gchar *stderr_text = NULL;
gint exit_status;
- gboolean result;
g_autoptr(GError) error = NULL;
-
- if (have_languages)
- return;
-
- result = g_spawn_command_line_sync (command, &stdout_text, &stderr_text, &exit_status, &error);
+ gboolean result = g_spawn_command_line_sync (command, &stdout_text, &stderr_text, &exit_status, &error);
if (error)
g_warning ("Failed to run '%s': %s", command, error->message);
else if (exit_status != 0)
g_warning ("Failed to get languages, '%s' returned %d", command, exit_status);
else if (result)
{
- g_auto(GStrv) tokens = NULL;
- int i;
-
- tokens = g_strsplit_set (stdout_text, "\n\r", -1);
- for (i = 0; tokens[i]; i++)
+ g_auto(GStrv) tokens = g_strsplit_set (stdout_text, "\n\r", -1);
+ for (int i = 0; tokens[i]; i++)
{
- LightDMLanguage *language;
- gchar *code;
-
- code = g_strchug (tokens[i]);
+ const gchar *code = g_strchug (tokens[i]);
if (code[0] == '\0')
continue;
@@ -94,7 +86,7 @@ update_languages (void)
if (strcmp (command, "locale -a") == 0 && !g_strrstr (code, ".utf8"))
continue;
- language = g_object_new (LIGHTDM_TYPE_LANGUAGE, "code", code, NULL);
+ LightDMLanguage *language = g_object_new (LIGHTDM_TYPE_LANGUAGE, "code", code, NULL);
languages = g_list_append (languages, language);
}
}
@@ -358,9 +350,7 @@ lightdm_language_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- LightDMLanguage *self;
-
- self = LIGHTDM_LANGUAGE (object);
+ LightDMLanguage *self = LIGHTDM_LANGUAGE (object);
switch (prop_id) {
case PROP_CODE:
diff --git a/liblightdm-gobject/layout.c b/liblightdm-gobject/layout.c
index 051e570a..f5764c47 100644
--- a/liblightdm-gobject/layout.c
+++ b/liblightdm-gobject/layout.c
@@ -72,15 +72,13 @@ make_layout_string (const gchar *layout, const gchar *variant)
static void
parse_layout_string (const gchar *name, gchar **layout, gchar **variant)
{
- g_auto(GStrv) split = NULL;
-
*layout = NULL;
*variant = NULL;
if (!name)
return;
- split = g_strsplit (name, "\t", 2);
+ g_auto(GStrv) split = g_strsplit (name, "\t", 2);
if (split[0])
{
*layout = g_strdup (split[0]);
@@ -94,15 +92,9 @@ variant_cb (XklConfigRegistry *config,
const XklConfigItem *item,
gpointer data)
{
- LightDMLayout *layout;
- gchar *full_name;
-
- full_name = make_layout_string (data, item->name);
-
- layout = g_object_new (LIGHTDM_TYPE_LAYOUT, "name", full_name, "short-description", item->short_description, "description", item->description, NULL);
+ g_autofree gchar *full_name = make_layout_string (data, item->name);
+ LightDMLayout *layout = g_object_new (LIGHTDM_TYPE_LAYOUT, "name", full_name, "short-description", item->short_description, "description", item->description, NULL);
layouts = g_list_append (layouts, layout);
-
- g_free (full_name);
}
static void
@@ -110,9 +102,7 @@ layout_cb (XklConfigRegistry *config,
const XklConfigItem *item,
gpointer data)
{
- LightDMLayout *layout;
-
- layout = g_object_new (LIGHTDM_TYPE_LAYOUT, "name", item->name, "short-description", item->short_description, "description", item->description, NULL);
+ LightDMLayout *layout = g_object_new (LIGHTDM_TYPE_LAYOUT, "name", item->name, "short-description", item->short_description, "description", item->description, NULL);
layouts = g_list_append (layouts, layout);
xkl_config_registry_foreach_layout_variant (config, item->name, variant_cb, (gpointer) item->name);
@@ -128,8 +118,6 @@ layout_cb (XklConfigRegistry *config,
GList *
lightdm_get_layouts (void)
{
- XklConfigRegistry *registry;
-
if (have_layouts)
return layouts;
@@ -142,7 +130,7 @@ lightdm_get_layouts (void)
if (!xkl_config_rec_get_from_server (xkl_config, xkl_engine))
g_warning ("Failed to get Xkl configuration from server");
- registry = xkl_config_registry_get_instance (xkl_engine);
+ XklConfigRegistry *registry = xkl_config_registry_get_instance (xkl_engine);
xkl_config_registry_load (registry, FALSE);
xkl_config_registry_foreach_layout (registry, layout_cb, NULL);
g_object_unref (registry);
@@ -161,22 +149,21 @@ lightdm_get_layouts (void)
void
lightdm_set_layout (LightDMLayout *dmlayout)
{
- XklConfigRec *config;
- gchar *layout, *variant;
-
g_return_if_fail (dmlayout != NULL);
g_debug ("Setting keyboard layout to '%s'", lightdm_layout_get_name (dmlayout));
+ g_autofree gchar *layout = NULL;
+ g_autofree gchar *variant = NULL;
parse_layout_string (lightdm_layout_get_name (dmlayout), &layout, &variant);
- config = xkl_config_rec_new ();
+ XklConfigRec *config = xkl_config_rec_new ();
config->layouts = g_malloc (sizeof (gchar *) * 2);
config->variants = g_malloc (sizeof (gchar *) * 2);
config->model = g_strdup (xkl_config->model);
- config->layouts[0] = layout;
+ config->layouts[0] = g_steal_pointer (&layout);
config->layouts[1] = NULL;
- config->variants[0] = variant;
+ config->variants[0] = g_steal_pointer (&variant);
config->variants[1] = NULL;
if (!xkl_config_rec_activate (config, xkl_engine))
g_warning ("Failed to activate XKL config");
@@ -197,13 +184,10 @@ lightdm_get_layout (void)
if (layouts && xkl_config && !default_layout)
{
- gchar *full_name;
- GList *item;
-
- full_name = make_layout_string (xkl_config->layouts ? xkl_config->layouts[0] : NULL,
- xkl_config->variants ? xkl_config->variants[0] : NULL);
+ g_autofree gchar *full_name = make_layout_string (xkl_config->layouts ? xkl_config->layouts[0] : NULL,
+ xkl_config->variants ? xkl_config->variants[0] : NULL);
- for (item = layouts; item; item = item->next)
+ for (GList *item = layouts; item; item = item->next)
{
LightDMLayout *iter_layout = (LightDMLayout *) item->data;
if (g_strcmp0 (lightdm_layout_get_name (iter_layout), full_name) == 0)
@@ -212,8 +196,6 @@ lightdm_get_layout (void)
break;
}
}
-
- g_free (full_name);
}
return default_layout;
@@ -303,9 +285,7 @@ lightdm_layout_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- LightDMLayout *self;
-
- self = LIGHTDM_LAYOUT (object);
+ LightDMLayout *self = LIGHTDM_LAYOUT (object);
switch (prop_id) {
case PROP_NAME:
@@ -330,7 +310,7 @@ lightdm_layout_finalize (GObject *object)
LightDMLayoutPrivate *priv = GET_PRIVATE (self);
g_free (priv->name);
- g_free (priv->short_description);
+ g_free (priv->short_description);
g_free (priv->description);
}
diff --git a/liblightdm-gobject/power.c b/liblightdm-gobject/power.c
index 5ad4d4f8..7beca05d 100644
--- a/liblightdm-gobject/power.c
+++ b/liblightdm-gobject/power.c
@@ -57,8 +57,6 @@ upower_call_function (const gchar *function, GError **error)
static GVariant *
login1_call_function (const gchar *function, GVariant *parameters, GError **error)
{
- GVariant *r;
-
if (!login1_proxy)
{
login1_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
@@ -73,22 +71,18 @@ login1_call_function (const gchar *function, GVariant *parameters, GError **erro
return NULL;
}
- r = g_dbus_proxy_call_sync (login1_proxy,
- function,
- parameters,
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- error);
-
- return r;
+ return g_dbus_proxy_call_sync (login1_proxy,
+ function,
+ parameters,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ error);
}
static GVariant *
ck_call_function (const gchar *function, GVariant *parameters, GError **error)
{
- GVariant *r;
-
if (!ck_proxy)
{
ck_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
@@ -103,15 +97,13 @@ ck_call_function (const gchar *function, GVariant *parameters, GError **error)
return FALSE;
}
- r = g_dbus_proxy_call_sync (ck_proxy,
- function,
- parameters,
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- error);
-
- return r;
+ return g_dbus_proxy_call_sync (ck_proxy,
+ function,
+ parameters,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ error);
}
/**
@@ -124,10 +116,8 @@ ck_call_function (const gchar *function, GVariant *parameters, GError **error)
gboolean
lightdm_get_can_suspend (void)
{
+ g_autoptr(GVariant) r = login1_call_function ("CanSuspend", NULL, NULL);
gboolean can_suspend = FALSE;
- g_autoptr(GVariant) r = NULL;
-
- r = login1_call_function ("CanSuspend", NULL, NULL);
if (r)
{
gchar *result;
@@ -164,25 +154,21 @@ lightdm_get_can_suspend (void)
gboolean
lightdm_suspend (GError **error)
{
- g_autoptr(GVariant) login1_result = NULL;
- g_autoptr(GVariant) ck_result = NULL;
- g_autoptr(GVariant) upower_result = NULL;
g_autoptr(GError) login1_error = NULL;
- g_autoptr(GError) ck_error = NULL;
-
- login1_result = login1_call_function ("Suspend", g_variant_new("(b)", FALSE), &login1_error);
+ g_autoptr(GVariant) login1_result = login1_call_function ("Suspend", g_variant_new("(b)", FALSE), &login1_error);
if (login1_result)
return TRUE;
g_debug ("Can't suspend using logind; falling back to ConsoleKit: %s", login1_error->message);
- ck_result = ck_call_function ("Suspend", g_variant_new ("(b)", FALSE), &ck_error);
+ g_autoptr(GError) ck_error = NULL;
+ g_autoptr(GVariant) ck_result = ck_call_function ("Suspend", g_variant_new ("(b)", FALSE), &ck_error);
if (ck_result)
return TRUE;
g_debug ("Can't suspend using logind or ConsoleKit; falling back to UPower: %s", ck_error->message);
- upower_result = upower_call_function ("Suspend", error);
+ g_autoptr(GVariant) upower_result = upower_call_function ("Suspend", error);
return upower_result != NULL;
}
@@ -196,10 +182,8 @@ lightdm_suspend (GError **error)
gboolean
lightdm_get_can_hibernate (void)
{
+ g_autoptr(GVariant) r = login1_call_function ("CanHibernate", NULL, NULL);
gboolean can_hibernate = FALSE;
- g_autoptr(GVariant) r = NULL;
-
- r = login1_call_function ("CanHibernate", NULL, NULL);
if (r)
{
gchar *result;
@@ -236,25 +220,21 @@ lightdm_get_can_hibernate (void)
gboolean
lightdm_hibernate (GError **error)
{
- g_autoptr(GVariant) login1_result = NULL;
- g_autoptr(GVariant) ck_result = NULL;
- g_autoptr(GVariant) upower_result = NULL;
g_autoptr(GError) login1_error = NULL;
- g_autoptr(GError) ck_error = NULL;
-
- login1_result = login1_call_function ("Hibernate", g_variant_new("(b)", FALSE), &login1_error);
+ g_autoptr(GVariant) login1_result = login1_call_function ("Hibernate", g_variant_new("(b)", FALSE), &login1_error);
if (login1_result)
return TRUE;
g_debug ("Can't hibernate using logind; falling back to ConsoleKit: %s", login1_error->message);
- ck_result = ck_call_function ("Hibernate", g_variant_new ("(b)", FALSE), &ck_error);
+ g_autoptr(GError) ck_error = NULL;
+ g_autoptr(GVariant) ck_result = ck_call_function ("Hibernate", g_variant_new ("(b)", FALSE), &ck_error);
if (ck_result)
return TRUE;
g_debug ("Can't hibernate using logind or ConsoleKit; falling back to UPower: %s", ck_error->message);
- upower_result = upower_call_function ("Hibernate", error);
+ g_autoptr(GVariant) upower_result = upower_call_function ("Hibernate", error);
return upower_result != NULL;
}
@@ -268,10 +248,8 @@ lightdm_hibernate (GError **error)
gboolean
lightdm_get_can_restart (void)
{
+ g_autoptr(GVariant) r = login1_call_function ("CanReboot", NULL, NULL);
gboolean can_restart = FALSE;
- g_autoptr(GVariant) r = NULL;
-
- r = login1_call_function ("CanReboot", NULL, NULL);
if (r)
{
gchar *result;
@@ -302,15 +280,12 @@ lightdm_get_can_restart (void)
gboolean
lightdm_restart (GError **error)
{
- g_autoptr(GVariant) login1_result = NULL;
- g_autoptr(GVariant) ck_result = NULL;
g_autoptr(GError) login1_error = NULL;
-
- login1_result = login1_call_function ("Reboot", g_variant_new("(b)", FALSE), &login1_error);
+ g_autoptr(GVariant) login1_result = login1_call_function ("Reboot", g_variant_new("(b)", FALSE), &login1_error);
if (login1_result)
return TRUE;
- ck_result = ck_call_function ("Restart", NULL, error);
+ g_autoptr(GVariant) ck_result = ck_call_function ("Restart", NULL, error);
return ck_result != NULL;
}
@@ -324,10 +299,8 @@ lightdm_restart (GError **error)
gboolean
lightdm_get_can_shutdown (void)
{
+ g_autoptr(GVariant) r = login1_call_function ("CanPowerOff", NULL, NULL);
gboolean can_shutdown = FALSE;
- g_autoptr(GVariant) r = NULL;
-
- r = login1_call_function ("CanPowerOff", NULL, NULL);
if (r)
{
gchar *result;
@@ -358,14 +331,11 @@ lightdm_get_can_shutdown (void)
gboolean
lightdm_shutdown (GError **error)
{
- g_autoptr(GVariant) login1_result = NULL;
- g_autoptr(GVariant) ck_result = NULL;
g_autoptr(GError) login1_error = NULL;
-
- login1_result = login1_call_function ("PowerOff", g_variant_new("(b)", FALSE), &login1_error);
+ g_autoptr(GVariant) login1_result = login1_call_function ("PowerOff", g_variant_new("(b)", FALSE), &login1_error);
if (login1_result)
return TRUE;
- ck_result = ck_call_function ("Stop", NULL, error);
+ g_autoptr(GVariant) ck_result = ck_call_function ("Stop", NULL, error);
return ck_result != NULL;
}
diff --git a/liblightdm-gobject/session.c b/liblightdm-gobject/session.c
index abf03ac3..e1343b44 100644
--- a/liblightdm-gobject/session.c
+++ b/liblightdm-gobject/session.c
@@ -68,78 +68,59 @@ compare_session (gconstpointer a, gconstpointer b)
static LightDMSession *
load_session (GKeyFile *key_file, const gchar *key, const gchar *default_type)
{
- gchar *domain, *name, *type;
- LightDMSession *session;
- LightDMSessionPrivate *priv;
- gchar *try_exec;
-
if (g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY, NULL) ||
g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_HIDDEN, NULL))
return NULL;
#ifdef G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN
- domain = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN, NULL);
+ g_autofree gchar *domain = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN, NULL);
#else
- domain = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, "X-GNOME-Gettext-Domain", NULL);
+ g_autofree gchar *domain = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, "X-GNOME-Gettext-Domain", NULL);
#endif
- name = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, domain, NULL);
+ g_autofree gchar *name = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, domain, NULL);
if (!name)
{
g_warning ("Ignoring session without name");
- g_free (domain);
return NULL;
}
- try_exec = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_TRY_EXEC, domain, NULL);
+ g_autofree gchar *try_exec = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_TRY_EXEC, domain, NULL);
if (try_exec)
{
- gchar *full_path;
-
- full_path = g_find_program_in_path (try_exec);
- g_free (try_exec);
-
+ g_autofree gchar *full_path = g_find_program_in_path (try_exec);
if (!full_path)
- {
- g_free (name);
- g_free (domain);
return NULL;
- }
- g_free (full_path);
}
- type = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, "X-LightDM-Session-Type", NULL);
+ g_autofree gchar *type = g_key_file_get_string (key_file, G_KEY_FILE_DESKTOP_GROUP, "X-LightDM-Session-Type", NULL);
if (!type)
type = strdup (default_type);
- session = g_object_new (LIGHTDM_TYPE_SESSION, NULL);
- priv = GET_PRIVATE (session);
+ LightDMSession *session = g_object_new (LIGHTDM_TYPE_SESSION, NULL);
+ LightDMSessionPrivate *priv = GET_PRIVATE (session);
g_free (priv->key);
priv->key = g_strdup (key);
g_free (priv->type);
- priv->type = type;
+ priv->type = g_steal_pointer (&type);
g_free (priv->name);
- priv->name = name;
+ priv->name = g_steal_pointer (&name);
g_free (priv->comment);
priv->comment = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_COMMENT, domain, NULL);
if (!priv->comment)
priv->comment = g_strdup ("");
- g_free (domain);
-
return session;
}
static GList *
load_sessions_dir (GList *sessions, const gchar *sessions_dir, const gchar *default_type)
{
- GDir *directory;
g_autoptr(GError) error = NULL;
-
- directory = g_dir_open (sessions_dir, 0, &error);
+ GDir *directory = g_dir_open (sessions_dir, 0, &error);
if (error && !g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
g_warning ("Failed to open sessions directory: %s", error->message);
if (!directory)
@@ -147,33 +128,25 @@ load_sessions_dir (GList *sessions, const gchar *sessions_dir, const gchar *defa
while (TRUE)
{
- const gchar *filename;
- gchar *path;
- GKeyFile *key_file;
- gboolean result;
- g_autoptr(GError) e = NULL;
-
- filename = g_dir_read_name (directory);
+ const gchar *filename = g_dir_read_name (directory);
if (filename == NULL)
break;
if (!g_str_has_suffix (filename, ".desktop"))
continue;
- path = g_build_filename (sessions_dir, filename, NULL);
+ g_autofree gchar *path = g_build_filename (sessions_dir, filename, NULL);
- key_file = g_key_file_new ();
- result = g_key_file_load_from_file (key_file, path, G_KEY_FILE_NONE, &e);
+ g_autoptr(GKeyFile) key_file = g_key_file_new ();
+ g_autoptr(GError) e = NULL;
+ gboolean result = g_key_file_load_from_file (key_file, path, G_KEY_FILE_NONE, &e);
if (e)
g_warning ("Failed to load session file %s: %s:", path, e->message);
if (result)
{
- gchar *key;
- LightDMSession *session;
-
- key = g_strndup (filename, strlen (filename) - strlen (".desktop"));
- session = load_session (key_file, key, default_type);
+ g_autofree gchar *key = g_strndup (filename, strlen (filename) - strlen (".desktop"));
+ LightDMSession *session = load_session (key_file, key, default_type);
if (session)
{
g_debug ("Loaded session %s (%s, %s)", path, GET_PRIVATE (session)->name, GET_PRIVATE (session)->comment);
@@ -181,11 +154,7 @@ load_sessions_dir (GList *sessions, const gchar *sessions_dir, const gchar *defa
}
else
g_debug ("Ignoring session %s", path);
- g_free (key);
}
-
- g_free (path);
- g_key_file_free (key_file);
}
g_dir_close (directory);
@@ -196,12 +165,9 @@ load_sessions_dir (GList *sessions, const gchar *sessions_dir, const gchar *defa
static GList *
load_sessions (const gchar *sessions_dir)
{
+ g_auto(GStrv) dirs = g_strsplit (sessions_dir, ":", -1);
GList *sessions = NULL;
- g_auto(GStrv) dirs = NULL;
- int i;
-
- dirs = g_strsplit (sessions_dir, ":", -1);
- for (i = 0; dirs[i]; i++)
+ for (int i = 0; dirs[i]; i++)
{
const gchar *default_type = "x";
@@ -210,27 +176,23 @@ load_sessions (const gchar *sessions_dir)
sessions = load_sessions_dir (sessions, dirs[i], default_type);
}
-
+
return sessions;
}
static void
update_sessions (void)
{
- gchar *sessions_dir;
- gchar *remote_sessions_dir;
- gchar *value;
-
if (have_sessions)
return;
- sessions_dir = g_strdup (SESSIONS_DIR);
- remote_sessions_dir = g_strdup (REMOTE_SESSIONS_DIR);
+ g_autofree gchar *sessions_dir = g_strdup (SESSIONS_DIR);
+ g_autofree gchar *remote_sessions_dir = g_strdup (REMOTE_SESSIONS_DIR);
/* Use session directory from configuration */
config_load_from_standard_locations (config_get_instance (), NULL, NULL);
- value = config_get_string (config_get_instance (), "LightDM", "sessions-directory");
+ gchar *value = config_get_string (config_get_instance (), "LightDM", "sessions-directory");
if (value)
{
g_free (sessions_dir);
@@ -247,9 +209,6 @@ update_sessions (void)
local_sessions = load_sessions (sessions_dir);
remote_sessions = load_sessions (remote_sessions_dir);
- g_free (sessions_dir);
- g_free (remote_sessions_dir);
-
have_sessions = TRUE;
}
@@ -361,9 +320,7 @@ lightdm_session_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- LightDMSession *self;
-
- self = LIGHTDM_SESSION (object);
+ LightDMSession *self = LIGHTDM_SESSION (object);
switch (prop_id) {
case PROP_KEY:
diff --git a/liblightdm-gobject/system.c b/liblightdm-gobject/system.c
index 0e677462..a8104a88 100644
--- a/liblightdm-gobject/system.c
+++ b/liblightdm-gobject/system.c
@@ -43,7 +43,7 @@ static void
use_os_value (const gchar *name, const gchar *value)
{
if (strcmp (name, "ID") == 0)
- os_id = g_strdup (value);
+ os_id = g_strdup (value);
if (strcmp (name, "NAME") == 0)
os_name = g_strdup (value);
if (strcmp (name, "VERSION") == 0)
@@ -57,28 +57,22 @@ use_os_value (const gchar *name, const gchar *value)
static void
load_os_release (void)
{
- g_autofree gchar *data = NULL;
- g_auto(GStrv) lines = NULL;
- guint i;
-
if (os_release_loaded)
return;
+ g_autofree gchar *data = NULL;
if (!g_file_get_contents ("/etc/os-release", &data, NULL, NULL))
return;
- lines = g_strsplit (data, "\n", -1);
- for (i = 0; lines[i] != NULL; i++)
+ g_auto(GStrv) lines = g_strsplit (data, "\n", -1);
+ for (guint i = 0; lines[i] != NULL; i++)
{
g_auto(GStrv) tokens = g_strsplit (lines[i], "=", 2);
if (tokens[0] != NULL && tokens[1] != NULL)
{
- gchar *name, *value;
- size_t value_length;
-
- name = g_strstrip (tokens[0]);
- value = g_strstrip (tokens[1]);
- value_length = strlen (value);
+ const gchar *name = g_strstrip (tokens[0]);
+ gchar *value = g_strstrip (tokens[1]);
+ size_t value_length = strlen (value);
if (value_length > 1 && value[0] == '\"' && value[value_length - 1] == '\"')
{
value[value_length - 1] = '\0';
@@ -178,8 +172,6 @@ gchar *
lightdm_get_motd (void)
{
gchar *data = NULL;
-
g_file_get_contents ("/etc/motd", &data, NULL, NULL);
-
return data;
}
diff --git a/liblightdm-gobject/user.c b/liblightdm-gobject/user.c
index 367b68f7..7fd2ff7a 100644
--- a/liblightdm-gobject/user.c
+++ b/liblightdm-gobject/user.c
@@ -172,9 +172,8 @@ static void
user_list_removed_cb (CommonUserList *common_list, CommonUser *common_user, LightDMUserList *user_list)
{
LightDMUserListPrivate *priv = GET_LIST_PRIVATE (user_list);
- GList *link;
- for (link = priv->lightdm_list; link; link = link->next)
+ for (GList *link = priv->lightdm_list; link; link = link->next)
{
LightDMUser *lightdm_user = link->data;
LightDMUserPrivate *user_priv = GET_USER_PRIVATE (lightdm_user);
@@ -192,14 +191,12 @@ static void
initialize_user_list_if_needed (LightDMUserList *user_list)
{
LightDMUserListPrivate *priv = GET_LIST_PRIVATE (user_list);
- GList *common_users;
- GList *link;
if (priv->initialized)
return;
- common_users = common_user_list_get_users (common_user_list_get_instance ());
- for (link = common_users; link; link = link->next)
+ GList *common_users = common_user_list_get_users (common_user_list_get_instance ());
+ for (GList *link = common_users; link; link = link->next)
{
CommonUser *user = link->data;
LightDMUser *lightdm_user = wrap_common_user (user);
@@ -258,14 +255,12 @@ lightdm_user_list_get_users (LightDMUserList *user_list)
LightDMUser *
lightdm_user_list_get_user_by_name (LightDMUserList *user_list, const gchar *username)
{
- GList *link;
-
g_return_val_if_fail (LIGHTDM_IS_USER_LIST (user_list), NULL);
g_return_val_if_fail (username != NULL, NULL);
initialize_user_list_if_needed (user_list);
- for (link = GET_LIST_PRIVATE (user_list)->lightdm_list; link; link = link->next)
+ for (GList *link = GET_LIST_PRIVATE (user_list)->lightdm_list; link; link = link->next)
{
LightDMUser *user = link->data;
if (g_strcmp0 (lightdm_user_get_name (user), username) == 0)
@@ -295,9 +290,7 @@ lightdm_user_list_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- LightDMUserList *self;
-
- self = LIGHTDM_USER_LIST (object);
+ LightDMUserList *self = LIGHTDM_USER_LIST (object);
switch (prop_id)
{
@@ -631,9 +624,7 @@ lightdm_user_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- LightDMUser *self;
-
- self = LIGHTDM_USER (object);
+ LightDMUser *self = LIGHTDM_USER (object);
switch (prop_id)
{
diff --git a/po/lightdm.pot b/po/lightdm.pot
index 6156e7e1..2534cc2c 100644
--- a/po/lightdm.pot
+++ b/po/lightdm.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2018-01-15 11:22+1300\n"
+"POT-Creation-Date: 2018-01-17 16:42+1300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"