gchar *fname = NULL;
const gchar *account_id = NULL;
gint unread = 0;
+ gboolean has_children;
rendobj = G_OBJECT(renderer);
gtk_tree_model_get (tree_model, iter,
TNY_GTK_FOLDER_STORE_TREE_MODEL_UNREAD_COLUMN, &unread,
TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &instance,
-1);
+ has_children = gtk_tree_model_iter_has_child (tree_model, iter);
if (!fname)
return;
return;
}
+ /* MERGE is not needed anymore as the folder now has the correct type jschmid */
/* We include the MERGE type here because it's used to create
the local OUTBOX folder */
if (type == TNY_FOLDER_TYPE_NORMAL ||
- type == TNY_FOLDER_TYPE_UNKNOWN ||
- type == TNY_FOLDER_TYPE_MERGE) {
+ type == TNY_FOLDER_TYPE_UNKNOWN) {
type = modest_tny_folder_guess_folder_type (TNY_FOLDER (instance));
}
/* Set pixbuf */
g_object_set (rendobj, "pixbuf", pixbuf, NULL);
+ if (has_children && (pixbuf != NULL)) {
+ GdkPixbuf *open_pixbuf, *closed_pixbuf;
+ GdkPixbuf *open_emblem, *closed_emblem;
+ open_pixbuf = gdk_pixbuf_copy (pixbuf);
+ closed_pixbuf = gdk_pixbuf_copy (pixbuf);
+ open_emblem = modest_platform_get_icon ("qgn_list_gene_fldr_exp");
+ closed_emblem = modest_platform_get_icon ("qgn_list_gene_fldr_clp");
+
+ if (open_emblem) {
+ gdk_pixbuf_composite (open_emblem, open_pixbuf, 0, 0,
+ MIN (gdk_pixbuf_get_width (open_emblem),
+ gdk_pixbuf_get_width (open_pixbuf)),
+ MIN (gdk_pixbuf_get_height (open_emblem),
+ gdk_pixbuf_get_height (open_pixbuf)),
+ 0, 0, 1, 1, GDK_INTERP_NEAREST, 255);
+ g_object_set (rendobj, "pixbuf-expander-open", open_pixbuf, NULL);
+ g_object_unref (open_emblem);
+ }
+ if (closed_emblem) {
+ gdk_pixbuf_composite (closed_emblem, closed_pixbuf, 0, 0,
+ MIN (gdk_pixbuf_get_width (closed_emblem),
+ gdk_pixbuf_get_width (closed_pixbuf)),
+ MIN (gdk_pixbuf_get_height (closed_emblem),
+ gdk_pixbuf_get_height (closed_pixbuf)),
+ 0, 0, 1, 1, GDK_INTERP_NEAREST, 255);
+ g_object_set (rendobj, "pixbuf-expander-closed", closed_pixbuf, NULL);
+ g_object_unref (closed_emblem);
+ }
+ if (closed_pixbuf)
+ g_object_unref (closed_pixbuf);
+ if (open_pixbuf)
+ g_object_unref (open_pixbuf);
+ }
if (pixbuf != NULL)
g_object_unref (pixbuf);
/* Current folder was unselected */
if (priv->cur_folder_store) {
if (TNY_IS_FOLDER(priv->cur_folder_store))
- tny_folder_sync (TNY_FOLDER(priv->cur_folder_store), FALSE, NULL);
+ tny_folder_sync_async (TNY_FOLDER(priv->cur_folder_store), FALSE, NULL, NULL, NULL);
/* FALSE --> don't expunge the messages */
g_signal_emit (G_OBJECT(tree_view), signals[FOLDER_SELECTION_CHANGED_SIGNAL], 0,
static gint
get_cmp_subfolder_type_pos (TnyFolderType t)
{
- /* Outbox, Drafts, Sent, User */
- /* 0, 1, 2, 3 */
+ /* Inbox, Outbox, Drafts, Sent, User */
+ /* 0, 1, 2, 3, 4 */
switch (t) {
- case TNY_FOLDER_TYPE_OUTBOX:
+ case TNY_FOLDER_TYPE_INBOX:
return 0;
break;
- case TNY_FOLDER_TYPE_DRAFTS:
+ case TNY_FOLDER_TYPE_OUTBOX:
return 1;
break;
- case TNY_FOLDER_TYPE_SENT:
+ case TNY_FOLDER_TYPE_DRAFTS:
return 2;
break;
- default:
+ case TNY_FOLDER_TYPE_SENT:
return 3;
+ break;
+ default:
+ return 4;
}
}
cmp = modest_text_utils_utf8_strcmp (name1, name2, TRUE);
}
} else {
- GtkTreeIter parent;
- gboolean has_parent;
gint cmp1 = 0, cmp2 = 0;
/* get the parent to know if it's a local folder */
+
+ GtkTreeIter parent;
+ gboolean has_parent;
has_parent = gtk_tree_model_iter_parent (tree_model, &parent, iter1);
if (has_parent) {
GObject *parent_folder;
}
g_object_unref (parent_folder);
}
+
+ /* if they are not local folders */
+ if (cmp1 == cmp2) {
+ cmp1 = get_cmp_subfolder_type_pos (tny_folder_get_folder_type (TNY_FOLDER (folder1)));
+ cmp2 = get_cmp_subfolder_type_pos (tny_folder_get_folder_type (TNY_FOLDER (folder2)));
+ }
+
if (cmp1 == cmp2)
cmp = modest_text_utils_utf8_strcmp (name1, name2, TRUE);
else
GtkSelectionData *selection_data,
DndHelper *helper)
{
- ModestMailOperation *mail_op;
+ ModestMailOperation *mail_op = NULL;
GtkTreeIter parent_iter, iter;
- TnyFolderStore *parent_folder;
- TnyFolder *folder;
+ TnyFolderStore *parent_folder = NULL;
+ TnyFolder *folder = NULL;
/* Check if the drag is possible */
/* if (!gtk_tree_path_compare (helper->source_row, dest_row) || */
TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN,
&folder, -1);
- /* Do the mail operation */
- mail_op = modest_mail_operation_new_with_error_handling (MODEST_MAIL_OPERATION_TYPE_RECEIVE,
+ /* Offer the connection dialog if necessary, for the destination parent folder and source folder: */
+ if (modest_platform_connect_and_wait_if_network_folderstore (NULL, parent_folder) &&
+ modest_platform_connect_and_wait_if_network_folderstore (NULL, TNY_FOLDER_STORE (folder))) {
+ /* Do the mail operation */
+ mail_op = modest_mail_operation_new_with_error_handling (MODEST_MAIL_OPERATION_TYPE_RECEIVE,
NULL,
modest_ui_actions_move_folder_error_handler,
NULL);
- modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
+ modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
mail_op);
- g_signal_connect (G_OBJECT (mail_op), "progress-changed",
- G_CALLBACK (on_progress_changed), helper);
+ g_signal_connect (G_OBJECT (mail_op), "progress-changed",
+ G_CALLBACK (on_progress_changed), helper);
- modest_mail_operation_xfer_folder (mail_op,
+ modest_mail_operation_xfer_folder (mail_op,
folder,
parent_folder,
helper->delete_source,
NULL,
NULL);
+ }
/* Frees */
g_object_unref (G_OBJECT (parent_folder));