]> rtime.felk.cvut.cz Git - sojka/lightdm.git/commitdiff
Whitespace fixes
authorIain Lane <iain.lane@canonical.com>
Tue, 23 Apr 2013 12:24:32 +0000 (13:24 +0100)
committerIain Lane <iain.lane@canonical.com>
Tue, 23 Apr 2013 12:24:32 +0000 (13:24 +0100)
I'm sure there's more.

liblightdm-gobject/power.c
src/session.c
tests/src/test-runner.c

index 58ddad9658f7bdce8d56baa0eccec114983d2d90..d0528587cc0b0982663e58ae65b4df3c8f308661 100644 (file)
@@ -115,7 +115,7 @@ lightdm_get_can_suspend (void)
  * @error: return location for a #GError, or %NULL
  *
  * Triggers a system suspend.
- * 
+ *
  * Return value: #TRUE if suspend initiated.
  **/
 gboolean
@@ -124,15 +124,16 @@ lightdm_suspend (GError **error)
     GVariant *result;
     gboolean suspended;
 
-    result = login1_call_function ("Suspend", g_variant_new("(b)", FALSE), error);
+    result = login1_call_function ("Suspend", g_variant_new("(b)", FALSE),
+                                   error);
 
     if (!result)
     {
-      if (error)
-       g_debug ("Can't suspend using logind; falling back to UPower: %s",
-                   (*error)->message);
-      g_clear_error (error);
-      result = upower_call_function ("Suspend", error);
+        if (error)
+            g_debug ("Can't suspend using logind; falling back to UPower: %s",
+                     (*error)->message);
+        g_clear_error (error);
+        result = upower_call_function ("Suspend", error);
     }
 
     suspended = result != NULL;
@@ -183,7 +184,7 @@ lightdm_get_can_hibernate (void)
  * @error: return location for a #GError, or %NULL
  *
  * Triggers a system hibernate.
- * 
+ *
  * Return value: #TRUE if hibernate initiated.
  **/
 gboolean
@@ -192,20 +193,21 @@ lightdm_hibernate (GError **error)
     GVariant *result;
     gboolean hibernated;
 
-    result = login1_call_function ("Hibernate", g_variant_new("(b)", FALSE), error);
+    result = login1_call_function ("Hibernate", g_variant_new("(b)", FALSE),
+                                   error);
 
     if (!result)
     {
-      if (error)
-       g_debug ("Can't hibernate using logind; falling back to UPower: %s",
-                   (*error)->message);
-      g_clear_error (error);
-      result = upower_call_function ("Hibernate", error);
+        if (error)
+            g_debug ("Can't hibernate using logind; falling back to UPower: %s",
+                     (*error)->message);
+        g_clear_error (error);
+        result = upower_call_function ("Hibernate", error);
     }
 
     hibernated = result != NULL;
     if (result)
-      g_variant_unref (result);
+        g_variant_unref (result);
 
     return hibernated;
 }
@@ -315,7 +317,7 @@ lightdm_get_can_shutdown (void)
 {
     gboolean can_shutdown = FALSE;
     GVariant *r;
-  
+
     r = login1_call_function ("CanPowerOff", NULL, NULL);
     if (r)
     {
index dca8dbeeb332e7933473a59c7b2bc3f8f79e037f..a1368e592b01b76f1942a2579d7c02a3bd478215 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 2010-2011 Robert Ancell.
  * Author: Robert Ancell <robert.ancell@canonical.com>
- * 
+ *
  * 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 3 of the License, or (at your option) any later
@@ -65,16 +65,16 @@ struct SessionPrivate
     gboolean authentication_complete;
     int authentication_result;
     gchar *authentication_result_string;
-  
+
     /* File to log to */
     gchar *log_filename;
-  
+
     /* Seat class */
     gchar *class;
 
     /* tty this session is running on */
     gchar *tty;
-  
+
     /* X display connected to */
     gchar *xdisplay;
     XAuthority *xauthority;
@@ -212,10 +212,10 @@ read_string_from_child (Session *session)
         g_warning ("Invalid string length %d from child", length);
         return NULL;
     }
-  
+
     value = g_malloc (sizeof (char) * (length + 1));
     read_from_child (session, value, length);
-    value[length] = '\0';      
+    value[length] = '\0';
 
     return value;
 }
