diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ChangeLog.ja | 7 | ||||
-rw-r--r-- | src/filter.c | 41 | ||||
-rw-r--r-- | src/filter.h | 5 | ||||
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/prefs_filter.c | 47 | ||||
-rw-r--r-- | src/prefs_filter.h | 3 |
7 files changed, 60 insertions, 53 deletions
@@ -1,5 +1,11 @@ 2005-09-02 + * src/main.c + src/filter.[ch] + src/prefs_filter.[ch]: moved prefs_filter_read_config() to filter.c. + +2005-09-02 + * libsylph/recv.[ch]: moved to libsylph. 2005-09-02 diff --git a/ChangeLog.ja b/ChangeLog.ja index d06f5d8a..3da3b620 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,5 +1,12 @@ 2005-09-02 + * src/main.c + src/filter.[ch] + src/prefs_filter.[ch]: prefs_filter_read_config() を filter.c + に移動。 + +2005-09-02 + * libsylph/recv.[ch]: libsylph に移動。 2005-09-02 diff --git a/src/filter.c b/src/filter.c index b4a26ee0..873211c5 100644 --- a/src/filter.c +++ b/src/filter.c @@ -40,6 +40,7 @@ #include "utils.h" #include "xml.h" #include "prefs.h" +#include "prefs_common.h" #include "prefs_account.h" #include "account.h" @@ -645,12 +646,48 @@ GSList *filter_xml_node_to_filter_list(GNode *node) return fltlist; } +void filter_read_config(void) +{ + gchar *rcpath; + GNode *node; + FilterRule *rule; + + debug_print("Reading filter configuration...\n"); + + /* remove all previous filter list */ + while (prefs_common.fltlist != NULL) { + rule = (FilterRule *)prefs_common.fltlist->data; + filter_rule_free(rule); + prefs_common.fltlist = g_slist_remove(prefs_common.fltlist, + rule); + } + + rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, FILTER_LIST, + NULL); + if (!is_file_exist(rcpath)) { + g_free(rcpath); + return; + } + + node = xml_parse_file(rcpath); + if (!node) { + g_warning("Can't parse %s\n", rcpath); + g_free(rcpath); + return; + } + g_free(rcpath); + + prefs_common.fltlist = filter_xml_node_to_filter_list(node); + + xml_free_tree(node); +} + #define NODE_NEW(tag, text) \ node = xml_node_new(xml_tag_new(tag), text) #define ADD_ATTR(name, value) \ xml_tag_add_attr(node->tag, xml_attr_new(name, value)) -void filter_write_config(GSList *fltlist) +void filter_write_config(void) { gchar *rcpath; PrefFile *pfile; @@ -669,7 +706,7 @@ void filter_write_config(GSList *fltlist) xml_file_put_xml_decl(pfile->fp); fputs("\n<filter>\n", pfile->fp); - for (cur = fltlist; cur != NULL; cur = cur->next) { + for (cur = prefs_common.fltlist; cur != NULL; cur = cur->next) { FilterRule *rule = (FilterRule *)cur->data; GSList *cur_cond; GSList *cur_action; diff --git a/src/filter.h b/src/filter.h index 46d6caa0..98951856 100644 --- a/src/filter.h +++ b/src/filter.h @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2004 Hiroyuki Yamamoto + * Copyright (C) 1999-2005 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -156,7 +156,8 @@ gboolean filter_match_rule (FilterRule *rule, /* read / write config */ GSList *filter_xml_node_to_filter_list (GNode *node); -void filter_write_config (GSList *fltlist); +void filter_read_config (void); +void filter_write_config (void); /* for old filterrc */ gchar *filter_get_str (FilterRule *rule); @@ -196,7 +196,7 @@ int main(int argc, char *argv[]) CHDIR_EXIT_IF_FAIL(get_home_dir(), 1); prefs_common_read_config(); - prefs_filter_read_config(); + filter_read_config(); prefs_actions_read_config(); prefs_display_header_read_config(); @@ -501,7 +501,7 @@ void app_will_exit(GtkWidget *widget, gpointer data) main_window_get_size(mainwin); main_window_get_position(mainwin); prefs_common_write_config(); - prefs_filter_write_config(); + filter_write_config(); account_write_config_all(); addressbook_export_to_file(); diff --git a/src/prefs_filter.c b/src/prefs_filter.c index 9ef63daa..fbda86ac 100644 --- a/src/prefs_filter.c +++ b/src/prefs_filter.c @@ -360,47 +360,6 @@ static void prefs_filter_create(void) rule_list_window.msg_hdr_table = NULL; } -void prefs_filter_read_config(void) -{ - gchar *rcpath; - GNode *node; - FilterRule *rule; - - debug_print("Reading filter configuration...\n"); - - /* remove all previous filter list */ - while (prefs_common.fltlist != NULL) { - rule = (FilterRule *)prefs_common.fltlist->data; - filter_rule_free(rule); - prefs_common.fltlist = g_slist_remove(prefs_common.fltlist, - rule); - } - - rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, FILTER_LIST, - NULL); - if (!is_file_exist(rcpath)) { - g_free(rcpath); - return; - } - - node = xml_parse_file(rcpath); - if (!node) { - g_warning("Can't parse %s\n", rcpath); - g_free(rcpath); - return; - } - g_free(rcpath); - - prefs_common.fltlist = filter_xml_node_to_filter_list(node); - - xml_free_tree(node); -} - -void prefs_filter_write_config(void) -{ - filter_write_config(prefs_common.fltlist); -} - void prefs_filter_rename_path(const gchar *old_path, const gchar *new_path) { GSList *cur; @@ -413,7 +372,7 @@ void prefs_filter_rename_path(const gchar *old_path, const gchar *new_path) filter_rule_rename_dest_path(rule, old_path, new_path); } - filter_write_config(prefs_common.fltlist); + filter_write_config(); } void prefs_filter_delete_path(const gchar *path) @@ -435,7 +394,7 @@ void prefs_filter_delete_path(const gchar *path) } } - filter_write_config(prefs_common.fltlist); + filter_write_config(); } static void prefs_filter_set_dialog(void) @@ -900,7 +859,7 @@ static void prefs_filter_close(void) prefs_filter_set_msg_header_list(NULL); prefs_filter_write_user_header_list(); prefs_filter_set_list(); - filter_write_config(prefs_common.fltlist); + filter_write_config(); gtk_widget_hide(rule_list_window.window); gtk_list_store_clear(rule_list_window.store); inc_unlock(); diff --git a/src/prefs_filter.h b/src/prefs_filter.h index e99c4f7f..157782ab 100644 --- a/src/prefs_filter.h +++ b/src/prefs_filter.h @@ -37,9 +37,6 @@ typedef enum #include "procmsg.h" -void prefs_filter_read_config (void); -void prefs_filter_write_config (void); - void prefs_filter_open (MsgInfo *msginfo, const gchar *header); |