aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2008-09-26 06:11:11 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2008-09-26 06:11:11 +0000
commit2569f2416f350e29ff414671b74f2524fa883113 (patch)
tree73665a52ff8ae74186082d7733374f88a3495522 /src
parentf8c3b6a8f6f9bf86ea02fb8220d24cccf6520869 (diff)
use target header field as a default filter name when creating filter rule automatically.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2042 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.c4
-rw-r--r--src/messageview.c4
-rw-r--r--src/prefs_filter.c12
-rw-r--r--src/prefs_filter.h5
-rw-r--r--src/prefs_filter_edit.c16
-rw-r--r--src/prefs_filter_edit.h5
-rw-r--r--src/summaryview.c4
7 files changed, 29 insertions, 21 deletions
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 3b8b3c28..3cc44601 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2008 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
@@ -3822,7 +3822,7 @@ static void prefs_common_open_cb(MainWindow *mainwin, guint action,
static void prefs_filter_open_cb(MainWindow *mainwin, guint action,
GtkWidget *widget)
{
- prefs_filter_open(NULL, NULL);
+ prefs_filter_open(NULL, NULL, NULL);
}
static void prefs_template_open_cb(MainWindow *mainwin, guint action,
diff --git a/src/messageview.c b/src/messageview.c
index 828c442b..fb312338 100644
--- a/src/messageview.c
+++ b/src/messageview.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2008 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
@@ -1010,7 +1010,7 @@ static void create_filter_cb(gpointer data, guint action, GtkWidget *widget)
filter_get_keyword_from_msg(messageview->msginfo, &header, &key,
(FilterCreateType)action);
- prefs_filter_open(messageview->msginfo, header);
+ prefs_filter_open(messageview->msginfo, header, key);
g_free(header);
g_free(key);
diff --git a/src/prefs_filter.c b/src/prefs_filter.c
index a8ca55c9..59a20acb 100644
--- a/src/prefs_filter.c
+++ b/src/prefs_filter.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2008 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
@@ -126,7 +126,7 @@ static gboolean prefs_filter_key_pressed(GtkWidget *widget,
static void prefs_filter_close (void);
-void prefs_filter_open(MsgInfo *msginfo, const gchar *header)
+void prefs_filter_open(MsgInfo *msginfo, const gchar *header, const gchar *key)
{
inc_lock();
@@ -146,7 +146,7 @@ void prefs_filter_open(MsgInfo *msginfo, const gchar *header)
if (msginfo) {
FilterRule *rule;
- rule = prefs_filter_edit_open(NULL, header);
+ rule = prefs_filter_edit_open(NULL, header, key);
gtk_window_present(GTK_WINDOW(rule_list_window.window));
if (rule) {
@@ -614,7 +614,7 @@ static void prefs_filter_add_cb(void)
{
FilterRule *rule;
- rule = prefs_filter_edit_open(NULL, NULL);
+ rule = prefs_filter_edit_open(NULL, NULL, NULL);
gtk_window_present(GTK_WINDOW(rule_list_window.window));
if (rule) {
@@ -636,7 +636,7 @@ static void prefs_filter_edit_cb(void)
COL_FILTER_RULE, &rule, -1);
g_return_if_fail(rule != NULL);
- new_rule = prefs_filter_edit_open(rule, NULL);
+ new_rule = prefs_filter_edit_open(rule, NULL, NULL);
gtk_window_present(GTK_WINDOW(rule_list_window.window));
if (new_rule) {
@@ -658,7 +658,7 @@ static void prefs_filter_copy_cb(void)
COL_FILTER_RULE, &rule, -1);
g_return_if_fail(rule != NULL);
- new_rule = prefs_filter_edit_open(rule, NULL);
+ new_rule = prefs_filter_edit_open(rule, NULL, NULL);
gtk_window_present(GTK_WINDOW(rule_list_window.window));
if (new_rule) {
diff --git a/src/prefs_filter.h b/src/prefs_filter.h
index 72b311ad..0c9aded8 100644
--- a/src/prefs_filter.h
+++ b/src/prefs_filter.h
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2008 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
@@ -29,7 +29,8 @@
#include "procmsg.h"
void prefs_filter_open (MsgInfo *msginfo,
- const gchar *header);
+ const gchar *header,
+ const gchar *key);
GSList *prefs_filter_get_header_list (void);
GSList *prefs_filter_get_user_header_list (void);
diff --git a/src/prefs_filter_edit.c b/src/prefs_filter_edit.c
index 97601e05..dbdc5462 100644
--- a/src/prefs_filter_edit.c
+++ b/src/prefs_filter_edit.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2008 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
@@ -81,7 +81,8 @@ static struct FilterEditHeaderListDialog {
static void prefs_filter_edit_create (void);
static void prefs_filter_edit_clear (void);
-static void prefs_filter_edit_rule_to_dialog (FilterRule *rule);
+static void prefs_filter_edit_rule_to_dialog (FilterRule *rule,
+ const gchar *default_name);
static void prefs_filter_edit_update_header_list(FilterCondEdit *cond_list);
static void prefs_filter_edit_set_action_hbox_menu_sensitive
@@ -144,7 +145,8 @@ static void prefs_filter_action_add_cb (GtkWidget *widget,
gpointer data);
-FilterRule *prefs_filter_edit_open(FilterRule *rule, const gchar *header)
+FilterRule *prefs_filter_edit_open(FilterRule *rule, const gchar *header,
+ const gchar *key)
{
static gboolean lock = FALSE;
FilterRule *new_rule;
@@ -160,7 +162,7 @@ FilterRule *prefs_filter_edit_open(FilterRule *rule, const gchar *header)
manage_window_set_transient(GTK_WINDOW(rule_edit_window.window));
prefs_filter_edit_set_header_list(&rule_edit_window.cond_edit, rule);
- prefs_filter_edit_rule_to_dialog(rule);
+ prefs_filter_edit_rule_to_dialog(rule, key);
if (header)
prefs_filter_edit_activate_cond_header
(&rule_edit_window.cond_edit, header);
@@ -362,7 +364,8 @@ static void prefs_filter_edit_clear(void)
}
}
-static void prefs_filter_edit_rule_to_dialog(FilterRule *rule)
+static void prefs_filter_edit_rule_to_dialog(FilterRule *rule,
+ const gchar *default_name)
{
gint index = 0;
static gint count = 1;
@@ -370,6 +373,9 @@ static void prefs_filter_edit_rule_to_dialog(FilterRule *rule)
if (rule && rule->name)
gtk_entry_set_text(GTK_ENTRY(rule_edit_window.name_entry),
rule->name);
+ else if (default_name)
+ gtk_entry_set_text(GTK_ENTRY(rule_edit_window.name_entry),
+ default_name);
else {
gchar rule_name[32];
g_snprintf(rule_name, sizeof(rule_name), "Rule %d", count++);
diff --git a/src/prefs_filter_edit.h b/src/prefs_filter_edit.h
index fab27d18..7fdf2037 100644
--- a/src/prefs_filter_edit.h
+++ b/src/prefs_filter_edit.h
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2008 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
@@ -147,7 +147,8 @@ struct _ActionHBox {
FilterRule *prefs_filter_edit_open (FilterRule *rule,
- const gchar *header);
+ const gchar *header,
+ const gchar *key);
FilterCondEdit *prefs_filter_edit_cond_edit_create (void);
void prefs_filter_edit_clear_cond_edit (FilterCondEdit *cond_edit);
diff --git a/src/summaryview.c b/src/summaryview.c
index 2d222993..0239b78d 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2008 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
@@ -4616,7 +4616,7 @@ void summary_filter_open(SummaryView *summaryview, FilterCreateType type)
if (!msginfo) return;
filter_get_keyword_from_msg(msginfo, &header, &key, type);
- prefs_filter_open(msginfo, header);
+ prefs_filter_open(msginfo, header, key);
g_free(header);
g_free(key);