aboutsummaryrefslogtreecommitdiffstats
path: root/mail/e-mail-folder-utils.c
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@gnome-db.org>2011-10-05 19:57:30 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-10-05 19:57:30 +0800
commit4ec46cc05fcb94d181fb9c2412984a1446647c85 (patch)
treed16ce30e77dd539c03509237dd4c723d46aea97a /mail/e-mail-folder-utils.c
parent5ea7e23aef0c239af2600c95419ba0bda0f08b3c (diff)
parent19163c2b71e6128fc9b32287b99b1f4422324c2d (diff)
downloadgsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar
gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.gz
gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.bz2
gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.lz
gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.xz
gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.tar.zst
gsoc2013-evolution-4ec46cc05fcb94d181fb9c2412984a1446647c85.zip
Merge from master
Diffstat (limited to 'mail/e-mail-folder-utils.c')
-rw-r--r--mail/e-mail-folder-utils.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/mail/e-mail-folder-utils.c b/mail/e-mail-folder-utils.c
index 7c84957f6a..77a9708e5f 100644
--- a/mail/e-mail-folder-utils.c
+++ b/mail/e-mail-folder-utils.c
@@ -1630,3 +1630,51 @@ e_mail_folder_uri_from_folder (CamelFolder *folder)
return e_mail_folder_uri_build (store, folder_name);
}
+
+/**
+ * e_mail_folder_uri_to_markup:
+ * @session: a #CamelSession
+ * @folder_uri: a folder URI
+ * @error: return location for a #GError, or %NULL
+ *
+ * Converts @folder_uri to a markup string suitable for displaying to users.
+ * The string consists of the #CamelStore display name (in bold), followed
+ * by the folder path. If the URI is malformed or no corresponding store
+ * exists, the function sets @error and returns %NULL. Free the returned
+ * string with g_free().
+ *
+ * Returns: a newly-allocated markup string, or %NULL
+ **/
+gchar *
+e_mail_folder_uri_to_markup (CamelSession *session,
+ const gchar *folder_uri,
+ GError **error)
+{
+ CamelStore *store = NULL;
+ const gchar *display_name;
+ gchar *folder_name = NULL;
+ gchar *markup;
+ gboolean success;
+
+ g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL);
+ g_return_val_if_fail (folder_uri != NULL, NULL);
+
+ success = e_mail_folder_uri_parse (
+ session, folder_uri, &store, &folder_name, error);
+
+ if (!success)
+ return NULL;
+
+ g_return_val_if_fail (CAMEL_IS_STORE (store), NULL);
+ g_return_val_if_fail (folder_name != NULL, NULL);
+
+ display_name = camel_service_get_display_name (CAMEL_SERVICE (store));
+
+ markup = g_markup_printf_escaped (
+ "<b>%s</b> : %s", display_name, folder_name);
+
+ g_object_unref (store);
+ g_free (folder_name);
+
+ return markup;
+}