ekiga r7863 - branches/gnome-2-26/src/gui



Author: ededu
Date: Wed Apr 15 17:46:05 2009
New Revision: 7863
URL: http://svn.gnome.org/viewvc/ekiga?rev=7863&view=rev

Log:
In assistant, fill with user full name by default.

Modified:
   branches/gnome-2-26/src/gui/assistant.cpp

Modified: branches/gnome-2-26/src/gui/assistant.cpp
==============================================================================
--- branches/gnome-2-26/src/gui/assistant.cpp	(original)
+++ branches/gnome-2-26/src/gui/assistant.cpp	Wed Apr 15 17:46:05 2009
@@ -53,6 +53,8 @@
 #include "audioinput-core.h"
 #include "audiooutput-core.h"
 #include <gdk/gdkkeysyms.h>
+#include <sys/types.h>  // for get user full name
+#include <pwd.h>  // for get user full name
 
 G_DEFINE_TYPE (EkigaAssistant, ekiga_assistant, GTK_TYPE_ASSISTANT);
 
@@ -390,8 +392,19 @@
 
   full_name = gm_conf_get_string (PERSONAL_DATA_KEY "full_name");
 
-  if (full_name)
-    gtk_entry_set_text (GTK_ENTRY (assistant->priv->name), full_name);
+  if (!full_name || strlen (full_name) == 0) {
+    // set full_name if possible
+    struct passwd *pw = getpwuid (getuid ());
+    if (pw) {
+      // sometimes, the full name contains also office, room number etc.
+      // and we need to remove them (take until the first "," char)
+      gchar **entry = g_strsplit (pw->pw_gecos, ",", 2);
+      full_name = g_strdup (entry[0]);
+      g_strfreev (entry);
+    }
+  }
+
+  gtk_entry_set_text (GTK_ENTRY (assistant->priv->name), full_name);
 
   g_free (full_name);
 }



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