GtkCellRenderer *messages_renderer;
GSList *signal_handlers;
- GdkColor *active_color;
+ GdkColor active_color;
};
#define MODEST_FOLDER_VIEW_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), \
convert_parent_folders_to_dots (gchar **item_name)
{
gint n_parents = 0;
+ gint n_inbox_parents = 0;
gchar *c;
+ gchar *path_start;
gchar *last_separator;
if (item_name == NULL)
return;
+ path_start = *item_name;
for (c = *item_name; *c != '\0'; c++) {
if (g_str_has_prefix (c, MODEST_FOLDER_PATH_SEPARATOR)) {
+ gchar *compare;
+ if (c != path_start) {
+ compare = g_strndup (path_start, c - path_start);
+ compare = g_strstrip (compare);
+ if (g_ascii_strcasecmp (compare, "inbox") == 0) {
+ n_inbox_parents++;
+ }
+ g_free (compare);
+ }
n_parents++;
+ path_start = c + 1;
}
}
gint i;
buffer = g_string_new ("");
- for (i = 0; i < n_parents; i++) {
+ for (i = 0; i < n_parents - n_inbox_parents; i++) {
buffer = g_string_append (buffer, MODEST_FOLDER_DOT);
}
buffer = g_string_append (buffer, last_separator);
if (item_name && item_weight) {
/* Set the name in the treeview cell: */
- if (priv->cell_style == MODEST_FOLDER_VIEW_CELL_STYLE_COMPACT && item_weight == 800 && priv->active_color) {
+ if (priv->cell_style == MODEST_FOLDER_VIEW_CELL_STYLE_COMPACT && item_weight == 800 &&
+ (priv->active_color.red != 0 || priv->active_color.blue != 0 || priv->active_color.green != 0)) {
g_object_set (rendobj,
"text", item_name,
"weight-set", FALSE,
"foreground-set", TRUE,
- "foreground-gdk", priv->active_color,
+ "foreground-gdk", &(priv->active_color),
NULL);
} else {
g_object_set (rendobj,
drafts = FALSE;
}
- if (priv->cell_style == MODEST_FOLDER_VIEW_CELL_STYLE_COMPACT) {
- if (number > 1) {
- item_name = g_strdup_printf (drafts?_("mcen_ti_messages"):_("mcen_va_new_messages"),
- number);
- } else if (number == 1) {
- item_name = g_strdup_printf (drafts?_("mcen_ti_message"):_("mcen_va_new_message"),
- number);
- }
- }
-
- }
+ if ((priv->cell_style == MODEST_FOLDER_VIEW_CELL_STYLE_COMPACT) && (number > 0)) {
+ item_name =
+ g_strdup_printf (ngettext ((drafts) ? "mcen_ti_message" : "mcen_va_new_message",
+ (drafts) ? "mcen_ti_messages" : "mcen_va_new_messages",
+ number), number);
+ }
+ }
if (!item_name)
item_name = g_strdup ("");
{
ThreePixbufs *retval;
- if (!*pixbuf)
- *pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (icon_code, FOLDER_ICON_SIZE));
+ if (!*pixbuf) {
+ GdkPixbuf *icon;
+ icon = modest_platform_get_icon (icon_code, FOLDER_ICON_SIZE);
+ if (icon) {
+ *pixbuf = gdk_pixbuf_copy (icon);
+ } else {
+ *pixbuf = NULL;
+ }
+ }
- if (!*pixbuf_open)
+ if (!*pixbuf_open && pixbuf && *pixbuf)
*pixbuf_open = get_composite_pixbuf ("qgn_list_gene_fldr_exp",
FOLDER_ICON_SIZE,
*pixbuf);
- if (!*pixbuf_close)
+ if (!*pixbuf_close && pixbuf && *pixbuf)
*pixbuf_close = get_composite_pixbuf ("qgn_list_gene_fldr_clp",
FOLDER_ICON_SIZE,
*pixbuf);
type != TNY_FOLDER_TYPE_INBOX &&
modest_tny_folder_store_is_remote (TNY_FOLDER_STORE (instance))) {
#ifdef MODEST_TOOLKIT_HILDON2
- return get_composite_icons (MODEST_FOLDER_ICON_ACCOUNT,
+ return get_composite_icons (MODEST_FOLDER_ICON_REMOTE_FOLDER,
&anorm_pixbuf,
&anorm_pixbuf_open,
&anorm_pixbuf_close);
priv->messages_renderer = gtk_cell_renderer_text_new ();
g_object_set (priv->messages_renderer,
#ifdef MODEST_TOOLKIT_HILDON2
- "yalign", 0.0,
+ "yalign", 0.5,
"ypad", MODEST_MARGIN_DEFAULT,
"xpad", MODEST_MARGIN_DOUBLE,
#else
G_CALLBACK(on_configuration_key_changed),
obj);
- priv->active_color = NULL;
+ gdk_color_parse ("000", &priv->active_color);
update_style (obj);
priv->signal_handlers = modest_signal_mgr_connect (priv->signal_handlers,
priv = MODEST_FOLDER_VIEW_GET_PRIVATE(obj);
- if (priv->active_color) {
- gdk_color_free (priv->active_color);
- priv->active_color = NULL;
- }
-
if (priv->timer_expander != 0) {
g_source_remove (priv->timer_expander);
priv->timer_expander = 0;
/* Clear hidding array created by cut operation */
_clear_hidding_filter (MODEST_FOLDER_VIEW (obj));
+ gdk_color_parse ("000", &priv->active_color);
+
G_OBJECT_CLASS(parent_class)->finalize (obj);
}
#ifdef MODEST_TOOLKIT_HILDON2
TnyGtkFolderListStoreFlags flags;
flags = TNY_GTK_FOLDER_LIST_STORE_FLAG_SHOW_PATH;
- if (!priv->do_refresh)
- flags &= TNY_GTK_FOLDER_LIST_STORE_FLAG_NO_REFRESH;
+ if (priv->do_refresh)
+ flags |= TNY_GTK_FOLDER_LIST_STORE_FLAG_DELAYED_REFRESH;
+ else
+ flags |= TNY_GTK_FOLDER_LIST_STORE_FLAG_NO_REFRESH;
model = tny_gtk_folder_list_store_new_with_flags (NULL,
flags);
tny_gtk_folder_list_store_set_path_separator (TNY_GTK_FOLDER_LIST_STORE (model),
return is_account2 - is_account1;
}
+static gint
+compare_folders (const gchar *name1, const gchar *name2)
+{
+ const gchar *separator1, *separator2;
+ const gchar *next1, *next2;
+ gchar *top1, *top2;
+ gint cmp;
+
+ if (name1 == NULL || name1[0] == '\0')
+ return -1;
+ if (name2 == NULL || name2[0] == '\0')
+ return 1;
+
+ separator1 = strstr (name1, MODEST_FOLDER_PATH_SEPARATOR);
+ if (separator1) {
+ top1 = g_strndup (name1, separator1 - name1);
+ } else {
+ top1 = g_strdup (name1);
+ }
+
+ separator2 = strstr (name2, MODEST_FOLDER_PATH_SEPARATOR);
+ if (separator2) {
+ top2 = g_strndup (name2, separator2 - name2);
+ } else {
+ top2 = g_strdup (name2);
+ }
+
+
+ cmp = modest_text_utils_utf8_strcmp (top1, top2, TRUE);
+ g_free (top1);
+ g_free (top2);
+
+ if (cmp != 0)
+ return cmp;
+
+ if (separator1 == NULL && separator2 == NULL)
+ return 0;
+
+ next1 = (separator1 != NULL)?separator1 + strlen (MODEST_FOLDER_PATH_SEPARATOR):NULL;
+ next2 = (separator2 != NULL)?separator2 + strlen (MODEST_FOLDER_PATH_SEPARATOR):NULL;
+
+ return compare_folders (next1, next2);
+}
+
+
/*
* This function orders the mail accounts according to these rules:
* 1st - remote accounts
}
/* Pure sort by name */
- cmp = modest_text_utils_utf8_strcmp (name1, name2, TRUE);
+ cmp = compare_folders (name1, name2);
finish:
if (folder1)
g_object_unref(G_OBJECT(folder1));
NULL);
pango_attr_list_unref (attr_list);
}
- if (priv->active_color)
- gdk_color_free (priv->active_color);
if (gtk_style_lookup_color (GTK_WIDGET (self)->style, "ActiveTextColor", &style_active_color)) {
- priv->active_color = gdk_color_copy (&style_active_color);
+ priv->active_color = style_active_color;
+ } else {
+ gdk_color_parse ("000", &(priv->active_color));
}
}