[gdm] display: Clean up get_timed_login_details



commit d94f5a79acf308e2d1adb25790e8379f8a839ba3
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Feb 13 14:52:49 2014 -0500

    display: Clean up get_timed_login_details
    
    Make it properly log itself as a GdmDisplay method, and use
    local variables to ensure that callers can pass NULL.

 daemon/gdm-display.c |   34 ++++++++++++++++++++++++++--------
 1 files changed, 26 insertions(+), 8 deletions(-)
---
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
index 1791127..67ebac8 100644
--- a/daemon/gdm-display.c
+++ b/daemon/gdm-display.c
@@ -438,20 +438,38 @@ gdm_display_real_get_timed_login_details (GdmDisplay *display,
 
 gboolean
 gdm_display_get_timed_login_details (GdmDisplay *display,
-                                     gboolean   *enabled,
-                                     char      **username,
-                                     int        *delay,
+                                     gboolean   *out_enabled,
+                                     char      **out_username,
+                                     int        *out_delay,
                                      GError    **error)
 {
+        gboolean enabled;
+        char *username;
+        int delay;
+
         g_return_val_if_fail (GDM_IS_DISPLAY (display), FALSE);
 
-        GDM_DISPLAY_GET_CLASS (display)->get_timed_login_details (display, enabled, username, delay);
+        GDM_DISPLAY_GET_CLASS (display)->get_timed_login_details (display, &enabled, &username, &delay);
 
-        g_debug ("GdmSlave: Got timed login details for display %s: %d '%s' %d",
+        g_debug ("GdmDisplay: Got timed login details for display %s: %d '%s' %d",
                  display->priv->x11_display_name,
-                 *enabled,
-                 *username ? *username : "(null)",
-                 *delay);
+                 enabled,
+                 username,
+                 delay);
+
+        if (out_enabled) {
+                *out_enabled = enabled;
+        }
+
+        if (out_username) {
+                *out_username = username;
+        } else {
+                g_free (username);
+        }
+
+        if (out_delay) {
+                *out_delay = delay;
+        }
 
         return TRUE;
 }


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