X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmodest-tny-folder.c;h=d4e4a19aed6e601b13c59ea4384c354995b66fc3;hb=fd5b6103aab069d4b12e04a5e3205f13a4f91042;hp=daef301c584721b3eb335e7180e0afeb16a756aa;hpb=08ba7e3f4d74446dd19e8562e881d4fe4257722c;p=modest diff --git a/src/modest-tny-folder.c b/src/modest-tny-folder.c index daef301..d4e4a19 100644 --- a/src/modest-tny-folder.c +++ b/src/modest-tny-folder.c @@ -127,8 +127,8 @@ modest_tny_folder_get_rules (TnyFolder *folder) switch (type) { case TNY_FOLDER_TYPE_OUTBOX: case TNY_FOLDER_TYPE_SENT: - rules |= MODEST_FOLDER_RULES_FOLDER_NON_WRITEABLE; case TNY_FOLDER_TYPE_DRAFTS: + rules |= MODEST_FOLDER_RULES_FOLDER_NON_WRITEABLE; case TNY_FOLDER_TYPE_INBOX: case TNY_FOLDER_TYPE_JUNK: case TNY_FOLDER_TYPE_TRASH: @@ -147,8 +147,10 @@ modest_tny_folder_get_rules (TnyFolder *folder) } } else { ModestTransportStoreProtocol proto; - TnyAccount *account = - modest_tny_folder_get_account ((TnyFolder*)folder); + TnyFolderType folder_type; + TnyAccount *account; + + account = modest_tny_folder_get_account ((TnyFolder*)folder); if (!account) return -1; /* no account: nothing is allowed */ @@ -166,6 +168,15 @@ modest_tny_folder_get_rules (TnyFolder *folder) } g_object_unref (G_OBJECT(account)); + + /* Neither INBOX not ROOT folders should me moveable */ + folder_type = modest_tny_folder_guess_folder_type (folder); + if ((folder_type == TNY_FOLDER_TYPE_INBOX) || + (folder_type == TNY_FOLDER_TYPE_ROOT)) { + rules |= MODEST_FOLDER_RULES_FOLDER_NON_DELETABLE; + rules |= MODEST_FOLDER_RULES_FOLDER_NON_MOVEABLE; + rules |= MODEST_FOLDER_RULES_FOLDER_NON_RENAMEABLE; + } } return rules; } @@ -191,16 +202,17 @@ modest_tny_folder_is_local_folder (TnyFolder *folder) /* Outbox is a special case, using a derived TnyAccount: */ if (MODEST_IS_TNY_OUTBOX_ACCOUNT (account)) { - g_object_unref (account); - return TRUE; + g_object_unref (G_OBJECT(account)); + return TRUE; } const gchar* account_id = tny_account_get_id (account); - if (!account_id) + if (!account_id) { + g_object_unref (G_OBJECT(account)); return FALSE; - - g_object_unref (G_OBJECT(account)); + } + g_object_unref (G_OBJECT(account)); return (strcmp (account_id, MODEST_LOCAL_FOLDERS_ACCOUNT_ID) == 0); }