diff options
author | 4 <NotZed@Ximian.com> | 2001-10-05 03:55:31 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-10-05 03:55:31 +0800 |
commit | e46018cd8879979f96ea8445691d9dbaeb22aacf (patch) | |
tree | 9eb1db67b95f754ed82bb7edf6f67b5b208cec73 /mail/mail-vfolder.c | |
parent | fcca68399ed6e0e9e6cb6e0d790f5b55a4593da6 (diff) | |
download | gsoc2013-evolution-e46018cd8879979f96ea8445691d9dbaeb22aacf.tar.gz gsoc2013-evolution-e46018cd8879979f96ea8445691d9dbaeb22aacf.tar.zst gsoc2013-evolution-e46018cd8879979f96ea8445691d9dbaeb22aacf.zip |
If we're accessing a vfolder uri, then popup the vfolder editor instead of
2001-10-04 <NotZed@Ximian.com>
* mail-callbacks.c (configure_folder): If we're accessing a
vfolder uri, then popup the vfolder editor instead of trying the
mail local one.
* mail-vfolder.c (vfolder_edit_rule): Edit a vfolder by name.
svn path=/trunk/; revision=13419
Diffstat (limited to 'mail/mail-vfolder.c')
-rw-r--r-- | mail/mail-vfolder.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 1faf912cc5..82ce02ea94 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -32,6 +32,8 @@ #include "mail-ops.h" #include "mail-mt.h" +#include "gal/widgets/e-gui-utils.h" + #include "camel/camel.h" #include "camel/camel-remote-store.h" #include "camel/camel-vee-folder.h" @@ -693,6 +695,67 @@ vfolder_edit (void) } static void +edit_rule_clicked(GtkWidget *w, int button, void *data) +{ + if (button == 0) { + char *user; + FilterRule *rule = gtk_object_get_data((GtkObject *)w, "rule"); + FilterRule *orig; + + orig = rule_context_find_rule((RuleContext *)context, rule->name, NULL); + if (orig) { + filter_rule_copy(orig, rule); + } else { + gtk_object_ref((GtkObject *)rule); + rule_context_add_rule((RuleContext *)context, rule); + } + user = g_strdup_printf("%s/vfolders.xml", evolution_dir); + rule_context_save((RuleContext *)context, user); + g_free(user); + } + if (button != -1) { + gnome_dialog_close((GnomeDialog *)w); + } +} + +void +vfolder_edit_rule(const char *uri) +{ + GtkWidget *w; + GnomeDialog *gd; + FilterRule *rule; + CamelURL *url; + + url = camel_url_new(uri, NULL); + if (url && url->fragment + && (rule = rule_context_find_rule((RuleContext *)context, url->fragment, NULL))) { + rule = filter_rule_clone(rule); + + w = filter_rule_get_widget((FilterRule *)rule, (RuleContext *)context); + + gd = (GnomeDialog *)gnome_dialog_new(_("Edit VFolder"), + GNOME_STOCK_BUTTON_OK, + GNOME_STOCK_BUTTON_CANCEL, + NULL); + gnome_dialog_set_default (gd, 0); + + gtk_window_set_policy(GTK_WINDOW(gd), FALSE, TRUE, FALSE); + gtk_window_set_default_size (GTK_WINDOW (gd), 500, 500); + gtk_box_pack_start((GtkBox *)gd->vbox, w, TRUE, TRUE, 0); + gtk_widget_show((GtkWidget *)gd); + gtk_object_set_data_full((GtkObject *)gd, "rule", rule, (GtkDestroyNotify)gtk_object_unref); + gtk_signal_connect((GtkObject *)gd, "clicked", edit_rule_clicked, NULL); + gtk_widget_show((GtkWidget *)gd); + } else { + e_notice (NULL, GNOME_MESSAGE_BOX_WARNING, + _("Trying to edit a vfolder '%s' which doesn't exist."), uri); + } + + if (url) + camel_url_free(url); +} + +static void new_rule_clicked(GtkWidget *w, int button, void *data) { if (button == 0) { |