aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2005-02-01 15:41:49 +0800
committerMichael Zucci <zucchi@src.gnome.org>2005-02-01 15:41:49 +0800
commit347a9a04cf4c1fbacdb7c44f872e9d67bc0801b0 (patch)
treeef0bce083dd39108268abb3469ceec1c12dc410b
parent55b25cdd13d43105fe4cca4e27e1de9e51fd49ef (diff)
downloadgsoc2013-evolution-347a9a04cf4c1fbacdb7c44f872e9d67bc0801b0.tar.gz
gsoc2013-evolution-347a9a04cf4c1fbacdb7c44f872e9d67bc0801b0.tar.zst
gsoc2013-evolution-347a9a04cf4c1fbacdb7c44f872e9d67bc0801b0.zip
use the type hint to sort for inbox, not the name.
2005-02-01 Not Zed <NotZed@Ximian.com> * em-folder-tree-model.c (sort_cb): use the type hint to sort for inbox, not the name. (emft_is_special_local_folder): removed. (em_folder_tree_model_set_folder_info): special-case the local-store case, handle translated names and the name hints. * em-folder-tree.c (render_pixbuf): use the camel folderinfo folder type to determine the icon, don't hardcode based on name. ** See bug #71310 * em-composer-prefs.c (sig_add_script_response): force a save of the signatures as soon as they change. Also save the script name if we were just editing it, not just the signature name. svn path=/trunk/; revision=28653
-rw-r--r--mail/ChangeLog15
-rw-r--r--mail/em-composer-prefs.c4
-rw-r--r--mail/em-folder-tree-model.c42
-rw-r--r--mail/em-folder-tree.c35
4 files changed, 62 insertions, 34 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 232ac1dfa1..a1232ab1ea 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,20 @@
2005-02-01 Not Zed <NotZed@Ximian.com>
+ * em-folder-tree-model.c (sort_cb): use the type hint to sort for
+ inbox, not the name.
+ (emft_is_special_local_folder): removed.
+ (em_folder_tree_model_set_folder_info): special-case the
+ local-store case, handle translated names and the name hints.
+
+ * em-folder-tree.c (render_pixbuf): use the camel folderinfo
+ folder type to determine the icon, don't hardcode based on name.
+
+ ** See bug #71310
+
+ * em-composer-prefs.c (sig_add_script_response): force a save of
+ the signatures as soon as they change. Also save the script name
+ if we were just editing it, not just the signature name.
+
** See bug #71312.
* em-folder-view.c (em_folder_view_open_selected): if we're
diff --git a/mail/em-composer-prefs.c b/mail/em-composer-prefs.c
index 33f0908a1c..7a3cd88beb 100644
--- a/mail/em-composer-prefs.c
+++ b/mail/em-composer-prefs.c
@@ -390,6 +390,8 @@ sig_add_script_response (GtkWidget *widget, int button, EMComposerPrefs *prefs)
/* we're just editing an existing signature script */
g_free (sig->name);
sig->name = g_strdup (name);
+ g_free(sig->filename);
+ sig->filename = g_strdup(script);
e_signature_list_change (mail_config_get_signatures (), sig);
} else {
sig = mail_config_signature_new (script, TRUE, TRUE);
@@ -399,6 +401,8 @@ sig_add_script_response (GtkWidget *widget, int button, EMComposerPrefs *prefs)
g_object_unref (sig);
}
+ mail_config_save_signatures();
+
gtk_widget_hide (prefs->sig_script_dialog);
g_strfreev (argv);
g_free (script);
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index da31fd4c12..446d2fbde5 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -184,12 +184,13 @@ sort_cb (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data
char *aname, *bname;
CamelStore *store;
gboolean is_store;
+ guint32 aflags, bflags;
int rv = -2;
gtk_tree_model_get (model, a, COL_BOOL_IS_STORE, &is_store,
COL_POINTER_CAMEL_STORE, &store,
- COL_STRING_DISPLAY_NAME, &aname, -1);
- gtk_tree_model_get (model, b, COL_STRING_DISPLAY_NAME, &bname, -1);
+ COL_STRING_DISPLAY_NAME, &aname, COL_UINT_FLAGS, &aflags, -1);
+ gtk_tree_model_get (model, b, COL_STRING_DISPLAY_NAME, &bname, COL_UINT_FLAGS, &bflags, -1);
if (is_store) {
/* On This Computer is always first and VFolders is always last */
@@ -209,9 +210,9 @@ sort_cb (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data
rv = -1;
} else {
/* Inbox is always first */
- if (aname && (!strcmp (aname, "INBOX") || !strcmp (aname, _("Inbox"))))
+ if ((aflags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_INBOX)
rv = -1;
- else if (bname && (!strcmp (bname, "INBOX") || !strcmp (bname, _("Inbox"))))
+ else if ((bflags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_INBOX)
rv = 1;
}
@@ -414,16 +415,6 @@ account_removed (EAccountList *accounts, EAccount *account, gpointer user_data)
em_folder_tree_model_remove_store (model, si->store);
}
-/* NB: more-or-less copied from em-folder-tree.c */
-static gboolean
-emft_is_special_local_folder(CamelStore *store, const char *name)
-{
- /* Bit of a hack to translate local mailbox names */
- return store == mail_component_peek_local_store(NULL)
- && (!strcmp (name, "Drafts") || !strcmp (name, "Inbox")
- || !strcmp (name, "Outbox") || !strcmp (name, "Sent"));
-}
-
void
em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *iter,
struct _EMFolderTreeModelStoreInfo *si,
@@ -437,6 +428,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite
struct _CamelFolder *folder;
gboolean emitted = FALSE;
const char *name;
+ guint32 flags;
if (!fully_loaded)
load = fi->child == NULL && !(fi->flags & (CAMEL_FOLDER_NOCHILDREN | CAMEL_FOLDER_NOINFERIORS));
@@ -468,10 +460,22 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite
camel_object_unref(folder);
}
- if (emft_is_special_local_folder(si->store, fi->full_name))
- name = _(fi->name);
- else
- name = fi->name;
+ /* TODO: maybe this should be handled by mail_get_folderinfo (except em-folder-tree doesn't use it, duh) */
+ flags = fi->flags;
+ name = fi->name;
+ if (si->store == mail_component_peek_local_store(NULL)) {
+ if (!strcmp(fi->full_name, "Drafts")) {
+ name = _("Drafts");
+ } else if (!strcmp(fi->full_name, "Inbox")) {
+ flags = (flags & ~CAMEL_FOLDER_TYPE_MASK) | CAMEL_FOLDER_TYPE_INBOX;
+ name = _("Inbox");
+ } else if (!strcmp(fi->full_name, "Outbox")) {
+ flags = (flags & ~CAMEL_FOLDER_TYPE_MASK) | CAMEL_FOLDER_TYPE_OUTBOX;
+ name = _("Outbox");
+ } else if (!strcmp(fi->full_name, "Sent")) {
+ name = _("Sent");
+ }
+ }
gtk_tree_store_set ((GtkTreeStore *) model, iter,
COL_STRING_DISPLAY_NAME, name,
@@ -479,7 +483,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite
COL_STRING_FULL_NAME, fi->full_name,
COL_STRING_URI, fi->uri,
COL_UINT_UNREAD, unread,
- COL_UINT_FLAGS, fi->flags,
+ COL_UINT_FLAGS, flags,
COL_BOOL_IS_STORE, FALSE,
COL_BOOL_LOAD_SUBDIRS, load,
-1);
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index d8741e0c71..ad88721c5b 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -279,7 +279,6 @@ render_pixbuf (GtkTreeViewColumn *column, GtkCellRenderer *renderer,
GdkPixbuf *pixbuf = NULL;
gboolean is_store;
guint32 flags;
- char *full_name;
if (!initialised) {
folder_icons[FOLDER_ICON_NORMAL] = e_icon_factory_get_icon ("stock_folder", E_ICON_SIZE_MENU);
@@ -292,27 +291,33 @@ render_pixbuf (GtkTreeViewColumn *column, GtkCellRenderer *renderer,
initialised = TRUE;
}
- gtk_tree_model_get (model, iter, COL_STRING_FULL_NAME, &full_name,
- COL_BOOL_IS_STORE, &is_store, COL_UINT_FLAGS, &flags, -1);
- if (!is_store && full_name != NULL) {
- if (!g_ascii_strcasecmp (full_name, "Inbox"))
+ gtk_tree_model_get (model, iter, COL_BOOL_IS_STORE, &is_store, COL_UINT_FLAGS, &flags, -1);
+
+ if (!is_store) {
+ switch((flags & CAMEL_FOLDER_TYPE_MASK)) {
+ case CAMEL_FOLDER_TYPE_INBOX:
pixbuf = folder_icons[FOLDER_ICON_INBOX];
- else if (!g_ascii_strcasecmp (full_name, "Outbox"))
+ break;
+ case CAMEL_FOLDER_TYPE_OUTBOX:
pixbuf = folder_icons[FOLDER_ICON_OUTBOX];
- else if (!strcmp (full_name, CAMEL_VTRASH_NAME))
+ break;
+ case CAMEL_FOLDER_TYPE_TRASH:
pixbuf = folder_icons[FOLDER_ICON_TRASH];
- else if (!strcmp (full_name, CAMEL_VJUNK_NAME))
+ break;
+ case CAMEL_FOLDER_TYPE_JUNK:
pixbuf = folder_icons[FOLDER_ICON_JUNK];
- else if (flags & CAMEL_FOLDER_SHARED_TO_ME)
- pixbuf = folder_icons[FOLDER_ICON_SHARED_TO_ME];
- else if (flags & CAMEL_FOLDER_SHARED_BY_ME)
- pixbuf = folder_icons[FOLDER_ICON_SHARED_BY_ME];
- else
- pixbuf = folder_icons[FOLDER_ICON_NORMAL];
+ break;
+ default:
+ if (flags & CAMEL_FOLDER_SHARED_TO_ME)
+ pixbuf = folder_icons[FOLDER_ICON_SHARED_TO_ME];
+ else if (flags & CAMEL_FOLDER_SHARED_BY_ME)
+ pixbuf = folder_icons[FOLDER_ICON_SHARED_BY_ME];
+ else
+ pixbuf = folder_icons[FOLDER_ICON_NORMAL];
+ }
}
g_object_set (renderer, "pixbuf", pixbuf, "visible", !is_store, NULL);
- g_free (full_name);
}
static void