@@ -226,7 +226,7 @@ session_watch_cb (GPid pid, gint status, gpointer data)
     Session *session = data;
 
     session->priv->pid = 0;
-  
+
     if (WIFEXITED (status))
         g_debug ("Session %d exited with return value %d", pid, WEXITSTATUS (status));
     else if (WIFSIGNALED (status))
@@ -240,7 +240,7 @@ session_watch_cb (GPid pid, gint status, gpointer data)
         session->priv->authentication_result = PAM_CONV_ERR;
         g_free (session->priv->authentication_result_string);
         session->priv->authentication_result_string = g_strdup ("Authentication stopped before completion");
-        g_signal_emit (G_OBJECT (session), signals[AUTHENTICATION_COMPLETE], 0);      
+        g_signal_emit (G_OBJECT (session), signals[AUTHENTICATION_COMPLETE], 0);
     }
 
     g_signal_emit (G_OBJECT (session), signals[STOPPED], 0);
@@ -317,14 +317,14 @@ from_child_cb (GIOChannel *source, GIOCondition condition, gpointer data)
         for (i = 0; i < session->priv->messages_length; i++)
         {
             struct pam_message *m = &session->priv->messages[i];
-            read_from_child (session, &m->msg_style, sizeof (m->msg_style));          
+            read_from_child (session, &m->msg_style, sizeof (m->msg_style));
             m->msg = read_string_from_child (session);
         }
 
         g_debug ("Session %d got %d message(s) from PAM", session->priv->pid, session->priv->messages_length);
 
         g_signal_emit (G_OBJECT (session), signals[GOT_MESSAGES], 0);
-    }    
+    }
 
     return TRUE;
 }
@@ -397,7 +397,7 @@ session_start (Session *session, const gchar *service, const gchar *username, gb
     /* Close the ends of the pipes we don't need */
     close (to_child_output);
     close (from_child_input);
-  
+
     /* Indicate what version of the protocol we are using */
     version = 0;
     write_data (session, &version, sizeof (version));
@@ -428,7 +428,7 @@ session_start (Session *session, const gchar *service, const gchar *username, gb
         write_data (session, xauth_get_authorization_data (session->priv->xauthority), length);
     }
     else
-        write_string (session, NULL);    
+        write_string (session, NULL);
 
     g_debug ("Started session %d with service '%s', username '%s'", session->priv->pid, service, username);
 
@@ -478,7 +478,7 @@ session_respond_error (Session *session, int error)
     g_return_if_fail (session != NULL);
     g_return_if_fail (error != PAM_SUCCESS);
 
-    write_data (session, &error, sizeof (error));  
+    write_data (session, &error, sizeof (error));
 }
 
 int
