332
334
g_signal_emit (greeter, signals[LOGIN], 0, username, session, language);
338
handle_get_user_defaults (Greeter *greeter, gchar *username)
340
struct passwd *user_info;
342
gboolean have_dmrc = FALSE;
343
gchar *language, *layout, *session;
345
user_info = getpwnam (username);
349
g_warning ("Unable to get information on user %s: User does not exist", username);
351
g_warning ("Unable to get information on user %s: %s", username, strerror (errno));
354
dmrc_file = g_key_file_new ();
356
/* Load the users login settings (~/.dmrc) */
360
path = g_build_filename (user_info->pw_dir, ".dmrc", NULL);
361
have_dmrc = g_key_file_load_from_file (dmrc_file, path, G_KEY_FILE_NONE, NULL);
365
/* If no .dmrc, then load from the cache */
368
gchar *path, *filename;
370
filename = g_strdup_printf ("%s.dmrc", username);
371
path = g_build_filename (CACHE_DIR, "dmrc", filename, NULL);
373
have_dmrc = g_key_file_load_from_file (dmrc_file, path, G_KEY_FILE_NONE, NULL);
377
language = g_key_file_get_string (dmrc_file, "Desktop", "Language", NULL);
379
language = g_strdup ("");
380
layout = g_key_file_get_string (dmrc_file, "Desktop", "Layout", NULL);
382
layout = g_strdup ("");
383
session = g_key_file_get_string (dmrc_file, "Desktop", "Session", NULL);
385
session = g_strdup ("");
387
write_header (greeter, GREETER_MESSAGE_USER_DEFAULTS, string_length (language) + string_length (layout) + string_length (session));
388
write_string (greeter, language);
389
write_string (greeter, layout);
390
write_string (greeter, session);
397
g_key_file_free (dmrc_file);
335
400
#define HEADER_SIZE (sizeof (guint32) * 2)