summaryrefslogtreecommitdiff
path: root/xfce4-session
diff options
context:
space:
mode:
authorBrian Tarricone <brian@tarricone.org>2008-11-28 00:07:10 +0000
committerBrian Tarricone <brian@tarricone.org>2008-11-28 00:07:10 +0000
commitcd0ab3168a6368e257ef3b0063341be1826df17c (patch)
tree04e745f39ed8df3a494735338180ce45c263ee96 /xfce4-session
parent1b07708c192dfe9c43ed949f35e462cca6b21a55 (diff)
downloadxfce4-session-cd0ab3168a6368e257ef3b0063341be1826df17c.tar.gz
* 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. (Old svn revision: 28936)
Diffstat (limited to 'xfce4-session')
-rw-r--r--xfce4-session/shutdown.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/xfce4-session/shutdown.c b/xfce4-session/shutdown.c
index 6308b61d..dc3589fb 100644
--- a/xfce4-session/shutdown.c
+++ b/xfce4-session/shutdown.c
@@ -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 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea
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 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea
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);