aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-08-11 22:41:04 +0800
committerDan Winship <danw@src.gnome.org>2000-08-11 22:41:04 +0800
commitf0cbd6a20b8764be5524e5e4c666d33b22028b12 (patch)
treee1b5a1f3e15bd56b6bbdc035d0f89e39aa3343df
parent5d33edf6a752557ddfb586ef153b3b5395f4c400 (diff)
downloadgsoc2013-evolution-f0cbd6a20b8764be5524e5e4c666d33b22028b12.tar.gz
gsoc2013-evolution-f0cbd6a20b8764be5524e5e4c666d33b22028b12.tar.zst
gsoc2013-evolution-f0cbd6a20b8764be5524e5e4c666d33b22028b12.zip
Add a function to return a useful name for a folder (not just "mbox" or
* mail-tools.c (mail_tool_get_folder_name): Add a function to return a useful name for a folder (not just "mbox" or "mh" for any local folder.) * mail-ops.c: Use mail_tool_get_folder_name rather than folder->full_name when printing folder names. svn path=/trunk/; revision=4733
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/mail-ops.c28
-rw-r--r--mail/mail-tools.c19
-rw-r--r--mail/mail-tools.h3
4 files changed, 45 insertions, 14 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 20159c30ba..ee34afea22 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,12 @@
+2000-08-11 Dan Winship <danw@helixcode.com>
+
+ * mail-tools.c (mail_tool_get_folder_name): Add a function to
+ return a useful name for a folder (not just "mbox" or "mh" for
+ any local folder.)
+
+ * mail-ops.c: Use mail_tool_get_folder_name rather than
+ folder->full_name when printing folder names.
+
2000-08-11 Not Zed <NotZed@HelixCode.com>
* mail-tools.c (mail_tool_get_local_inbox_url): Properly handle
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 8ba2d9ee31..066ac09b60 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -391,9 +391,9 @@ describe_expunge_folder (gpointer in_data, gboolean gerund)
CamelFolder *f = CAMEL_FOLDER (in_data);
if (gerund)
- return g_strdup_printf ("Expunging \"%s\"", f->full_name);
+ return g_strdup_printf ("Expunging \"%s\"", mail_tool_get_folder_name (f));
else
- return g_strdup_printf ("Expunge \"%s\"", f->full_name);
+ return g_strdup_printf ("Expunge \"%s\"", mail_tool_get_folder_name (f));
}
static void
@@ -464,12 +464,12 @@ describe_refile_messages (gpointer in_data, gboolean gerund)
return
g_strdup_printf
("Moving messages from \"%s\" into \"%s\"",
- input->source->full_name, input->dest_uri);
+ mail_tool_get_folder_name (input->source), input->dest_uri);
else
return
g_strdup_printf
("Move messages from \"%s\" into \"%s\"",
- input->source->full_name, input->dest_uri);
+ mail_tool_get_folder_name (input->source), input->dest_uri);
}
static void
@@ -586,10 +586,10 @@ describe_flag_messages (gpointer in_data, gboolean gerund)
if (gerund)
return g_strdup_printf ("Marking messages in folder \"%s\"",
- input->source->full_name);
+ mail_tool_get_folder_name (input->source));
else
return g_strdup_printf ("Mark messages in folder \"%s\"",
- input->source->full_name);
+ mail_tool_get_folder_name (input->source));
}
static void
@@ -870,10 +870,10 @@ describe_attach_message (gpointer in_data, gboolean gerund)
return
g_strdup_printf
("Attaching messages from folder \"%s\"",
- input->folder->full_name);
+ mail_tool_get_folder_name (input->folder));
else
return g_strdup_printf ("Attach messages from \"%s\"",
- input->folder->full_name);
+ mail_tool_get_folder_name (input->folder));
}
static void
@@ -1411,9 +1411,9 @@ describe_sync_folder (gpointer in_data, gboolean gerund)
CamelFolder *f = CAMEL_FOLDER (in_data);
if (gerund) {
- return g_strdup_printf ("Synchronizing \"%s\"", f->full_name);
+ return g_strdup_printf ("Synchronizing \"%s\"", mail_tool_get_folder_name (f));
} else {
- return g_strdup_printf ("Synchronize \"%s\"", f->full_name);
+ return g_strdup_printf ("Synchronize \"%s\"", mail_tool_get_folder_name (f));
}
}
@@ -1616,10 +1616,10 @@ describe_edit_messages (gpointer in_data, gboolean gerund)
if (gerund)
return g_strdup_printf
("Opening messages from folder \"%s\"",
- input->folder->full_name);
+ mail_tool_get_folder_name (input->folder));
else
return g_strdup_printf ("Open messages from \"%s\"",
- input->folder->full_name);
+ mail_tool_get_folder_name (input->folder));
}
static void
@@ -1800,10 +1800,10 @@ describe_view_messages (gpointer in_data, gboolean gerund)
if (gerund)
return g_strdup_printf
("Viewing messages from folder \"%s\"",
- input->folder->full_name);
+ mail_tool_get_folder_name (input->folder));
else
return g_strdup_printf ("View messages from \"%s\"",
- input->folder->full_name);
+ mail_tool_get_folder_name (input->folder));
}
static void
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index dba9a60d3c..aa768c6def 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -117,6 +117,25 @@ mail_tool_get_folder_from_urlname (const gchar *url, const gchar *name,
return folder;
}
+const gchar *
+mail_tool_get_folder_name (CamelFolder *folder)
+{
+ const char *name = camel_folder_get_full_name (folder);
+ char *path;
+
+ /* This is a kludge. */
+
+ if (strcmp (name, "//mbox") && strcmp (name, "//mh"))
+ return name;
+
+ /* For mbox/mh, return the parent store's final path component. */
+ path = CAMEL_SERVICE (folder->parent_store)->url->path;
+ if (strchr (path, '/'))
+ return strrchr (path, '/') + 1;
+ else
+ return path;
+}
+
gchar *
mail_tool_get_local_inbox_url (void)
{
diff --git a/mail/mail-tools.h b/mail/mail-tools.h
index 9b6fab56c4..16215f38c9 100644
--- a/mail/mail-tools.h
+++ b/mail/mail-tools.h
@@ -36,6 +36,9 @@ CamelFolder *
mail_tool_get_folder_from_urlname (const gchar *url, const gchar *name,
gboolean create, CamelException *ex);
+/* Get a useful name for a given CamelFolder (ie, not "mbox") */
+const gchar *mail_tool_get_folder_name (CamelFolder *folder);
+
/* Get the url for the local inbox */
gchar *mail_tool_get_local_inbox_url (void);