diff options
-rw-r--r-- | mail/ChangeLog | 15 | ||||
-rw-r--r-- | mail/mail-local.c | 35 | ||||
-rw-r--r-- | mail/mail-tools.c | 40 | ||||
-rw-r--r-- | mail/mail-tools.h | 8 |
4 files changed, 32 insertions, 66 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 076c6117cc..c78a2251eb 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,18 @@ +2001-10-01 Dan Winship <danw@ximian.com> + + * mail-local.c (mail_local_reconfigure_folder): Don't use + mail_tool_get_folder_name here since that function only existed to + be clever in a certain case that this is not. + (reconfigure_folder_free): Remove the dialog from the hash table + here so that it gets removed in the successfully-reconfigured case + too. Don't unref folder_out if it never got set. + (reconfigure_clicked): Remove the hash table code from here; it's + in reconfigure_folder_free now. + + * mail-tools.c (mail_tool_get_folder_name): No longer used by + anything. + (mail_tool_get_folder_from_urlname): Also not used anywhere. + 2001-10-01 Jeffrey Stedfast <fejj@ximian.com> * mail-tools.c (mail_tool_uri_to_folder): Don't pass the CREATE diff --git a/mail/mail-local.c b/mail/mail-local.c index 5fbb457543..32a2ad6c60 100644 --- a/mail/mail-local.c +++ b/mail/mail-local.c @@ -1063,6 +1063,9 @@ struct _reconfigure_msg { CamelFolder *folder_out; }; +/* hash table of folders that the user has a reconfig-folder dialog for */ +static GHashTable *reconfigure_folder_hash = NULL; + static char * reconfigure_folder_describe (struct _mail_msg *mm, int done) { @@ -1117,7 +1120,16 @@ reconfigure_folder_free (struct _mail_msg *mm) { struct _reconfigure_msg *m = (struct _reconfigure_msg *)mm; - camel_object_unref (CAMEL_OBJECT (m->folder_out)); + /* remove this folder from our hash since we are done with it */ + g_hash_table_remove (reconfigure_folder_hash, m->fb->folder); + if (g_hash_table_size (reconfigure_folder_hash) == 0) { + /* additional cleanup */ + g_hash_table_destroy (reconfigure_folder_hash); + reconfigure_folder_hash = NULL; + } + + if (m->folder_out) + camel_object_unref (CAMEL_OBJECT (m->folder_out)); gtk_object_unref (GTK_OBJECT (m->fb)); g_free (m->newtype); } @@ -1129,9 +1141,6 @@ static struct _mail_msg_op reconfigure_folder_op = { reconfigure_folder_free, }; -/* hash table of folders that the user has a reconfig-folder dialog for */ -static GHashTable *reconfigure_folder_hash = NULL; - static void reconfigure_clicked (GnomeDialog *dialog, int button, struct _reconfigure_msg *m) { @@ -1155,17 +1164,8 @@ reconfigure_clicked (GnomeDialog *dialog, int button, struct _reconfigure_msg *m } else mail_msg_free ((struct _mail_msg *)m); - if (button != -1) { - /* remove this folder from our hash since we are done with it */ - g_hash_table_remove (reconfigure_folder_hash, m->fb->folder); - if (g_hash_table_size (reconfigure_folder_hash) == 0) { - /* additional cleanup */ - g_hash_table_destroy (reconfigure_folder_hash); - reconfigure_folder_hash = NULL; - } - + if (button != -1) gnome_dialog_close (dialog); - } } void @@ -1174,7 +1174,7 @@ mail_local_reconfigure_folder (FolderBrowser *fb) GladeXML *gui; GnomeDialog *gd; struct _reconfigure_msg *m; - char *name, *title; + char *title; GList *p; GtkWidget *menu; char *currentformat; @@ -1205,11 +1205,10 @@ mail_local_reconfigure_folder (FolderBrowser *fb) gui = glade_xml_new (EVOLUTION_GLADEDIR "/local-config.glade", "dialog_format"); gd = (GnomeDialog *)glade_xml_get_widget (gui, "dialog_format"); - name = mail_tool_get_folder_name (fb->folder); - title = g_strdup_printf (_("Reconfigure %s"), name); + title = g_strdup_printf (_("Reconfigure /%s"), + camel_folder_get_full_name (fb->folder)); gtk_window_set_title (GTK_WINDOW (gd), title); g_free (title); - g_free (name); m->frame = glade_xml_get_widget (gui, "frame_format"); m->apply = glade_xml_get_widget (gui, "apply_format"); diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 89c9fb4bfc..83b787019d 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -48,46 +48,6 @@ /* **************************************** */ -CamelFolder * -mail_tool_get_folder_from_urlname (const gchar *url, const gchar *name, - guint32 flags, CamelException *ex) -{ - CamelStore *store; - CamelFolder *folder; - - store = camel_session_get_store (session, url, ex); - if (!store) - return NULL; - - folder = camel_store_get_folder (store, name, flags, ex); - camel_object_unref (CAMEL_OBJECT (store)); - - return folder; -} - -char * -mail_tool_get_folder_name (CamelFolder *folder) -{ - const char *name = camel_folder_get_full_name (folder); - char *path, *pend; - - /* This is a kludge. */ - if (strcmp (name, "mbox") && strcmp (name, "mh") && strcmp (name, "maildir")) - return g_strdup (name); - - /* For mbox/mh, return the parent store's final path component. */ - path = g_strdup (CAMEL_SERVICE (folder->parent_store)->url->path); - pend = path + strlen (path) - 1; - if (*pend == '/') - *pend = '\0'; - - pend = path; - path = g_strdup (g_basename (path)); - g_free (pend); - - return path; -} - gchar * mail_tool_get_local_movemail_path (void) { diff --git a/mail/mail-tools.h b/mail/mail-tools.h index b44086352b..7d795cafa5 100644 --- a/mail/mail-tools.h +++ b/mail/mail-tools.h @@ -37,14 +37,6 @@ typedef struct _xevolution { char *format; } XEvolution; -/* Get a CamelFolder from a root url and a foldername (uses the global session)*/ -CamelFolder * -mail_tool_get_folder_from_urlname (const gchar *url, const gchar *name, - guint32 flags, CamelException *ex); - -/* Get a useful name for a given CamelFolder (ie, not "mbox") */ -char *mail_tool_get_folder_name (CamelFolder *folder); - /* Get the filename for our movemail folder or storage */ gchar *mail_tool_get_local_movemail_path (void); |