aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--ChangeLog.ja6
-rw-r--r--src/prefs_filter_edit.c46
-rw-r--r--src/prefs_filter_edit.h3
-rw-r--r--src/summary_search.c24
5 files changed, 49 insertions, 36 deletions
diff --git a/ChangeLog b/ChangeLog
index 3b5eeefe..79eaaedf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-01-06
+
+ * src/summary_search.c
+ src/prefs_filter_edit.[ch]: prefs_filter_edit_cond_edit_to_list():
+ added for minor code cleanup.
+
2006-01-05
* src/textview.c: textview_make_clickable_parts(): add http:// scheme
diff --git a/ChangeLog.ja b/ChangeLog.ja
index f3dd0612..d0afd746 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,3 +1,9 @@
+2006-01-06
+
+ * src/summary_search.c
+ src/prefs_filter_edit.[ch]: prefs_filter_edit_cond_edit_to_list():
+ コードの整理のために追加。
+
2006-01-05
* src/textview.c: textview_make_clickable_parts(): 'www.' で始まる
diff --git a/src/prefs_filter_edit.c b/src/prefs_filter_edit.c
index af804aed..dc5ba156 100644
--- a/src/prefs_filter_edit.c
+++ b/src/prefs_filter_edit.c
@@ -1775,6 +1775,33 @@ FilterAction *prefs_filter_edit_action_hbox_to_action(ActionHBox *hbox,
return action;
}
+GSList *prefs_filter_edit_cond_edit_to_list(FilterCondEdit *cond_edit,
+ gboolean case_sens)
+{
+ GSList *cur;
+ FilterCond *cond;
+ GSList *cond_list = NULL;
+
+ for (cur = cond_edit->cond_hbox_list; cur != NULL; cur = cur->next) {
+ CondHBox *hbox = (CondHBox *)cur->data;
+ gchar *error_msg;
+
+ cond = prefs_filter_edit_cond_hbox_to_cond(hbox, case_sens,
+ &error_msg);
+ if (cond) {
+ cond_list = g_slist_append(cond_list, cond);
+ } else {
+ if (!error_msg)
+ error_msg = _("Invalid condition exists.");
+ alertpanel_error("%s", error_msg);
+ filter_cond_list_free(cond_list);
+ return NULL;
+ }
+ }
+
+ return cond_list;
+}
+
static FilterRule *prefs_filter_edit_dialog_to_rule(void)
{
FilterRule *rule = NULL;
@@ -1798,21 +1825,10 @@ static FilterRule *prefs_filter_edit_dialog_to_rule(void)
bool_op = GPOINTER_TO_INT
(g_object_get_data(G_OBJECT(bool_op_menuitem), MENU_VAL_ID));
- for (cur = rule_edit_window.cond_edit.cond_hbox_list; cur != NULL;
- cur = cur->next) {
- CondHBox *hbox = (CondHBox *)cur->data;
- FilterCond *cond;
-
- cond = prefs_filter_edit_cond_hbox_to_cond(hbox, FALSE,
- &error_msg);
- if (cond)
- cond_list = g_slist_append(cond_list, cond);
- else {
- if (!error_msg)
- error_msg = _("Invalid condition exists.");
- goto error;
- }
- }
+ cond_list = prefs_filter_edit_cond_edit_to_list
+ (&rule_edit_window.cond_edit, FALSE);
+ if (!cond_list)
+ return NULL;
for (cur = rule_edit_window.action_hbox_list; cur != NULL;
cur = cur->next) {
diff --git a/src/prefs_filter_edit.h b/src/prefs_filter_edit.h
index dbc967f3..c9145c48 100644
--- a/src/prefs_filter_edit.h
+++ b/src/prefs_filter_edit.h
@@ -170,4 +170,7 @@ FilterCond *prefs_filter_edit_cond_hbox_to_cond (CondHBox *hbox,
gboolean case_sens,
gchar **error_msg);
+GSList *prefs_filter_edit_cond_edit_to_list (FilterCondEdit *cond_edit,
+ gboolean case_sens);
+
#endif /* __PREFS_FILTER_EDIT_H__ */
diff --git a/src/summary_search.c b/src/summary_search.c
index 670a1b29..d3f80022 100644
--- a/src/summary_search.c
+++ b/src/summary_search.c
@@ -433,10 +433,8 @@ static FilterRule *summary_search_dialog_to_rule(const gchar *name,
FilterBoolOp bool_op = FLT_OR;
gboolean recursive;
gboolean case_sens;
- GSList *cond_list = NULL;
- FilterCond *cond;
+ GSList *cond_list;
FilterRule *rule;
- GSList *cur;
id = gtk_entry_get_text(GTK_ENTRY(search_window.folder_entry));
item_ = folder_find_item_from_identifier(id);
@@ -452,24 +450,8 @@ static FilterRule *summary_search_dialog_to_rule(const gchar *name,
case_sens = gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON(search_window.case_checkbtn));
- for (cur = search_window.cond_edit->cond_hbox_list; cur != NULL;
- cur = cur->next) {
- CondHBox *hbox = (CondHBox *)cur->data;
- gchar *error_msg;
-
- cond = prefs_filter_edit_cond_hbox_to_cond(hbox, case_sens,
- &error_msg);
- if (cond) {
- cond_list = g_slist_append(cond_list, cond);
- } else {
- if (!error_msg)
- error_msg = _("Invalid condition exists.");
- alertpanel_error("%s", error_msg);
- filter_cond_list_free(cond_list);
- return NULL;
- }
- }
-
+ cond_list = prefs_filter_edit_cond_edit_to_list(search_window.cond_edit,
+ case_sens);
if (!cond_list)
return NULL;