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
This commit is contained in:
4
2001-10-04 19:55:31 +00:00
committed by Michael Zucci
parent fcca68399e
commit e46018cd88
4 changed files with 78 additions and 1 deletions

View File

@ -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.

View File

@ -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

View File

@ -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"
@ -692,6 +694,67 @@ vfolder_edit (void)
gtk_widget_show (vfolder_editor);
}
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)
{

View File

@ -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);