@@ -535,7 +535,7 @@ session_run (Session *session, gchar **argv)
     {
         gchar *run_dir, *dir;
 
-        run_dir = config_get_string (config_get_instance (), "LightDM", "run-directory");          
+        run_dir = config_get_string (config_get_instance (), "LightDM", "run-directory");
         dir = g_build_filename (run_dir, session->priv->username, NULL);
         g_free (run_dir);
 
@@ -572,7 +572,7 @@ session_run (Session *session, gchar **argv)
 
 void
 session_lock (Session *session)
-{    
+{
     g_return_if_fail (session != NULL);
     if (getuid () == 0)
     {
@@ -585,7 +585,7 @@ session_lock (Session *session)
 
 void
 session_unlock (Session *session)
-{    
+{
     g_return_if_fail (session != NULL);
     if (getuid () == 0)
     {
@@ -600,7 +600,7 @@ void
 session_stop (Session *session)
 {
     g_return_if_fail (session != NULL);
-  
+
     if (session->priv->pid > 0)
     {
         g_debug ("Session %d: Sending SIGTERM", session->priv->pid);
index f31f4056e96c50e80772c778431e2eb61633b31d..aa2df6616044f50e8963c4d3f636a584b0d01b52 100644 (file)
@@ -144,7 +144,7 @@ process_exit_cb (GPid pid, gint status, gpointer data)
 {
     Process *process;
     gchar *status_text;
-  
+
     if (getenv ("DEBUG"))
     {
         if (WIFEXITED (status))
@@ -183,7 +183,7 @@ process_exit_cb (GPid pid, gint status, gpointer data)
 static Process *
 watch_process (pid_t pid)
 {
-    Process *process;  
+    Process *process;
 
     process = g_malloc0 (sizeof (Process));
     process->pid = pid;
@@ -370,7 +370,7 @@ handle_command (const gchar *command)
     else if (strcmp (name, "SWITCH-TO-USER") == 0)
     {
         gchar *status_text, *username;
-          
+
         username = g_hash_table_lookup (params, "USERNAME");
         g_dbus_connection_call_sync (g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL),
                                      "org.freedesktop.DisplayManager",
@@ -466,21 +466,21 @@ handle_command (const gchar *command)
             StatusClient *client = link->data;
             int length;
             GError *error = NULL;
-      
+
             length = strlen (command);
             g_socket_send (client->socket, (gchar *) &length, sizeof (length), NULL, &error);
             g_socket_send (client->socket, command, strlen (command), NULL, &error);
             if (error)
                 g_printerr ("Failed to write to client socket: %s\n", error->message);
             g_clear_error (&error);
-        }     
+        }
     }
     else
     {
         g_printerr ("Unknown command '%s'\n", name);
         quit (EXIT_FAILURE);
     }
-  
+
     g_free (name);
     g_hash_table_unref (params);
 }
@@ -524,9 +524,9 @@ check_status (const gchar *status)
 
     if (stop)
         return;
-  
+
     statuses = g_list_append (statuses, g_strdup (status));
-  
+
     if (getenv ("DEBUG"))
         g_print ("%s\n", status);
 
@@ -538,7 +538,7 @@ check_status (const gchar *status)
         result = g_regex_match_simple (full_pattern, status, 0, 0);
         g_free (full_pattern);
     }
-  
+
     if (!result)
     {
         fail (NULL, pattern);
@@ -696,7 +696,7 @@ upower_name_acquired_cb (GDBusConnection *connection,
 
     upower_info = g_dbus_node_info_new_for_xml (upower_interface, &error);
     if (error)
-        g_warning ("Failed to parse D-Bus interface: %s", error->message);  
+        g_warning ("Failed to parse D-Bus interface: %s", error->message);
     g_clear_error (&error);
     if (!upower_info)
         return;
@@ -840,16 +840,16 @@ handle_ck_call (GDBusConnection       *connection,
 }
 
 
-// Shared between CK and Login1 - identical signatures
+/* Shared between CK and Login1 - identical signatures */
 static void
 handle_session_call (GDBusConnection       *connection,
-                        const gchar           *sender,
-                        const gchar           *object_path,
-                        const gchar           *interface_name,
-                        const gchar           *method_name,
-                        GVariant              *parameters,
-                        GDBusMethodInvocation *invocation,
-                        gpointer               user_data)
+                     const gchar           *sender,
+                     const gchar           *object_path,
+                     const gchar           *interface_name,
+                     const gchar           *method_name,
+                     GVariant              *parameters,
+                     GDBusMethodInvocation *invocation,
+                     gpointer               user_data)
 {
     if (strcmp (method_name, "Lock") == 0)
         g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
@@ -916,13 +916,13 @@ ck_name_acquired_cb (GDBusConnection *connection,
 
     ck_info = g_dbus_node_info_new_for_xml (ck_interface, &error);
     if (error)
-        g_warning ("Failed to parse D-Bus interface: %s", error->message);  
+        g_warning ("Failed to parse D-Bus interface: %s", error->message);
     g_clear_error (&error);
     if (!ck_info)
         return;
     ck_session_info = g_dbus_node_info_new_for_xml (ck_session_interface, &error);
     if (error)
-        g_warning ("Failed to parse D-Bus interface: %s", error->message);  
+        g_warning ("Failed to parse D-Bus interface: %s", error->message);
     g_clear_error (&error);
     if (!ck_session_info)
         return;
@@ -958,7 +958,7 @@ start_console_kit_daemon ()
 
 static Login1Session *
 open_login1_session (GDBusConnection *connection,
-                    GVariant *params)
+                     GVariant *params)
 {
     Login1Session *session;
     GError *error = NULL;
@@ -973,33 +973,33 @@ open_login1_session (GDBusConnection *connection,
         "</node>";
     static const GDBusInterfaceVTable login1_session_vtable =
     {
-       handle_session_call,
+        handle_session_call,
     };
 
     session = g_malloc0 (sizeof (Login1Session));
     login1_sessions = g_list_append (login1_sessions, session);
 
     session->path = g_strdup_printf("/org/freedesktop/login1/Session/c%d",
-                                   login1_session_index++);
+                                    login1_session_index++);
 
 
 
     login1_session_info = g_dbus_node_info_new_for_xml (login1_session_interface,
-                                                       &error);
+                                                        &error);
     if (error)
         g_warning ("Failed to parse login1 session D-Bus interface: %s",
-                  error->message);  
+                   error->message);
     g_clear_error (&error);
     if (!login1_session_info)
         return;
 
     g_dbus_connection_register_object (connection,
-                                      session->path,
-                                      login1_session_info->interfaces[0],
-                                      &login1_session_vtable,
-                                      session,
-                                      NULL,
-                                      &error);
+                                       session->path,
+                                       login1_session_info->interfaces[0],
+                                       &login1_session_vtable,
+                                       session,
+                                       NULL,
+                                       &error);
     if (error)
         g_warning ("Failed to register login1 session: %s", error->message);
     g_clear_error (&error);
@@ -1022,31 +1022,31 @@ handle_login1_call (GDBusConnection       *connection,
 
     if (strcmp (method_name, "GetSessionByPID") == 0)
     {
-       //Look for a session with our PID, and create one if we don't have one
-       //already.
-       GList *link;
-       guint pid;
-       Login1Session *ret = NULL;
-
-       g_variant_get (parameters, "(u)", &pid);
-
-       for (link = login1_sessions; link; link = link->next)
-       {
-           Login1Session *session;
-           session = link->data;
-           if (session->pid == pid)
-           {
-               ret = session;
-               break;
-           }
-       }
-       // Not found
-       if (!ret)
-           ret = open_login1_session (connection, parameters);
-
-       g_dbus_method_invocation_return_value (invocation,
-                                              g_variant_new("(o)", ret->path));
-       
+        /* Look for a session with our PID, and create one if we don't have one
+           already. */
+        GList *link;
+        guint pid;
+        Login1Session *ret = NULL;
+
+        g_variant_get (parameters, "(u)", &pid);
+
+        for (link = login1_sessions; link; link = link->next)
+        {
+            Login1Session *session;
+            session = link->data;
+            if (session->pid == pid)
+            {
+                ret = session;
+                break;
+            }
+        }
+        // Not found
+        if (!ret)
+            ret = open_login1_session (connection, parameters);
+
+        g_dbus_method_invocation_return_value (invocation,
+                                               g_variant_new("(o)", ret->path));
+
     }
     else if (strcmp (method_name, "CanReboot") == 0)
     {
@@ -1284,7 +1284,7 @@ handle_accounts_call (GDBusConnection       *connection,
 
         g_variant_builder_init (&builder, G_VARIANT_TYPE ("ao"));
 
-        load_passwd_file ();      
+        load_passwd_file ();
         for (link = accounts_users; link; link = link->next)
         {
             AccountsUser *user = link->data;
@@ -1317,7 +1317,7 @@ handle_accounts_call (GDBusConnection       *connection,
             g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "No such user: %s", user_name);
     }
     else
-        g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "No such method: %s", method_name);    
+        g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "No such method: %s", method_name);
 }
 
 static void
@@ -1426,13 +1426,13 @@ accounts_name_acquired_cb (GDBusConnection *connection,
 
     accounts_info = g_dbus_node_info_new_for_xml (accounts_interface, &error);
     if (error)
-        g_warning ("Failed to parse D-Bus interface: %s", error->message);  
+        g_warning ("Failed to parse D-Bus interface: %s", error->message);
     g_clear_error (&error);
     if (!accounts_info)
         return;
     user_info = g_dbus_node_info_new_for_xml (user_interface, &error);
     if (error)
-        g_warning ("Failed to parse D-Bus interface: %s", error->message);  
+        g_warning ("Failed to parse D-Bus interface: %s", error->message);
     g_clear_error (&error);
     if (!user_info)
         return;
@@ -1558,7 +1558,7 @@ main (int argc, char **argv)
         g_critical ("Error getting current directory: %s", strerror (errno));
         quit (EXIT_FAILURE);
     }
-  
+
     /* Don't contact our X server */
     g_unsetenv ("DISPLAY");
 
@@ -1573,7 +1573,7 @@ main (int argc, char **argv)
     g_free (path);
 
     /* Use locally built libraries */
-    path1 = g_build_filename (BUILDDIR, "liblightdm-gobject", ".libs", NULL);  
+    path1 = g_build_filename (BUILDDIR, "liblightdm-gobject", ".libs", NULL);
     path2 = g_build_filename (BUILDDIR, "liblightdm-qt", ".libs", NULL);
     ld_library_path = g_strdup_printf ("%s:%s", path1, path2);
     g_free (path1);
@@ -1644,7 +1644,7 @@ main (int argc, char **argv)
 
     /* Always copy the script */
     if (system (g_strdup_printf ("cp %s %s/script", config_path, temp_dir)))
-        perror ("Failed to copy configuration");  
+        perror ("Failed to copy configuration");
 
     /* Copy over the greeter files */
     if (system (g_strdup_printf ("cp -r %s/xsessions %s/usr/share", DATADIR, temp_dir)))
@@ -1702,7 +1702,7 @@ main (int argc, char **argv)
         /* This account has a set of keyboard layouts */
         {"have-layouts",     "",         TRUE,  "Layouts User",       NULL,  "ru", "fr\toss;ru;", NULL,          1010},
         /* This account has a language set */
-        {"have-language",    "",         TRUE,  "Language User",      NULL,  NULL, NULL,          "en_AU.utf8",  1011},      
+        {"have-language",    "",         TRUE,  "Language User",      NULL,  NULL, NULL,          "en_AU.utf8",  1011},
         /* This account has a preconfigured session */
         {"have-session",            "",  TRUE,  "Session User", "alternative", NULL, NULL,        NULL,          1012},
         /* This account has the home directory mounted on login */
@@ -1776,6 +1776,7 @@ main (int argc, char **argv)
         {
             g_key_file_set_string (dmrc_file, "X-Accounts", "Layouts", users[i].dbus_layouts);
             save_dmrc = TRUE;
+
         }
         if (users[i].language)
         {
@@ -1791,7 +1792,7 @@ main (int argc, char **argv)
             data = g_key_file_to_data (dmrc_file, NULL, NULL);
             g_file_set_contents (path, data, -1, NULL);
             g_free (data);
-            g_free (path);         
+            g_free (path);
         }
 
         g_key_file_free (dmrc_file);