[anjuta] libanjuta/various: Create anjuta_util_get_user_mail()



commit 5800a84a7370c1ab7ec214b192af25c2756b7ce7
Author: Johannes Schmid <jhs gnome org>
Date:   Fri Oct 22 15:40:36 2010 +0200

    libanjuta/various: Create anjuta_util_get_user_mail()
    
    Have the code to query for the email address centralized. We need to update that to
    something that gives us what has been configured in GNOME but for now it just returns
    user host

 libanjuta/anjuta-utils.c       |   13 +++++++++++++
 libanjuta/anjuta-utils.h       |    3 +++
 plugins/class-gen/plugin.c     |    2 +-
 plugins/project-wizard/druid.c |    2 +-
 4 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/libanjuta/anjuta-utils.c b/libanjuta/anjuta-utils.c
index 9267d84..b2567b4 100644
--- a/libanjuta/anjuta-utils.c
+++ b/libanjuta/anjuta-utils.c
@@ -2430,3 +2430,16 @@ anjuta_util_drop_get_files (GtkSelectionData *selection_data)
 
 	return files;
 }
+
+/*
+ * anjuta_util_get_user_mail:
+ *
+ * Returns: The e-mail Address of the logged-in user. The resulting string
+ * must be free'd after use.
+ */
+gchar* 
+anjuta_util_get_user_mail()
+{
+	/* FIXME: Use libfolks or something like it to query the mail address */
+	return g_strconcat(g_get_user_name (), "@", g_get_host_name (), NULL);
+}
diff --git a/libanjuta/anjuta-utils.h b/libanjuta/anjuta-utils.h
index 5e24d57..34f7e1b 100644
--- a/libanjuta/anjuta-utils.h
+++ b/libanjuta/anjuta-utils.h
@@ -137,6 +137,9 @@ gchar* anjuta_util_get_user_data_file_path (const gchar* path, ...);
 gchar* anjuta_util_get_user_cache_file_path (const gchar* path, ...);
 gchar* anjuta_util_get_user_config_file_path (const gchar* path, ...);
 
+/* Get the correct e-mail address */
+gchar* anjuta_util_get_user_mail(void);
+
 /* Function for converting GFile objects to string paths 
  * Free the returned list with anjuta_util_glist_strings_free. */
 GList *anjuta_util_convert_gfile_list_to_path_list (GList *list);
diff --git a/plugins/class-gen/plugin.c b/plugins/class-gen/plugin.c
index 7576341..7b07297 100644
--- a/plugins/class-gen/plugin.c
+++ b/plugins/class-gen/plugin.c
@@ -459,7 +459,7 @@ iwizard_activate (IAnjutaWizard *wiz, G_GNUC_UNUSED GError **err)
 
 	user_name = g_strdup(g_get_real_name ());
 	/* FIXME: */
-	user_email = NULL;
+	user_email = anjuta_util_get_user_mail();
 	
 	if (user_name != NULL)
 		cg_window_set_author (cg_plugin->window, user_name);
diff --git a/plugins/project-wizard/druid.c b/plugins/project-wizard/druid.c
index 662efa7..a52953e 100644
--- a/plugins/project-wizard/druid.c
+++ b/plugins/project-wizard/druid.c
@@ -1122,7 +1122,7 @@ npw_druid_add_default_property (NPWDruid* druid)
 	value = npw_value_heap_find_value (druid->values, EMAIL_ADDRESS_PROPERTY);
 
 	/* FIXME: We need a default way for the mail */
-	s = g_strconcat(g_get_user_name (), "@", g_get_host_name (), NULL);
+	s = anjuta_util_get_user_mail();
 	npw_value_set_value (value, s, NPW_VALID_VALUE);
 	g_free (s);
 }



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