From: Jose Dapena Paz Date: Wed, 14 Jan 2009 13:11:51 +0000 (+0000) Subject: Now folder paths are shown as a set of dots (fixes part of NB#97144). X-Git-Tag: git_migration_finished~802 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=d3647c5a35b790224b23c692c95aecebae2ede9b Now folder paths are shown as a set of dots (fixes part of NB#97144). pmo-trunk-r7145 --- diff --git a/src/widgets/modest-folder-view.c b/src/widgets/modest-folder-view.c index e813583..8a2ab7f 100644 --- a/src/widgets/modest-folder-view.c +++ b/src/widgets/modest-folder-view.c @@ -424,6 +424,42 @@ on_get_mmc_account_name (TnyStoreAccount* account, gpointer user_data) } static void +convert_parent_folders_to_dots (gchar **item_name) +{ + gint n_parents = 0; + gchar *c; + gchar *last_separator; + + if (item_name == NULL) + return; + + for (c = *item_name; *c != '\0'; c++) { + if (g_str_has_prefix (c, MODEST_FOLDER_PATH_SEPARATOR)) { + n_parents++; + } + } + + last_separator = g_strrstr (*item_name, MODEST_FOLDER_PATH_SEPARATOR); + if (last_separator != NULL) { + last_separator = last_separator + strlen (MODEST_FOLDER_PATH_SEPARATOR); + } + + if (n_parents > 0) { + GString *buffer; + gint i; + + buffer = g_string_new (""); + for (i = 0; i < n_parents; i++) { + buffer = g_string_append (buffer, MODEST_FOLDER_DOT); + } + buffer = g_string_append (buffer, last_separator); + g_free (*item_name); + *item_name = g_string_free (buffer, FALSE); + } + +} + +static void format_compact_style (gchar **item_name, GObject *instance, gboolean bold, @@ -452,6 +488,9 @@ format_compact_style (gchar **item_name, if (account == NULL) return; + /* convert parent folders to dots */ + convert_parent_folders_to_dots (item_name); + folder_name = tny_folder_get_name (folder); if (g_str_has_suffix (*item_name, folder_name)) { gchar *offset = g_strrstr (*item_name, folder_name); @@ -460,8 +499,7 @@ format_compact_style (gchar **item_name, } buffer = g_string_new (""); - buffer = g_string_append (buffer, tny_account_get_name (account)); - buffer = g_string_append (buffer, MODEST_FOLDER_PATH_SEPARATOR); + buffer = g_string_append (buffer, *item_name); if (concat_folder_name) { if (bold) buffer = g_string_append (buffer, ""); diff --git a/src/widgets/modest-ui-constants.h b/src/widgets/modest-ui-constants.h index 32ba7fa..e2ebc62 100644 --- a/src/widgets/modest-ui-constants.h +++ b/src/widgets/modest-ui-constants.h @@ -61,5 +61,6 @@ #define MODEST_DIALOG_WINDOW_MIN_WIDTH 172 #endif #define MODEST_FOLDER_PATH_SEPARATOR " / " +#define MODEST_FOLDER_DOT " · " #endif /*__MODEST_MAEMO_UI_CONSTANTS_H__*/