aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author4 <NotZed@Ximian.com>2001-10-05 03:55:31 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-10-05 03:55:31 +0800
commite46018cd8879979f96ea8445691d9dbaeb22aacf (patch)
tree9eb1db67b95f754ed82bb7edf6f67b5b208cec73
parentfcca68399ed6e0e9e6cb6e0d790f5b55a4593da6 (diff)
downloadgsoc2013-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
-rw-r--r--mail/ChangeLog8
-rw-r--r--mail/mail-callbacks.c7
-rw-r--r--mail/mail-vfolder.c63
-rw-r--r--mail/mail-vfolder.h1
4 files changed, 78 insertions, 1 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index c6c7159095..0a76f0e0ca 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,11 @@
+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.
+
2001-10-04 Jeffrey Stedfast <fejj@ximian.com>
* mail-account-gui.c (mail_account_gui_save): Added some more NULL checks.
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 7ed4505918..11e4aec473 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -2138,7 +2138,12 @@ configure_folder (BonoboUIComponent *uih, void *user_data, const char *path)
{
FolderBrowser *fb = FOLDER_BROWSER(user_data);
- mail_local_reconfigure_folder(fb);
+ if (fb->uri &&
+ strncmp(fb->uri, "vfolder:", 8) == 0) {
+ vfolder_edit_rule(fb->uri);
+ } else {
+ mail_local_reconfigure_folder(fb);
+ }
}
static void
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) {
diff --git a/mail/mail-vfolder.h b/mail/mail-vfolder.h
index d27698bfdd..ec27d8b8fb 100644
--- a/mail/mail-vfolder.h
+++ b/mail/mail-vfolder.h
@@ -14,6 +14,7 @@
void vfolder_load_storage(GNOME_Evolution_Shell shell);
void vfolder_edit (void);
+void vfolder_edit_rule(const char *name);
FilterPart *vfolder_create_part (const char *name);
FilterRule *vfolder_clone_rule (FilterRule *in);
void vfolder_gui_add_rule (VfolderRule *rule);