Author: kelnos
Date: 2008-11-28 00:07:10 +0000 (Fri, 28 Nov 2008)
New Revision: 28936

Modified:
   xfce4-session/trunk/ChangeLog
   xfce4-session/trunk/configure.in.in
   xfce4-session/trunk/xfce4-session/shutdown.c
Log:
        * configure.in.in: Check for pwd.h and getpwuid ().
        * xfce4-session/shutdown.c: Display the currently logged-in user
          in a label in the shutdown dialog.

Modified: xfce4-session/trunk/ChangeLog
===================================================================
--- xfce4-session/trunk/ChangeLog       2008-11-27 21:28:06 UTC (rev 28935)
+++ xfce4-session/trunk/ChangeLog       2008-11-28 00:07:10 UTC (rev 28936)
@@ -1,3 +1,9 @@
+2008-11-27     Brian Tarricone <[EMAIL PROTECTED]>
+
+       * configure.in.in: Check for pwd.h and getpwuid ().
+       * xfce4-session/shutdown.c: Display the currently logged-in user
+         in a label in the shutdown dialog.
+
 2008-11-15     Brian Tarricone <[EMAIL PROTECTED]>
 
        * xfce4-session/xfsm-startup.c: Be sure to properly signal that

Modified: xfce4-session/trunk/configure.in.in
===================================================================
--- xfce4-session/trunk/configure.in.in 2008-11-27 21:28:06 UTC (rev 28935)
+++ xfce4-session/trunk/configure.in.in 2008-11-28 00:07:10 UTC (rev 28936)
@@ -49,10 +49,10 @@
 dnl check for standard header files
 AC_HEADER_STDC
 AC_CHECK_HEADERS([asm/unistd.h errno.h fcntl.h limits.h \
-                  netdb.h signal.h stdarg.h sys/param.h sys/resource.h \
+                  netdb.h pwd.h signal.h stdarg.h sys/param.h sys/resource.h \
                   sys/socket.h sys/time.h sys/wait.h sys/utsname.h time.h \
                   unistd.h])
-AC_CHECK_FUNCS([getaddrinfo gethostbyname gethostname setsid \
+AC_CHECK_FUNCS([getaddrinfo gethostbyname gethostname getpwuid setsid \
                 sigaction strdup sync vfork])
 
 dnl Check for X11 installed

Modified: xfce4-session/trunk/xfce4-session/shutdown.c
===================================================================
--- xfce4-session/trunk/xfce4-session/shutdown.c        2008-11-27 21:28:06 UTC 
(rev 28935)
+++ xfce4-session/trunk/xfce4-session/shutdown.c        2008-11-28 00:07:10 UTC 
(rev 28936)
@@ -40,6 +40,15 @@
 #include <unistd.h>
 #endif
 
+#ifdef HAVE_GETPWUID
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+#endif
+
 #ifdef HAVE_ASM_UNISTD_H
 #include <asm/unistd.h>  /* for __NR_ioprio_set */
 #endif
@@ -198,6 +207,9 @@
   GdkPixmap *screenshot_pm = NULL;
   GdkGC *screenshot_gc;
 #endif
+#ifdef HAVE_GETPWUID
+  struct passwd *pw;
+#endif
 
   g_return_val_if_fail(saveSession != NULL, FALSE);
   g_return_val_if_fail(shutdownType != NULL, FALSE);
@@ -341,6 +353,26 @@
   gtk_container_set_border_width (GTK_CONTAINER (vbox), BORDER);
   gtk_widget_show(vbox);
 
+#ifdef HAVE_GETPWUID
+  pw = getpwuid (getuid ());
+  if (G_LIKELY(pw && pw->pw_name && *pw->pw_name))
+    {
+      gchar *text = g_strdup_printf (_("<span size='large'><b>Log off 
%s</b></span>"), pw->pw_name);
+      GtkWidget *label = g_object_new (GTK_TYPE_LABEL,
+                                       "label", text,
+                                       "use-markup", TRUE,
+                                       "justify", GTK_JUSTIFY_CENTER,
+                                       "xalign", 0.5,
+                                       "yalign", 0.5,
+                                       NULL);
+
+      gtk_widget_show (label);
+      gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+
+      g_free (text);
+    }
+#endif
+
   hbox = gtk_hbox_new (TRUE, BORDER);
   gtk_widget_show (hbox);
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to