diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 32 | ||||
-rw-r--r-- | mail/component-factory.c | 52 | ||||
-rw-r--r-- | mail/folder-browser-factory.c | 26 | ||||
-rw-r--r-- | mail/folder-browser-factory.h | 3 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 1 | ||||
-rw-r--r-- | mail/mail-folder-cache.c | 4 | ||||
-rw-r--r-- | mail/mail-vfolder.c | 48 |
7 files changed, 139 insertions, 27 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 17244682c8..046f5b27c0 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,33 @@ +2002-07-10 Not Zed <NotZed@Ximian.com> + + ** fixes for #10781 + + * mail-callbacks.c (filter_edit): Add back a cancel button. We + dont need to do anything special to 'undo' here, as the rules are + loaded every time they're used. + + * mail-vfolder.c (vfolder_editor_clicked): If ok wans't clicked, + revert the ruleset. + (vfolder_editor_destroy): Fake a button of -1 if we get destroyed + with no click. + (context_rule_removed): Unref the folder after we delete it. If + we're the last ref to the folder, unrefing it means it no longer + exist,s which means no delte processing occurs ... + +2002-07-04 Not Zed <NotZed@Ximian.com> + + * mail-accounts.c (news_add_destroyed): Pass teh autoconnect flag, + whcih shoudlnt' exist anyeway. + +2002-07-03 Not Zed <NotZed@Ximian.com> + + * component-factory.c (populate_folder_context_menu): If this is a + file url, look up its component, if we have it, then use the + mail-callback reconfigure call. + + * folder-browser-factory.c (folder_browser_factory_get_browser): + Util to get the folder browser from a uri. + 2002-07-11 Jeffrey Stedfast <fejj@ximian.com> * mail-display.c (pixmap_press): Rename "Save to disk..." to "Save @@ -128,6 +158,7 @@ (add_storage): Only call mail_note_store() if we plan on auto-connecting. +>>>>>>> 1.2246 2002-07-02 Jeffrey Stedfast <fejj@ximian.com> * folder-browser.c (on_right_click): Increase the size of the @@ -177,6 +208,7 @@ * mail-format.c (handle_multipart_related): Make sure that cid is non-NULL. +>>>>>>> 1.2245 2002-07-01 Not Zed <NotZed@Ximian.com> * mail-folder-cache.c (folder_deleted): Removed. The diff --git a/mail/component-factory.c b/mail/component-factory.c index 7fe2a4e8a1..6c677c1874 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -385,11 +385,16 @@ xfer_folder (EvolutionShellComponent *shell_component, camel_url_free(dst); } +static char *configure_folder_uri; +static FolderBrowser *configure_folder_browser; + static void configure_folder_popup(BonoboUIComponent *component, void *user_data, const char *cname) { char *uri = user_data; + return; + vfolder_edit_rule(uri); } @@ -406,20 +411,55 @@ populate_folder_context_menu (EvolutionShellComponent *shell_component, static char popup_xml[] = "<menuitem name=\"ChangeFolderPropertiesPopUp\" verb=\"ChangeFolderPropertiesPopUp\"" " _label=\"Properties...\" _tip=\"Change this folder's properties\"/>"; + static int setup = FALSE; + int add; - if (strcmp (type, "mail") != 0) - return; + if (!setup) { + setup = TRUE; + bonobo_ui_component_set_translate (uic, EVOLUTION_SHELL_COMPONENT_POPUP_PLACEHOLDER, popup_xml, NULL); + bonobo_ui_component_add_verb_full(uic, "ChangeFolderPropertiesPopUp", configure_folder_popup, NULL, NULL); + } + + if (strncmp(physical_uri, "file:", 5) == 0) { + add = folder_browser_factory_get_browser(physical_uri) != NULL; + } else if ((strncmp(physical_uri, "vfolder:", 8) == 0 + && strstr(physical_uri, "#" CAMEL_UNMATCHED_NAME) == NULL)) { + add = TRUE; + } else { + add = FALSE; + } + + printf("popup!!! url = '%s' add = %s\n", physical_uri, add?"TRUE":"FALSE"); + + bonobo_ui_component_set_prop(uic, EVOLUTION_SHELL_COMPONENT_POPUP_PLACEHOLDER "/ChangeFolderPropertiesPopUp", "sensitive", add?"1":"0", NULL); + +#if 0 + + { static int shit = 0; + shit++; + } /* FIXME: handle other types */ /* the unmatched test is a bit of a hack but it works */ - if (strncmp(physical_uri, "vfolder:", 8) != 0 - || strstr(physical_uri, "#" CAMEL_UNMATCHED_NAME) != NULL) + if (strncmp(physical_uri, "file:", 5) == 0) { + FolderBrowser *fb = folder_browser_factory_get_browser(physical_uri); + if (fb) { + printf("folderbrowser = %s\n", fb->uri); + gtk_object_ref((GtkObject *)fb); + bonobo_ui_component_add_verb_full(uic, "ChangeFolderPropertiesPopUp", configure_folder, fb, gtk_object_unref); + } else + return; + } else if ((strncmp(physical_uri, "vfolder:", 8) == 0 + && strstr(physical_uri, "#" CAMEL_UNMATCHED_NAME) == NULL)) { + bonobo_ui_component_add_verb_full(uic, "ChangeFolderPropertiesPopUp", configure_folder_popup, g_strdup(physical_uri), g_free); + } else { + printf("doing nothing\n"); return; - - bonobo_ui_component_add_verb_full(uic, "ChangeFolderPropertiesPopUp", configure_folder_popup, g_strdup(physical_uri), g_free); + } bonobo_ui_component_set_translate (uic, EVOLUTION_SHELL_COMPONENT_POPUP_PLACEHOLDER, popup_xml, NULL); +#endif } static char * diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index 395dc26ae8..fa09a3e059 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -213,3 +213,29 @@ folder_browser_factory_get_control_list (void) control_list = e_list_new (NULL, NULL, NULL); return control_list; } + +FolderBrowser * +folder_browser_factory_get_browser(const char *uri) +{ + EList *controls; + EIterator *it; + BonoboControl *control; + FolderBrowser *fb = NULL; + + if (control_list == NULL) + return NULL; + + controls = folder_browser_factory_get_control_list (); + for (it = e_list_get_iterator (controls); e_iterator_is_valid (it); e_iterator_next (it)) { + control = BONOBO_CONTROL (e_iterator_get (it)); + fb = FOLDER_BROWSER(bonobo_control_get_widget(control)); + if (fb->uri && strcmp(fb->uri, uri) == 0) + break; + fb = NULL; + } + gtk_object_unref (GTK_OBJECT(it)); + + return fb; +} + + diff --git a/mail/folder-browser-factory.h b/mail/folder-browser-factory.h index a279e6abd0..84ebd7a97b 100644 --- a/mail/folder-browser-factory.h +++ b/mail/folder-browser-factory.h @@ -14,9 +14,12 @@ #include <bonobo/bonobo-control.h> #include "Evolution.h" #include "e-util/e-list.h" +#include "folder-browser.h" BonoboControl *folder_browser_factory_new_control (const char *uri, const GNOME_Evolution_Shell shell); EList *folder_browser_factory_get_control_list (void); +FolderBrowser *folder_browser_factory_get_browser(const char *uri); + #endif /* _FOLDER_BROWSER_FACTORY_H */ diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 2cf8a5a8f5..2349dafb05 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -2739,6 +2739,7 @@ filter_edit (BonoboUIComponent *uih, void *user_data, const char *path) gtk_object_set_data_full (GTK_OBJECT (filter_editor), "context", fc, (GtkDestroyNotify)gtk_object_unref); gtk_signal_connect (GTK_OBJECT (filter_editor), "clicked", filter_editor_clicked, fb); gtk_signal_connect (GTK_OBJECT (filter_editor), "destroy", filter_editor_destroy, NULL); + gnome_dialog_append_buttons(GNOME_DIALOG(filter_editor), GNOME_STOCK_BUTTON_CANCEL, NULL); gtk_widget_show (GTK_WIDGET (filter_editor)); } diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 90c8419762..511be60e90 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -47,7 +47,7 @@ #include "mail-autofilter.h" #define w(x) -#define d(x) +#define d(x) /*(printf("%s(%d):%s: ", __FILE__, __LINE__, __PRETTY_FUNCTION__), (x))*/ /* note that many things are effectively serialised by having them run in the main loop thread which they need to do because of corba/gtk calls */ @@ -223,6 +223,8 @@ unset_folder_info(struct _folder_info *mfi, int delete) { struct _folder_update *up; + d(printf("unset folderinfo '%s'\n", mfi->uri)); + if (mfi->folder) { CamelFolder *folder = mfi->folder; diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 79e7721b61..4e969c3a6c 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -42,7 +42,7 @@ #include "filter/vfolder-context.h" #include "filter/vfolder-editor.h" -#define d(x) +#define d(x) /*(printf("%s(%d):%s: ", __FILE__, __LINE__, __PRETTY_FUNCTION__), (x))*/ static VfolderContext *context; /* context remains open all time */ static CamelStore *vfolder_store; /* the 1 static vfolder store */ @@ -340,7 +340,7 @@ mail_vfolder_add_uri(CamelStore *store, const char *uri, int remove) int found = FALSE; if (!rule->name) { - d(printf ("invalid rule (%p): rule->name is set to NULL\n")); + d(printf("invalid rule (%p): rule->name is set to NULL\n", rule)); continue; } @@ -592,7 +592,7 @@ static void context_rule_added(RuleContext *ctx, FilterRule *rule) static void context_rule_removed(RuleContext *ctx, FilterRule *rule) { char *key, *path; - CamelFolder *folder; + CamelFolder *folder = NULL; d(printf("rule removed; %s\n", rule->name)); @@ -606,12 +606,13 @@ static void context_rule_removed(RuleContext *ctx, FilterRule *rule) if (g_hash_table_lookup_extended(vfolder_hash, rule->name, (void **)&key, (void **)&folder)) { g_hash_table_remove(vfolder_hash, key); g_free(key); - UNLOCK(); - camel_object_unref((CamelObject *)folder); - } else - UNLOCK(); + } + UNLOCK(); camel_store_delete_folder(vfolder_store, rule->name, NULL); + /* this must be unref'd after its deleted */ + if (folder) + camel_object_unref(folder); } static void @@ -743,7 +744,7 @@ vfolder_load_storage(GNOME_Evolution_Shell shell) if (rule->name) context_rule_added((RuleContext *)context, rule); else - d(printf ("invalid rule (%p) encountered: rule->name is NULL\n")); + d(printf("invalid rule (%p) encountered: rule->name is NULL\n", rule)); } g_free(storeuri); @@ -752,24 +753,29 @@ vfolder_load_storage(GNOME_Evolution_Shell shell) static GtkWidget *vfolder_editor = NULL; static void -vfolder_editor_destroy (GtkWidget *widget, gpointer user_data) +vfolder_editor_clicked (GtkWidget *dialog, int button, void *data) { + char *user; + + user = alloca(strlen(evolution_dir)+16); + sprintf(user, "%s/vfolders.xml", evolution_dir); + + if (button == 0) + rule_context_save ((RuleContext *)context, user); + else + rule_context_revert ((RuleContext *)context, user); + + if (button != -1) + gnome_dialog_close (GNOME_DIALOG (dialog)); + vfolder_editor = NULL; } static void -vfolder_editor_clicked (GtkWidget *dialog, int button, void *data) +vfolder_editor_destroy (GtkWidget *widget, gpointer user_data) { - if (button == 0) { - char *user; - - user = g_strdup_printf ("%s/vfolders.xml", evolution_dir); - rule_context_save ((RuleContext *)context, user); - g_free (user); - } - if (button != -1) { - gnome_dialog_close (GNOME_DIALOG (dialog)); - } + if (vfolder_editor) + vfolder_editor_clicked(vfolder_editor, -1, user_data); } void @@ -784,6 +790,8 @@ vfolder_edit (void) gtk_window_set_title (GTK_WINDOW (vfolder_editor), _("vFolders")); gtk_signal_connect (GTK_OBJECT (vfolder_editor), "clicked", vfolder_editor_clicked, NULL); gtk_signal_connect (GTK_OBJECT (vfolder_editor), "destroy", vfolder_editor_destroy, NULL); + gnome_dialog_append_buttons (GNOME_DIALOG (vfolder_editor), GNOME_STOCK_BUTTON_CANCEL, NULL); + gtk_widget_show (vfolder_editor); } |