#include <modest-widget-memory.h>
#include <modest-ui-actions.h>
#include "modest-dnd.h"
+#include <modest-ui-constants.h>
#include "widgets/modest-window.h"
/* Folder view drag types */
gpointer user_data);
static void update_style (ModestFolderView *self);
static void on_notify_style (GObject *obj, GParamSpec *spec, gpointer userdata);
+static gint get_cmp_pos (TnyFolderType t, TnyFolder *folder_store);
enum {
FOLDER_SELECTION_CHANGED_SIGNAL,
}
static void
+format_compact_style (gchar **item_name,
+ GObject *instance,
+ gboolean bold,
+ gboolean *use_markup)
+{
+ TnyFolder *folder;
+ gboolean is_special;
+ TnyFolderType folder_type;
+
+ if (!TNY_IS_FOLDER (instance))
+ return;
+
+ folder = (TnyFolder *) instance;
+
+ folder_type = tny_folder_get_folder_type (folder);
+ is_special = (get_cmp_pos (folder_type, folder)!= 4);
+
+ if (!is_special) {
+ TnyAccount *account = tny_folder_get_account (folder);
+ const gchar *folder_name;
+ gboolean concat_folder_name = FALSE;
+ GString *buffer;
+
+ /* Should not happen */
+ if (account == NULL)
+ return;
+
+ folder_name = tny_folder_get_name (folder);
+ if (g_str_has_suffix (*item_name, folder_name)) {
+ gchar *offset = g_strrstr (*item_name, folder_name);
+ *offset = '\0';
+ concat_folder_name = TRUE;
+ }
+
+ 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, "<span weight='bold'>");
+ buffer = g_string_append (buffer, folder_name);
+ if (bold) buffer = g_string_append (buffer, "</span>");
+ }
+ g_free (*item_name);
+ g_object_unref (account);
+
+ *item_name = g_string_free (buffer, FALSE);
+ *use_markup = bold;
+ } else {
+ *use_markup = FALSE;
+ }
+}
+
+static void
text_cell_data (GtkTreeViewColumn *column,
GtkCellRenderer *renderer,
GtkTreeModel *tree_model,
gchar *fname = NULL;
TnyFolderType type = TNY_FOLDER_TYPE_UNKNOWN;
GObject *instance = NULL;
+ gboolean use_markup = FALSE;
gtk_tree_model_get (tree_model, iter,
NAME_COLUMN, &fname,
if (!item_name)
item_name = g_strdup ("unknown");
+ if (priv->cell_style == MODEST_FOLDER_VIEW_CELL_STYLE_COMPACT) {
+ /* Convert item_name to markup */
+ format_compact_style (&item_name, instance, item_weight == 800, &use_markup);
+ }
+
if (item_name && item_weight) {
/* Set the name in the treeview cell: */
- g_object_set (rendobj, "text", item_name, "weight", item_weight, NULL);
+ if (use_markup)
+ g_object_set (rendobj, "markup", item_name, NULL);
+ else
+ g_object_set (rendobj, "text", item_name, "weight", item_weight, NULL);
/* Notify display name observers */
/* TODO: What listens for this signal, and how can it use only the new name? */
type = modest_tny_folder_guess_folder_type (TNY_FOLDER (instance));
}
+ /* Remote folders should not be treated as special folders */
+ if (TNY_IS_FOLDER_STORE (instance) &&
+ type != TNY_FOLDER_TYPE_INBOX &&
+ modest_tny_folder_store_is_remote (TNY_FOLDER_STORE (instance))) {
+ return get_composite_icons (MODEST_FOLDER_ICON_NORMAL,
+ &normal_pixbuf,
+ &normal_pixbuf_open,
+ &normal_pixbuf_close);
+ }
+
switch (type) {
case TNY_FOLDER_TYPE_INVALID:
g_warning ("%s: BUG: TNY_FOLDER_TYPE_INVALID", __FUNCTION__);
retval = FALSE;
#endif
} else {
- GtkTreeIter parent;
-
- if (priv->style == MODEST_FOLDER_VIEW_STYLE_SHOW_ONE &&
- !gtk_tree_model_iter_parent (model, iter, &parent)) {
+ if (priv->style == MODEST_FOLDER_VIEW_STYLE_SHOW_ONE) {
/* Only show special folders for current account if needed */
if (TNY_IS_FOLDER (instance) && !TNY_IS_MERGE_FOLDER (instance)) {
TnyAccount *account;
#ifdef MODEST_TOOLKIT_HILDON2
model = tny_gtk_folder_list_store_new_with_flags (NULL,
TNY_GTK_FOLDER_LIST_STORE_FLAG_SHOW_PATH);
+ tny_gtk_folder_list_store_set_path_separator (TNY_GTK_FOLDER_LIST_STORE (model),
+ MODEST_FOLDER_PATH_SEPARATOR);
#else
model = tny_gtk_folder_store_tree_model_new (NULL);
#endif