*
* 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
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
*/
#ifdef HAVE_CONFIG_H
#include "filtering.h"
enum {
- ACCOUNT_IS_DEFAULT, /* GDK_TYPE_PIXMAP! */
+ ACCOUNT_IS_DEFAULT,
ACCOUNT_ENABLE_GET_ALL,
ACCOUNT_NAME,
ACCOUNT_PROTOCOL,
GtkWidget *close_btn;
} edit_account;
-static GdkPixbuf *mark_pixbuf;
-
static void account_edit_create (void);
static void account_destroy (PrefsAccount *ac_prefs);
static void account_set_as_default (PrefsAccount *ac_prefs);
gpointer data);
static void account_size_allocate_cb(GtkWidget *widget,
GtkAllocation *allocation);
+#ifndef MAEMO
static gboolean account_key_pressed (GtkWidget *widget,
GdkEventKey *event,
gpointer data);
-
+#endif
+static gboolean account_search_func_cb (GtkTreeModel *model, gint column,
+ const gchar *key, GtkTreeIter *iter,
+ gpointer search_data);
static void account_list_view_add (PrefsAccount *ac_prefs);
static void account_list_view_set (void);
PrefsAccount *account_data);
static GtkWidget *account_list_view_create (void);
-static void account_create_list_view_images (GtkWidget *list_view);
static void account_create_list_view_columns (GtkWidget *list_view);
static gint account_list_view_get_selected_account_id (GtkWidget *list_view);
gpointer arg3,
GtkTreeView *list_view);
-void account_flush_state(void)
+static void account_flush_state(void)
{
account_set_menu();
main_window_reflect_prefs_all();
* account_find_from_address:
* @address: Email address string.
*
- * Find a mail (not news) account with the specified email address.
+ * Find a mail (not news if newsgroups_ok is FALSE) account with the specified email address.
*
* Return value: The found account, or NULL if not found.
*/
-PrefsAccount *account_find_from_address(const gchar *address)
+PrefsAccount *account_find_from_address(const gchar *address, gboolean newsgroups_ok)
{
GList *cur;
PrefsAccount *ac;
for (cur = account_list; cur != NULL; cur = cur->next) {
ac = (PrefsAccount *)cur->data;
- if (ac->protocol != A_NNTP && ac->address &&
+ if ((ac->protocol != A_NNTP || newsgroups_ok) && ac->address &&
g_ascii_strcasecmp(address, ac->address) == 0)
return ac;
}
return account_list;
}
-void account_edit_open(void)
+void account_edit_open(gpointer a, gpointer b)
{
inc_lock();
if (!item) {
if (ac_prefs->folder)
item = FOLDER(ac_prefs->folder)->outbox;
+ if (!item)
+ item = folder_get_default_outbox_for_class(F_MH);
if (!item)
item = folder_get_default_outbox();
}
if (!item) {
if (ac_prefs->folder)
item = FOLDER(ac_prefs->folder)->draft;
+ if (!item)
+ item = folder_get_default_draft_for_class(F_MH);
if (!item)
item = folder_get_default_draft();
}
if (!item) {
if (ac_prefs->folder)
item = FOLDER(ac_prefs->folder)->queue;
+ if (!item)
+ item = folder_get_default_queue_for_class(F_MH);
if (!item)
item = folder_get_default_queue();
}
if (!item) {
if (ac_prefs->folder)
item = FOLDER(ac_prefs->folder)->trash;
+ if (!item)
+ item = folder_get_default_trash_for_class(F_MH);
if (!item)
item = folder_get_default_trash();
}
GtkWidget *default_btn;
- GtkWidget *hbbox;
+ GtkWidget *confirm_area;
GtkWidget *help_btn;
GtkWidget *close_btn;
label = gtk_label_new
(_("Using 'Get Mail' will retrieve messages from your Accounts "
- "in the order given, the checkbox in the 'G' column indicates "
- "which accounts will be included."));
+ "in the order given, the checkbox indicates which accounts "
+ "will be included. Bold text indicates the default account."));
gtk_widget_show (label);
+ gtk_widget_set_size_request(GTK_WIDGET(label),
+ prefs_common.accountswin_width-8, -1);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4);
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- vbox2 = gtk_vbox_new(FALSE, 0);
- gtk_widget_show (vbox2);
- gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 0);
-
default_btn = gtk_button_new_with_mnemonic
(_(" _Set as default account "));
gtk_widget_show (default_btn);
- gtk_box_pack_start (GTK_BOX (vbox2), default_btn, TRUE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), default_btn, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT(default_btn), "clicked",
G_CALLBACK (account_set_default), NULL);
- hbbox = gtk_hbutton_box_new();
- gtk_button_box_set_layout(GTK_BUTTON_BOX(hbbox), GTK_BUTTONBOX_END);
- gtk_box_set_spacing(GTK_BOX(hbbox), 5);
-
- gtkut_stock_button_set_create_with_help(&hbbox, &help_btn,
+ gtkut_stock_button_set_create_with_help(&confirm_area, &help_btn,
&close_btn, GTK_STOCK_CLOSE,
NULL, NULL, NULL, NULL);
- gtk_widget_show(hbbox);
+ gtk_widget_show(confirm_area);
- gtk_box_pack_end (GTK_BOX (hbox), hbbox, FALSE, FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (hbox), confirm_area, FALSE, FALSE, 0);
gtk_widget_grab_default (close_btn);
g_signal_connect (G_OBJECT (close_btn), "clicked",
G_CALLBACK(manual_open_with_anchor_cb),
MANUAL_ANCHOR_ACCOUNTPREFS);
- account_create_list_view_images(list_view);
g_signal_connect(G_OBJECT(window), "size_allocate",
G_CALLBACK(account_size_allocate_cb), NULL);
ACP_FASSIGN(use_mail_command);
ACP_FDUP(mail_command);
-#if USE_OPENSSL
ACP_FASSIGN(ssl_pop);
ACP_FASSIGN(ssl_imap);
ACP_FASSIGN(ssl_nntp);
ACP_FASSIGN(ssl_smtp);
ACP_FASSIGN(use_nonblocking_ssl);
-#endif /* USE_OPENSSL */
- ac_clon->tmp_pass = NULL;
-
/* receive */
+ ACP_FASSIGN(use_apop_auth);
ACP_FASSIGN(rmmail);
ACP_FASSIGN(msg_leave_time);
- ACP_FASSIGN(getall);
+ ACP_FASSIGN(msg_leave_hour);
ACP_FASSIGN(recv_at_getall);
ACP_FASSIGN(sd_rmmail_on_download);
- ACP_FASSIGN(sd_filter_on_recv);
ACP_FASSIGN(enable_size_limit);
ACP_FASSIGN(size_limit);
ACP_FASSIGN(filter_on_recv);
+ ACP_FASSIGN(filterhook_on_recv);
ACP_FDUP(inbox);
+ ACP_FDUP(local_inbox);
ACP_FASSIGN(max_articles);
ACP_FASSIGN(imap_auth_type);
ACP_FDUP(smtp_userid);
ACP_FDUP(smtp_passwd);
- ac_clon->tmp_smtp_pass = NULL;
-
ACP_FASSIGN(pop_before_smtp);
ACP_FASSIGN(pop_before_smtp_timeout);
ACP_FASSIGN(last_pop_login_time);
ACP_FDUP(auto_bcc);
ACP_FASSIGN(set_autoreplyto);
ACP_FDUP(auto_replyto);
+ ACP_FASSIGN(enable_default_dictionary);
+ ACP_FDUP(default_dictionary);
+ ACP_FASSIGN(enable_default_alt_dictionary);
+ ACP_FDUP(default_alt_dictionary);
+ ACP_FASSIGN(compose_with_format);
+ ACP_FDUP(compose_subject_format);
+ ACP_FDUP(compose_body_format);
+ ACP_FASSIGN(reply_with_format);
+ ACP_FDUP(reply_quotemark);
+ ACP_FDUP(reply_body_format);
+ ACP_FASSIGN(forward_with_format);
+ ACP_FDUP(forward_quotemark);
+ ACP_FDUP(forward_body_format);
/* privacy */
+ ACP_FDUP(default_privacy_system);
ACP_FASSIGN(default_encrypt);
+ ACP_FASSIGN(default_encrypt_reply);
ACP_FASSIGN(default_sign);
+ ACP_FASSIGN(default_sign_reply);
+ ACP_FASSIGN(save_encrypted_as_clear_text);
+ ACP_FASSIGN(encrypt_to_self);
/* advanced */
ACP_FASSIGN(set_smtpport);
ACP_FASSIGN(mark_crosspost_read);
ACP_FASSIGN(crosspost_col);
+#ifndef G_OS_WIN32
ACP_FASSIGN(set_tunnelcmd);
ACP_FDUP(tunnelcmd);
+#endif
ACP_FDUP(imap_dir);
+ ACP_FASSIGN(imap_subsonly);
+ ACP_FASSIGN(low_bandwidth);
ACP_FASSIGN(set_sent_folder);
ACP_FDUP(sent_folder);
+ ACP_FASSIGN(set_queue_folder);
+ ACP_FDUP(queue_folder);
ACP_FASSIGN(set_draft_folder);
ACP_FDUP(draft_folder);
ACP_FASSIGN(set_trash_folder);
account_edit_close(NULL, NULL);
return TRUE;
}
-
+#ifndef MAEMO
static gboolean account_key_pressed(GtkWidget *widget, GdkEventKey *event,
gpointer data)
{
account_edit_close(NULL, NULL);
return FALSE;
}
+#endif
+
+static gboolean account_search_func_cb (GtkTreeModel *model, gint column, const gchar *key,
+ GtkTreeIter *iter, gpointer search_data)
+{
+ gboolean retval;
+ PrefsAccount *ac;
+
+ gtk_tree_model_get (model, iter, ACCOUNT_DATA, &ac, -1);
+ if (!ac->name || !key) return FALSE;
+
+ retval = (strncmp (key, ac->account_name, strlen(key)) != 0);
+
+ debug_print("selecting row\n");
+ account_list_view_select_account(edit_account.list_view, ac->account_id);
+
+ return retval;
+}
static void account_list_view_add(PrefsAccount *ac_prefs)
{
GtkTreeView *list_view = GTK_TREE_VIEW(edit_account.list_view);
gboolean getall;
name = ac_prefs->account_name;
-#if USE_OPENSSL
+#if (defined(USE_OPENSSL) || defined (USE_GNUTLS))
protocol = ac_prefs->protocol == A_POP3 ?
(ac_prefs->ssl_pop == SSL_TUNNEL ?
"POP3 (SSL)" :
ac_prefs->protocol == A_NNTP ?
(ac_prefs->ssl_nntp == SSL_TUNNEL ?
"NNTP (SSL)" : "NNTP") :
- "";
+ ac_prefs->protocol == A_LOCAL ? "Local" :
+ ac_prefs->protocol == A_NONE ? "SMTP" : "-";
#else
protocol = ac_prefs->protocol == A_POP3 ? "POP3" :
ac_prefs->protocol == A_IMAP4 ? "IMAP4" :
ac_prefs->protocol == A_LOCAL ? "Local" :
- ac_prefs->protocol == A_NNTP ? "NNTP" : "";
+ ac_prefs->protocol == A_NNTP ? "NNTP" :
+ ac_prefs->protocol == A_NONE ? "SMTP" : "-";
#endif
- server= ac_prefs->protocol == A_NNTP
- ? ac_prefs->nntp_server : ac_prefs->recv_server;
+ server= ac_prefs->protocol == A_NNTP ? ac_prefs->nntp_server :
+ ac_prefs->protocol == A_LOCAL ? "-" :
+ ac_prefs->protocol == A_NONE ? ac_prefs->smtp_server :
+ ac_prefs->recv_server;
has_getallbox = (ac_prefs->protocol == A_POP3 ||
ac_prefs->protocol == A_IMAP4 ||
if (!strchr(field, ',')) {
Xstrdup_a(to, field, return NULL);
extract_address(to);
- account = account_find_from_address(to);
+ account = account_find_from_address(to, FALSE);
} else {
gchar **split = g_strsplit(field, ",", -1);
int i = -1;
break;
Xstrdup_a(to, split[i], return NULL);
extract_address(to);
- account = account_find_from_address(to);
+ account = account_find_from_address(to, FALSE);
} while (!account);
g_strfreev(split);
}
(msginfo, deliveredto,sizeof deliveredto , "Delivered-To:")) {
gchar *buf = deliveredto + strlen("Delivered-To:");
extract_address(buf);
- account = account_find_from_address(buf);
+ account = account_find_from_address(buf, FALSE);
}
}
}
static GtkListStore* account_create_data_store(void)
{
return gtk_list_store_new(N_ACCOUNT_COLUMNS,
- GDK_TYPE_PIXBUF, /* ACCOUNT_IS_DEFAULT */
+ G_TYPE_INT, /* ACCOUNT_IS_DEFAULT */
G_TYPE_BOOLEAN, /* ACCOUNT_ENABLE_GET_ALL */
G_TYPE_STRING, /* ACCOUNT_NAME */
G_TYPE_STRING, /* ACCOUNT_PROTOCOL */
gtk_list_store_append(list_store, &iter);
gtk_list_store_set(list_store, &iter,
- ACCOUNT_IS_DEFAULT, is_default ? mark_pixbuf : NULL,
+ ACCOUNT_IS_DEFAULT, is_default ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
ACCOUNT_ENABLE_GET_ALL, is_get_all,
ACCOUNT_NAME, account_name,
ACCOUNT_PROTOCOL, protocol,
/*!
*\brief Create and set up account list view, including tasks like
* creating the data store (\ref account_create_data_store()),
- * creating images for the list view (\ref account_create_list_view_images()),
* and setting up the account list's individual columns (\ref
* account_create_list_view_columns()).
*
list_view = GTK_TREE_VIEW(gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)));
g_object_unref(G_OBJECT(store));
-
+#ifdef GENERIC_UMPC
+ g_object_set(list_view, "allow-checkbox-mode", FALSE, NULL);
+#endif
gtk_tree_view_set_rules_hint(list_view, prefs_common.use_stripes_everywhere);
gtk_tree_view_set_reorderable(list_view, TRUE);
return GTK_WIDGET(list_view);
}
-static void account_create_list_view_images(GtkWidget *list_view)
-{
- stock_pixbuf_gdk(list_view, STOCK_PIXMAP_MARK, &mark_pixbuf);
-}
-
static void account_create_list_view_columns(GtkWidget *list_view)
{
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
- GtkTooltips *tooltips = gtk_tooltips_new();
-
- renderer = gtk_cell_renderer_pixbuf_new();
- column = gtk_tree_view_column_new_with_attributes
- (Q_("Accounts List Default Column Name|D"), renderer,
- "pixbuf", ACCOUNT_IS_DEFAULT,
- NULL);
- gtk_tree_view_append_column(GTK_TREE_VIEW(list_view), column);
- gtk_tree_view_column_set_alignment (column, 0.5);
- gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips), column->button,
- _("Default account"), NULL);
+ CLAWS_TIP_DECL();
renderer = gtk_cell_renderer_toggle_new();
g_object_set(renderer,
NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(list_view), column);
gtk_tree_view_column_set_alignment (column, 0.5);
- gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips), column->button,
- _("'Get Mail' retrieves mail from the checked accounts"), NULL);
+ CLAWS_SET_TIP(column->button,
+ _("'Get Mail' retrieves mail from the checked accounts"));
g_signal_connect(G_OBJECT(renderer), "toggled",
G_CALLBACK(account_get_all_toggled),
list_view);
column = gtk_tree_view_column_new_with_attributes
(_("Name"), renderer,
"text", ACCOUNT_NAME,
+ "weight", ACCOUNT_IS_DEFAULT,
NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(list_view), column);
column = gtk_tree_view_column_new_with_attributes
(_("Protocol"), renderer,
"text", ACCOUNT_PROTOCOL,
+ "weight", ACCOUNT_IS_DEFAULT,
NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(list_view), column);
column = gtk_tree_view_column_new_with_attributes
(_("Server"), renderer,
"text", ACCOUNT_SERVER,
+ "weight", ACCOUNT_IS_DEFAULT,
NULL);
+ gtk_tree_view_set_search_column(GTK_TREE_VIEW(list_view), ACCOUNT_NAME);
+ gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(list_view), account_search_func_cb , NULL, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(list_view), column);
}
gint *account_id)
{
PrefsAccount *account = NULL;
- GdkPixbuf *pixbuf;
+ PangoWeight weight;
gtk_tree_model_get(model, iter,
ACCOUNT_DATA, &account,
-1);
if (*account_id == account->account_id)
- pixbuf = NULL;
+ weight = PANGO_WEIGHT_NORMAL;
else
- pixbuf = mark_pixbuf;
-
+ weight = PANGO_WEIGHT_BOLD;
+
gtk_list_store_set(GTK_LIST_STORE(model), iter,
- ACCOUNT_IS_DEFAULT, pixbuf,
- -1);
+ ACCOUNT_IS_DEFAULT, weight, -1);
return FALSE;
}
{
account_list_set();
}
+
+gchar *account_get_signature_str(PrefsAccount *account)
+{
+ gchar *sig_body = NULL;
+ gchar *sig_str = NULL;
+ gchar *utf8_sig_str = NULL;
+
+ g_return_val_if_fail(account != NULL, NULL);
+
+ if (!account->sig_path)
+ return NULL;
+
+ if (account->sig_type == SIG_FILE) {
+ if (!is_file_or_fifo_exist(account->sig_path)) {
+ g_warning("can't open signature file: %s\n",
+ account->sig_path);
+ return NULL;
+ }
+ }
+
+ if (account->sig_type == SIG_COMMAND)
+ sig_body = get_command_output(account->sig_path);
+ else {
+ gchar *tmp;
+
+ tmp = file_read_to_str(account->sig_path);
+ if (!tmp)
+ return NULL;
+ sig_body = normalize_newlines(tmp);
+ g_free(tmp);
+ }
+
+ if (account->sig_sep) {
+ sig_str = g_strconcat("\n", account->sig_sep, "\n", sig_body,
+ NULL);
+ g_free(sig_body);
+ } else
+ sig_str = g_strconcat("\n", sig_body, NULL);
+
+ if (sig_str) {
+ if (g_utf8_validate(sig_str, -1, NULL) == TRUE)
+ utf8_sig_str = sig_str;
+ else {
+ utf8_sig_str = conv_codeset_strdup
+ (sig_str, conv_get_locale_charset_str_no_utf8(),
+ CS_INTERNAL);
+ g_free(sig_str);
+ }
+ }
+
+ return utf8_sig_str;
+}