diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2003-10-22 02:28:34 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2003-10-22 02:28:34 +0800 |
commit | 0fb08f3ff81575a4749d851404233f34252dd2f2 (patch) | |
tree | 7e03befedc3a76fd104921dbbc616810d87333be /mail/mail-vfolder.c | |
parent | 0e19f2c16de592607a341eb9974d31e4e47e02b5 (diff) | |
download | gsoc2013-evolution-0fb08f3ff81575a4749d851404233f34252dd2f2.tar.gz gsoc2013-evolution-0fb08f3ff81575a4749d851404233f34252dd2f2.tar.zst gsoc2013-evolution-0fb08f3ff81575a4749d851404233f34252dd2f2.zip |
Merge new-ui-branch to the trunk.
svn path=/trunk/; revision=22964
Diffstat (limited to 'mail/mail-vfolder.c')
-rw-r--r-- | mail/mail-vfolder.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 001a0ae57e..b27aea30f7 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -32,6 +32,8 @@ #include "evolution-storage.h" #include "evolution-shell-component.h" +#include "folder-browser.h" +#include "mail-component.h" #include "mail-vfolder.h" #include "mail-tools.h" #include "mail-autofilter.h" @@ -64,7 +66,6 @@ static GHashTable *vfolder_hash; extern EvolutionShellClient *global_shell_client; /* more globals ... */ -extern char *evolution_dir; extern CamelSession *session; static void rule_changed(FilterRule *rule, CamelFolder *folder); @@ -471,7 +472,8 @@ mail_vfolder_delete_uri(CamelStore *store, const char *uri) g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); gtk_widget_show (dialog); - user = g_strdup_printf ("%s/vfolders.xml", evolution_dir); + user = g_strdup_printf ("%s/vfolders.xml", + mail_component_peek_base_directory (mail_component_peek ())); rule_context_save ((RuleContext *) context, user); g_free (user); } @@ -526,7 +528,7 @@ mail_vfolder_rename_uri(CamelStore *store, const char *from, const char *to) char *user; d(printf("Vfolders updated from renamed folder\n")); - user = g_strdup_printf("%s/vfolders.xml", evolution_dir); + user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ())); rule_context_save((RuleContext *)context, user); g_free(user); } @@ -646,7 +648,10 @@ static void context_rule_removed(RuleContext *ctx, FilterRule *rule) /* TODO: remove from folder info cache? */ path = g_strdup_printf("/%s", rule->name); - evolution_storage_removed_folder(mail_lookup_storage(vfolder_store), path); + + /* EPFIXME This leaks, the original code was broken too. */ + e_storage_removed_folder (mail_component_lookup_storage (mail_component_peek (), vfolder_store), path); + g_free(path); LOCK(); @@ -697,7 +702,7 @@ store_folder_deleted(CamelObject *o, void *event_data, void *data) g_object_unref(rule); g_signal_connect(context, "rule_removed", G_CALLBACK(context_rule_removed), context); - user = g_strdup_printf("%s/vfolders.xml", evolution_dir); + user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ())); rule_context_save((RuleContext *)context, user); g_free(user); } else { @@ -738,7 +743,7 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data) filter_rule_set_name(rule, info->new->full_name); g_signal_connect(rule, "changed", G_CALLBACK(rule_changed), folder); - user = g_strdup_printf("%s/vfolders.xml", evolution_dir); + user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ())); rule_context_save((RuleContext *)context, user); g_free(user); @@ -750,7 +755,7 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data) } void -vfolder_load_storage(GNOME_Evolution_Shell shell) +vfolder_load_storage(void) { char *user, *storeuri; FilterRule *rule; @@ -758,7 +763,7 @@ vfolder_load_storage(GNOME_Evolution_Shell shell) vfolder_hash = g_hash_table_new(g_str_hash, g_str_equal); /* first, create the vfolder store, and set it up */ - storeuri = g_strdup_printf("vfolder:%s/vfolder", evolution_dir); + storeuri = g_strdup_printf("vfolder:%s/vfolder", mail_component_peek_base_directory (mail_component_peek ())); vfolder_store = camel_session_get_store(session, storeuri, NULL); if (vfolder_store == NULL) { g_warning("Cannot open vfolder store - no vfolders available"); @@ -773,10 +778,10 @@ vfolder_load_storage(GNOME_Evolution_Shell shell) (CamelObjectEventHookFunc)store_folder_renamed, NULL); d(printf("got store '%s' = %p\n", storeuri, vfolder_store)); - mail_load_storage_by_uri(shell, storeuri, _("VFolders")); + mail_component_load_storage_by_uri(mail_component_peek (), storeuri, _("VFolders")); /* load our rules */ - user = g_strdup_printf ("%s/vfolders.xml", evolution_dir); + user = g_strdup_printf ("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ())); context = vfolder_context_new (); if (rule_context_load ((RuleContext *)context, EVOLUTION_PRIVDATADIR "/vfoldertypes.xml", user) != 0) { @@ -806,8 +811,7 @@ vfolder_editor_response (GtkWidget *dialog, int button, void *data) { char *user; - user = alloca(strlen(evolution_dir)+16); - sprintf(user, "%s/vfolders.xml", evolution_dir); + user = g_strdup_printf ("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ())); switch(button) { case GTK_RESPONSE_ACCEPT: @@ -820,6 +824,8 @@ vfolder_editor_response (GtkWidget *dialog, int button, void *data) vfolder_editor = NULL; gtk_widget_destroy(dialog); + + g_free (user); } void @@ -846,7 +852,7 @@ edit_rule_response(GtkWidget *w, int button, void *data) FilterRule *orig = g_object_get_data (G_OBJECT (w), "orig"); filter_rule_copy(orig, rule); - user = g_strdup_printf("%s/vfolders.xml", evolution_dir); + user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ())); rule_context_save((RuleContext *)context, user); g_free(user); } @@ -877,7 +883,7 @@ vfolder_edit_rule(const char *uri) GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); - gtk_container_set_border_width ((GtkContainer *) gd, 6); + gtk_container_set_border_width (GTK_CONTAINER (gd), 6); gtk_box_set_spacing ((GtkBox *) gd->vbox, 6); gtk_dialog_set_default_response(gd, GTK_RESPONSE_OK); g_object_set(gd, "allow_shrink", FALSE, "allow_grow", TRUE, NULL); @@ -925,7 +931,7 @@ new_rule_clicked(GtkWidget *w, int button, void *data) g_object_ref(rule); rule_context_add_rule((RuleContext *)context, rule); - user = g_strdup_printf("%s/vfolders.xml", evolution_dir); + user = g_strdup_printf("%s/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ())); rule_context_save((RuleContext *)context, user); g_free(user); } @@ -971,7 +977,7 @@ vfolder_gui_add_rule(VfolderRule *rule) GTK_RESPONSE_OK, NULL); gtk_dialog_set_default_response(gd, GTK_RESPONSE_OK); - gtk_container_set_border_width ((GtkContainer *) gd, 6); + gtk_container_set_border_width (GTK_CONTAINER (gd), 6); gtk_box_set_spacing ((GtkBox *) gd->vbox, 6); g_object_set(gd, "allow_shrink", FALSE, "allow_grow", TRUE, NULL); gtk_window_set_default_size (GTK_WINDOW (gd), 500, 500); |