this script + some grunt approximates the work:
s/Evolution_MessageList/GNOME_Evolution_MessageList/g;
s/GNOME_Evolution_MessageList_select_message/GNOME_Evolution_MessageList_selectMessage/g;
s/GNOME_Evolution_MessageList_open_message/GNOME_Evolution_MessageList_openMessage/g;
s/Evolution_Folder([ \t])/GNOME_Evolution_Folder$1/g;
s/Evolution_FolderTypeList/GNOME_Evolution_FolderTypeList/g;
s/Evolution_FolderBrowser/GNOME_Evolution_FolderBrowser/g;
s/GNOME_Evolution_FolderBrowser_get_message_list/GNOME_Evolution_FolderBrowser_getMessageList/g;
s/Evolution_LocalStorage/GNOME_Evolution_LocalStorage/g;
s/GNOME_Evolution_LocalStorage_update_folder/GNOME_Evolution_LocalStorage_updateFolder/g;
s/Evolution_ShellView/GNOME_Evolution_ShellView/g;
s/GNOME_Evolution_ShellView_set_message/GNOME_Evolution_ShellView_setMessage/g;
s/GNOME_Evolution_ShellView_unset_message/GNOME_Evolution_ShellView_unsetMessage/g;
s/GNOME_Evolution_ShellView_change_current_view/GNOME_Evolution_ShellView_changeCurrentView/g;
s/Evolution_StorageSetViewListener/GNOME_Evolution_StorageSetViewListener/g;
s/GNOME_Evolution_StorageSetViewListener_folder_selected/GNOME_Evolution_StorageSetViewListener_notifyFolderSelected/g;
s/GNOME_Evolution_StorageSetViewListener_storage_selected/GNOME_Evolution_StorageSetViewListener_notifyStorageSelected/g;
s/Evolution_StorageSetView/GNOME_Evolution_StorageSetView/g;
s/GNOME_Evolution_StorageSetView_add_listener/GNOME_Evolution_StorageSetView_addListener/g;
s/GNOME_Evolution_StorageSetView_remove_listener/GNOME_Evolution_StorageSetView_removeListener/g;
s/Evolution_Shell/GNOME_Evolution_Shell/g;
s/GNOME_Evolution_Shell_get_component_for_type/GNOME_Evolution_Shell_getComponentByType/g;
s/GNOME_Evolution_Shell_user_select_folder/GNOME_Evolution_Shell_selectUserFolder/g;
s/GNOME_Evolution_Shell_get_local_storage/GNOME_Evolution_Shell_getLocalStorage/g;
s/GNOME_Evolution_Shell_create_storage_set_view/GNOME_Evolution_Shell_createStorageSetView/g;
s/Evolution_FolderSelectionListener/GNOME_Evolution_FolderSelectionListener/g;
s/GNOME_Evolution_FolderSelectionListener_selected/GNOME_Evolution_FolderSelectionListener_notifySelected/g;
s/GNOME_Evolution_FolderSelectionListener_cancel/GNOME_Evolution_FolderSelectionListener_notifyCanceled/g;
s/Evolution_Storage/GNOME_Evolution_Storage/g;
s/GNOME_Evolution_Storage_add_listener/GNOME_Evolution_Storage_addListener/g;
s/GNOME_Evolution_Storage_remove_listener/GNOME_Evolution_Storage_removeListener/g;
s/GNOME_Evolution_StorageListener_destroyed/GNOME_Evolution_StorageListener_notifyDestroyed/g;
s/GNOME_Evolution_StorageListener_new_folder/GNOME_Evolution_StorageListener_notifyFolderCreated/g;
s/GNOME_Evolution_StorageListener_update_folder/GNOME_Evolution_StorageListener_notifyFolderUpdated/g;
s/GNOME_Evolution_StorageListener_removed_folder/GNOME_Evolution_StorageListener_notifyFolderRemoved/g;
s/GNOME_Evolution_StorageRegistry_register_storage/GNOME_Evolution_StorageRegistry_addStorage/g;
s/GNOME_Evolution_StorageRegistry_unregister_storage/GNOME_Evolution_StorageRegistry_removeStorageByName/g;
s/Evolution_ShellComponent/GNOME_Evolution_ShellComponent/g;
s/GNOME_Evolution_ShellComponent_set_owner/GNOME_Evolution_ShellComponent_setOwner/g;
s/GNOME_Evolution_ShellComponent_unset_owner/GNOME_Evolution_ShellComponent_unsetOwner/g;
s/GNOME_Evolution_ShellComponent_create_view/GNOME_Evolution_ShellComponent_createView/g;
s/GNOME_Evolution_ShellComponent_async_create_folder/GNOME_Evolution_ShellComponent_addFolderAsync/g;
s/GNOME_Evolution_ShellComponent_async_remove_folder/GNOME_Evolution_ShellComponent_removeFolderAsync/g;
s/GNOME_Evolution_ShellComponent_populate_folder_context_menu/GNOME_Evolution_ShellComponent_populateFolderContextMenu/g;
s/GNOME_Evolution_ShellComponentListener_report_result/GNOME_Evolution_ShellComponentListener_notifyResult/g;
s/Evolution_Session/GNOME_Evolution_Session/g;
s/GNOME_Evolution_Session_save_configuration/GNOME_Evolution_Session_saveConfiguration/g;
s/GNOME_Evolution_Session_load_configuration/GNOME_Evolution_Session_loadConfiguration/g;
s/Evolution_Calendar_Cal/GNOME_Evolution_Calendar_Cal/g;
s/GNOME_Evolution_Calendar_Cal_get_n_objects/GNOME_Evolution_Calendar_Cal_countObjects/g;
s/GNOME_Evolution_Calendar_Cal_get_object/GNOME_Evolution_Calendar_Cal_getObject/g;
s/GNOME_Evolution_Calendar_Cal_get_uids/GNOME_Evolution_Calendar_Cal_getUIds/g;
s/GNOME_Evolution_Calendar_Cal_get_changed_uids/GNOME_Evolution_Calendar_Cal_getChangedUIds/g;
s/GNOME_Evolution_Calendar_Cal_get_objects_in_range/GNOME_Evolution_Calendar_Cal_getObjectsInRange/g;
s/GNOME_Evolution_Calendar_Cal_get_alarms_in_range/GNOME_Evolution_Calendar_Cal_getAlarmsInRange/g;
s/GNOME_Evolution_Calendar_Cal_get_alarms_for_object/GNOME_Evolution_Calendar_Cal_getAlarmsForObject/g;
s/GNOME_Evolution_Calendar_Cal_update_object/GNOME_Evolution_Calendar_Cal_updateObject/g;
s/GNOME_Evolution_Calendar_Cal_remove_object/GNOME_Evolution_Calendar_Cal_removeObject/g;
s/Evolution_Calendar_Listener/GNOME_Evolution_Calendar_Listener/g;
s/GNOME_Evolution_Calendar_Listener_cal_loaded/GNOME_Evolution_Calendar_Listener_notifyCalLoaded/g;
s/GNOME_Evolution_Calendar_Listener_obj_updated/GNOME_Evolution_Calendar_Listener_notifyObjUpdated/g;
s/GNOME_Evolution_Calendar_Listener_obj_removed/GNOME_Evolution_Calendar_Listener_notifyObjRemoved/g;
s/Evolution_Calendar_CalFactory/GNOME_Evolution_Calendar_CalFactory/g;
s/GNOME_Evolution_Calendar_CalFactory_load/GNOME_Evolution_Calendar_CalFactory_load/g;
s/GNOME_Evolution_Calendar_CalFactory_create/GNOME_Evolution_Calendar_CalFactory_create/g;
s/Evolution_Composer/GNOME_Evolution_Composer/g;
s/GNOME_Evolution_Composer_set_headers/GNOME_Evolution_Composer_setHeaders/g;
s/GNOME_Evolution_Composer_set_body_text/GNOME_Evolution_Composer_setBodyText/g;
s/GNOME_Evolution_Composer_attach_MIME/GNOME_Evolution_Composer_attachMIME/g;
s/GNOME_Evolution_Composer_attach_data/GNOME_Evolution_Composer_attachData/g;
s/GNOME_Evolution_Composer_show/GNOME_Evolution_Composer_show/g;
s/Evolution_Addressbook_SelectNames/GNOME_Evolution_Addressbook_SelectNames/g;
s/GNOME_Evolution_Addressbook_SelectNames_add_section/GNOME_Evolution_Addressbook_SelectNames_addSection/g;
s/GNOME_Evolution_Addressbook_SelectNames_get_entry_for_section/GNOME_Evolution_Addressbook_SelectNames_getEntryBySection/g;
s/GNOME_Evolution_Addressbook_SelectNames_activate_dialog/GNOME_Evolution_Addressbook_SelectNames_activateDialog/g;
s/Evolution_CardCursor/GNOME_Evolution_Addressbook_CardCursor/g;
s/GNOME_Evolution_Addressbook_CardCursor_get_length/GNOME_Evolution_Addressbook_CardCursor_getLength/g;
s/GNOME_Evolution_Addressbook_CardCursor_get_nth/GNOME_Evolution_Addressbook_CardCursor_getNth/g;
s/Evolution_BookViewListener/GNOME_Evolution_Addressbook_BookViewListener/g;
s/GNOME_Evolution_Addressbook_BookViewListener_signal_card_added/GNOME_Evolution_Addressbook_BookViewListener_notifyCardAdded/g;
s/GNOME_Evolution_Addressbook_BookViewListener_signal_card_removed/GNOME_Evolution_Addressbook_BookViewListener_notifyCardRemoved/g;
s/GNOME_Evolution_Addressbook_BookViewListener_signal_card_changed/GNOME_Evolution_Addressbook_BookViewListener_notifyCardChanged/g;
s/GNOME_Evolution_Addressbook_BookViewListener_signal_sequence_complete/GNOME_Evolution_Addressbook_BookViewListener_notifySequenceComplete/g;
s/GNOME_Evolution_Addressbook_BookViewListener_signal_status_message/GNOME_Evolution_Addressbook_BookViewListener_notifyStatusMessage/g;
s/Evolution_BookView/GNOME_Evolution_Addressbook_BookView/g;
s/Evolution_Book/GNOME_Evolution_Addressbook_Book/g;
s/GNOME_Evolution_Addressbook_Book_get_vcard/GNOME_Evolution_Addressbook_Book_getVCard/g;
s/GNOME_Evolution_Addressbook_Book_can_write/GNOME_Evolution_Addressbook_Book_isWriteable/g;
s/GNOME_Evolution_Addressbook_Book_can_write_card/GNOME_Evolution_Addressbook_Book_isCardWriteable/g;
s/GNOME_Evolution_Addressbook_Book_create_card/GNOME_Evolution_Addressbook_Book_addCard/g;
s/GNOME_Evolution_Addressbook_Book_remove_card/GNOME_Evolution_Addressbook_Book_removeCard/g;
s/GNOME_Evolution_Addressbook_Book_modify_card/GNOME_Evolution_Addressbook_Book_modifyCard/g;
s/GNOME_Evolution_Addressbook_Book_get_cursor/GNOME_Evolution_Addressbook_Book_getCursor/g;
s/GNOME_Evolution_Addressbook_Book_get_book_view/GNOME_Evolution_Addressbook_Book_getBookView/g;
s/GNOME_Evolution_Addressbook_Book_get_changes/GNOME_Evolution_Addressbook_Book_getChanges/g;
s/GNOME_Evolution_Addressbook_Book_check_connection/GNOME_Evolution_Addressbook_Book_checkConnection/g;
s/GNOME_Evolution_Addressbook_Book_get_static_capabilities/GNOME_Evolution_Addressbook_Book_getStaticCapabilities/g;
s/GNOME_Evolution_Addressbook_Book_get_name/GNOME_Evolution_Addressbook_Book_getName/g;
s/Evolution_BookListener/GNOME_Evolution_Addressbook_BookListener/g;
s/GNOME_Evolution_Addressbook_BookListener_respond_create_card/GNOME_Evolution_Addressbook_BookListener_notifyCardCreated/g;
s/GNOME_Evolution_Addressbook_BookListener_respond_remove_card/GNOME_Evolution_Addressbook_BookListener_notifyCardRemoved/g;
s/GNOME_Evolution_Addressbook_BookListener_respond_modify_card/GNOME_Evolution_Addressbook_BookListener_notifyCardModified/g;
s/GNOME_Evolution_Addressbook_BookListener_report_open_book_progress/GNOME_Evolution_Addressbook_BookListener_notifyOpenBookProgress/g;
s/GNOME_Evolution_Addressbook_BookListener_respond_open_book/GNOME_Evolution_Addressbook_BookListener_notifyBookOpened/g;
s/GNOME_Evolution_Addressbook_BookListener_respond_get_cursor/GNOME_Evolution_Addressbook_BookListener_notifyCursorRequested/g;
s/GNOME_Evolution_Addressbook_BookListener_respond_get_view/GNOME_Evolution_Addressbook_BookListener_notifyViewRequested/g;
s/GNOME_Evolution_Addressbook_BookListener_respond_get_changes/GNOME_Evolution_Addressbook_BookListener_notifyChangesRequested/g;
s/GNOME_Evolution_Addressbook_BookListener_report_connection_status/GNOME_Evolution_Addressbook_BookListener_notifyConnectionStatus/g;
s/Evolution_BookFactory/GNOME_Evolution_Addressbook_BookFactory/g;
s/GNOME_Evolution_Addressbook_BookFactory_open_book/GNOME_Evolution_Addressbook_BookFactory_openBook/g;
s/Evolution_SummaryComponent/GNOME_Evolution_Summary_Component/g;
s/GNOME_Evolution_Summary_SummaryComponent_set_owner/GNOME_Evolution_Summary_Component_setOwner/g;
s/GNOME_Evolution_Summary_SummaryComponent_unset_owner/GNOME_Evolution_Summary_Component_unsetOwner/g;
s/GNOME_Evolution_Summary_SummaryComponent_create_view/GNOME_Evolution_Summary_Component_createView/g;
s/GNOME_Evolution_Summary_SummaryComponent_destroy_view/GNOME_Evolution_Summary_Component_destroyView/g;
s/Evolution_Summary([ \t])/GNOME_Evolution_Summary_ViewFrame$1/g;
s/Evolution_Summary_set_title/GNOME_Evolution_Summary_ViewFrame_setTitle/g;
s/Evolution_Summary_set_icon/GNOME_Evolution_Summary_ViewFrame_setIcon/g;
s/Evolution_Summary_update_component/GNOME_Evolution_Summary_ViewFrame_updateComponent/g;
s/GNOME_GNOME/GNOME/g;
s/GNOME_GNOME/GNOME/g;
s/GNOME_GNOME/GNOME/g;
svn path=/trunk/; revision=6535
313 lines
8.1 KiB
C
313 lines
8.1 KiB
C
/*
|
|
Copyright 2000 Helix Code Inc.
|
|
|
|
Author: Michael Zucchi <notzed@helixcode.com>
|
|
|
|
code for managing vfolders
|
|
|
|
NOTE: dont run this through fucking indent.
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include <config.h>
|
|
#endif
|
|
#include <bonobo.h>
|
|
|
|
#include "Evolution.h"
|
|
#include "evolution-storage.h"
|
|
|
|
#include "evolution-shell-component.h"
|
|
#include "folder-browser.h"
|
|
#include "mail-vfolder.h"
|
|
#include "mail-tools.h"
|
|
#include "mail-autofilter.h"
|
|
|
|
#include "camel/camel.h"
|
|
|
|
#include "filter/vfolder-context.h"
|
|
#include "filter/vfolder-editor.h"
|
|
|
|
#define d(x) x
|
|
|
|
struct _vfolder_info {
|
|
char *name;
|
|
char *query;
|
|
};
|
|
|
|
/* list of vfolders available */
|
|
static GList *available_vfolders = NULL;
|
|
static VfolderContext *context;
|
|
static EvolutionStorage *vfolder_storage;
|
|
|
|
/* GROSS HACK: for passing to other parts of the program */
|
|
EvolutionShellClient *global_shell_client = NULL;
|
|
|
|
/* more globals ... */
|
|
extern char *evolution_dir;
|
|
extern CamelSession *session;
|
|
|
|
static struct _vfolder_info *
|
|
vfolder_find(const char *name)
|
|
{
|
|
GList *l = available_vfolders;
|
|
struct _vfolder_info *info;
|
|
|
|
while (l) {
|
|
info = l->data;
|
|
if (!strcmp(info->name, name))
|
|
return info;
|
|
l = g_list_next(l);
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
/* go through the list of what we have, what we want, and make
|
|
them match, deleting/reconfiguring as required */
|
|
static void
|
|
vfolder_refresh(void)
|
|
{
|
|
GList *l;
|
|
GList *head = NULL; /* processed list */
|
|
struct _vfolder_info *info;
|
|
FilterRule *rule;
|
|
GString *expr = g_string_new("");
|
|
char *uri, *path;
|
|
|
|
rule = NULL;
|
|
while ( (rule = rule_context_next_rule((RuleContext *)context, rule, NULL)) ) {
|
|
info = vfolder_find(rule->name);
|
|
g_string_truncate(expr, 0);
|
|
filter_rule_build_code(rule, expr);
|
|
if (info) {
|
|
available_vfolders = g_list_remove(available_vfolders, info);
|
|
|
|
/* check if the rule has changed ... otherwise, leave it */
|
|
if (strcmp(expr->str, info->query)) {
|
|
d(printf("Must reconfigure vfolder with new rule?\n"));
|
|
g_free(info->query);
|
|
info->query = g_strdup(expr->str);
|
|
|
|
uri = g_strdup_printf("vfolder:%s", info->name);
|
|
path = g_strdup_printf("/%s", info->name);
|
|
evolution_storage_removed_folder(vfolder_storage, path);
|
|
evolution_storage_new_folder(vfolder_storage, path, g_basename(path),
|
|
"mail", uri, info->name, FALSE);
|
|
g_free(uri);
|
|
g_free(path);
|
|
}
|
|
} else {
|
|
info = g_malloc(sizeof(*info));
|
|
info->name = g_strdup(rule->name);
|
|
info->query = g_strdup(expr->str);
|
|
d(printf("Adding new vfolder: %s %s\n", rule->name, expr->str));
|
|
|
|
uri = g_strdup_printf("vfolder:%s", info->name);
|
|
path = g_strdup_printf("/%s", info->name);
|
|
evolution_storage_new_folder(vfolder_storage, path, g_basename(path),
|
|
"mail", uri, info->name, FALSE);
|
|
g_free(uri);
|
|
g_free(path);
|
|
}
|
|
head = g_list_append(head, info);
|
|
}
|
|
/* everything in available_vfolders are to be removed ... */
|
|
l = available_vfolders;
|
|
while (l) {
|
|
info = l->data;
|
|
d(printf("removing vfolders %s %s\n", info->name, info->query));
|
|
path = g_strdup_printf("/%s", info->name);
|
|
evolution_storage_removed_folder(vfolder_storage, path);
|
|
g_free(path);
|
|
g_free(info->name);
|
|
g_free(info->query);
|
|
l = g_list_next(l);
|
|
}
|
|
g_list_free(available_vfolders);
|
|
available_vfolders = head;
|
|
g_string_free(expr, TRUE);
|
|
}
|
|
|
|
void
|
|
vfolder_create_storage(EvolutionShellComponent *shell_component)
|
|
{
|
|
EvolutionShellClient *shell_client;
|
|
GNOME_Evolution_Shell corba_shell;
|
|
EvolutionStorage *storage;
|
|
char *user, *system;
|
|
|
|
shell_client = evolution_shell_component_get_owner (shell_component);
|
|
if (shell_client == NULL) {
|
|
g_warning ("We have no shell!?");
|
|
return;
|
|
}
|
|
global_shell_client = shell_client;
|
|
|
|
corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
|
|
|
|
storage = evolution_storage_new (_("VFolders"));
|
|
if (evolution_storage_register_on_shell (storage, corba_shell) != EVOLUTION_STORAGE_OK) {
|
|
g_warning ("Cannot register storage");
|
|
return;
|
|
}
|
|
|
|
vfolder_storage = storage;
|
|
|
|
user = g_strdup_printf ("%s/vfolders.xml", evolution_dir);
|
|
system = g_strdup_printf("%s/evolution/vfoldertypes.xml", EVOLUTION_DATADIR);
|
|
|
|
context = vfolder_context_new();
|
|
printf("loading rules %s %s\n", system, user);
|
|
if (rule_context_load((RuleContext *)context, system, user) != 0) {
|
|
g_warning("cannot load vfolders: %s\n", ((RuleContext *)context)->error);
|
|
}
|
|
g_free(user);
|
|
g_free(system);
|
|
vfolder_refresh();
|
|
}
|
|
|
|
/* maps the shell's uri to the real vfolder uri and open the folder */
|
|
CamelFolder *
|
|
vfolder_uri_to_folder(const char *uri, CamelException *ex)
|
|
{
|
|
void camel_vee_folder_add_folder(CamelFolder *, CamelFolder *);
|
|
|
|
struct _vfolder_info *info;
|
|
char *storeuri, *foldername;
|
|
VfolderRule *rule;
|
|
CamelFolder *folder = NULL, *sourcefolder;
|
|
const char *sourceuri;
|
|
int sources;
|
|
|
|
if (strncmp (uri, "vfolder:", 8))
|
|
return NULL;
|
|
|
|
info = vfolder_find(uri+8);
|
|
if (info == NULL) {
|
|
g_warning("Shell trying to open unknown vFolder: %s", uri);
|
|
return NULL;
|
|
}
|
|
|
|
d(printf("Opening vfolder: %s\n", uri));
|
|
|
|
rule = (VfolderRule *)rule_context_find_rule((RuleContext *)context, info->name, NULL);
|
|
|
|
storeuri = g_strdup_printf("vfolder:%s/vfolder/%s", evolution_dir, info->name);
|
|
foldername = g_strdup_printf("mbox?%s", info->query);
|
|
|
|
/* we dont have indexing on vfolders */
|
|
folder = mail_tool_get_folder_from_urlname (storeuri, foldername, CAMEL_STORE_FOLDER_CREATE, ex);
|
|
|
|
sourceuri = NULL;
|
|
sources = 0;
|
|
while ( (sourceuri = vfolder_rule_next_source(rule, sourceuri)) ) {
|
|
d(printf("adding vfolder source: %s\n", sourceuri));
|
|
sourcefolder = mail_tool_uri_to_folder (sourceuri, ex);
|
|
if (sourcefolder) {
|
|
sources++;
|
|
mail_tool_camel_lock_up ();
|
|
camel_vee_folder_add_folder(folder, sourcefolder);
|
|
mail_tool_camel_lock_down ();
|
|
}
|
|
}
|
|
/* if we didn't have any sources, just use Inbox as the default */
|
|
if (sources == 0) {
|
|
char *defaulturi;
|
|
|
|
defaulturi = g_strdup_printf("file://%s/local/Inbox", evolution_dir);
|
|
d(printf("No sources configured/found, using default: %s\n", defaulturi));
|
|
sourcefolder = mail_tool_uri_to_folder (defaulturi, ex);
|
|
g_free(defaulturi);
|
|
if (sourcefolder) {
|
|
mail_tool_camel_lock_up ();
|
|
camel_vee_folder_add_folder(folder, sourcefolder);
|
|
mail_tool_camel_lock_down ();
|
|
}
|
|
}
|
|
|
|
g_free(foldername);
|
|
g_free(storeuri);
|
|
|
|
return folder;
|
|
}
|
|
|
|
static void
|
|
vfolder_editor_clicked(GtkWidget *w, int button, void *data)
|
|
{
|
|
if (button == 0) {
|
|
char *user;
|
|
|
|
user = g_strdup_printf("%s/vfolders.xml", evolution_dir);
|
|
rule_context_save((RuleContext *)context, user);
|
|
g_free(user);
|
|
vfolder_refresh();
|
|
}
|
|
if (button != -1) {
|
|
gnome_dialog_close((GnomeDialog *)w);
|
|
}
|
|
}
|
|
|
|
void
|
|
vfolder_edit(void)
|
|
{
|
|
GtkWidget *w;
|
|
|
|
w = vfolder_editor_construct(context);
|
|
gtk_signal_connect((GtkObject *)w, "clicked", vfolder_editor_clicked, NULL);
|
|
gtk_widget_show(w);
|
|
}
|
|
|
|
static void
|
|
new_rule_clicked(GtkWidget *w, int button, void *data)
|
|
{
|
|
if (button == 0) {
|
|
char *user;
|
|
FilterRule *rule = gtk_object_get_data((GtkObject *)w, "rule");
|
|
|
|
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);
|
|
vfolder_refresh();
|
|
}
|
|
if (button != -1) {
|
|
gnome_dialog_close((GnomeDialog *)w);
|
|
}
|
|
}
|
|
|
|
FilterPart *
|
|
vfolder_create_part(const char *name)
|
|
{
|
|
return rule_context_create_part((RuleContext *)context, name);
|
|
}
|
|
|
|
/* adds a rule with a gui */
|
|
void
|
|
vfolder_gui_add_rule(VfolderRule *rule)
|
|
{
|
|
GtkWidget *w;
|
|
GnomeDialog *gd;
|
|
|
|
w = filter_rule_get_widget((FilterRule *)rule, (RuleContext *)context);
|
|
gd = (GnomeDialog *)gnome_dialog_new(_("New VFolder"),
|
|
GNOME_STOCK_BUTTON_OK,
|
|
GNOME_STOCK_BUTTON_CANCEL,
|
|
NULL);
|
|
gtk_window_set_policy(GTK_WINDOW(gd), FALSE, TRUE, FALSE);
|
|
gtk_box_pack_start((GtkBox *)gd->vbox, w, FALSE, 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", new_rule_clicked, NULL);
|
|
gtk_widget_show((GtkWidget *)gd);
|
|
}
|
|
|
|
void
|
|
vfolder_gui_add_from_message(CamelMimeMessage *msg, int flags, const char *source)
|
|
{
|
|
VfolderRule *rule;
|
|
|
|
rule = (VfolderRule*)vfolder_rule_from_message(context, msg, flags, source);
|
|
vfolder_gui_add_rule(rule);
|
|
}
|
|
|