[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-298-gc7452669c
paul at claws-mail.org
paul at claws-mail.org
Mon Oct 4 13:51:28 CEST 2021
The branch, gtk3 has been updated
via c7452669c0da537cb3382c9e55aae142d34d90c4 (commit)
from 9d59312477b1eab5e68a727cdb44d870a110190f (commit)
Summary of changes:
src/compose.c | 4 ++++
src/folder_item_prefs.c | 13 +++++++++++--
src/folder_item_prefs.h | 6 ++++--
src/prefs_folder_item.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
4 files changed, 64 insertions(+), 5 deletions(-)
- Log -----------------------------------------------------------------
commit c7452669c0da537cb3382c9e55aae142d34d90c4
Author: paul <paul at claws-mail.org>
Date: Mon Oct 4 12:51:25 2021 +0100
add 'Default From:' to folder prefs
diff --git a/src/compose.c b/src/compose.c
index 52c6dd742..4358eff0b 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -3278,6 +3278,10 @@ static void compose_set_folder_prefs(Compose *compose, FolderItem *folder,
if (!folder || !folder->prefs)
return;
+ if (folder->prefs->enable_default_from) {
+ gtk_entry_set_text(GTK_ENTRY(compose->from_name), folder->prefs->default_from);
+ compose_entry_indicate(compose, folder->prefs->default_from);
+ }
if (respect_default_to && folder->prefs->enable_default_to) {
compose_entry_append(compose, folder->prefs->default_to,
COMPOSE_TO, PREF_FOLDER);
diff --git a/src/folder_item_prefs.c b/src/folder_item_prefs.c
index edc4e248d..122b22409 100644
--- a/src/folder_item_prefs.c
+++ b/src/folder_item_prefs.c
@@ -1,6 +1,6 @@
/*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2021 the Claws Mail team and 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
@@ -36,6 +36,10 @@
FolderItemPrefs tmp_prefs;
static PrefParam param[] = {
+ {"enable_default_from", "", &tmp_prefs.enable_default_from, P_BOOL,
+ NULL, NULL, NULL},
+ {"default_from", "", &tmp_prefs.default_from, P_STRING,
+ NULL, NULL, NULL},
{"enable_default_to", "", &tmp_prefs.enable_default_to, P_BOOL,
NULL, NULL, NULL},
{"default_to", "", &tmp_prefs.default_to, P_STRING,
@@ -187,6 +191,8 @@ void folder_prefs_save_config_recursive(Folder *folder)
static FolderItemPrefs *folder_item_prefs_clear(FolderItemPrefs *prefs)
{
+ prefs->enable_default_from = FALSE;
+ prefs->default_from = NULL;
prefs->enable_default_to = FALSE;
prefs->default_to = NULL;
prefs->enable_default_reply_to = FALSE;
@@ -254,6 +260,7 @@ FolderItemPrefs * folder_item_prefs_new(void)
void folder_item_prefs_free(FolderItemPrefs * prefs)
{
+ g_free(prefs->default_from);
g_free(prefs->default_to);
g_free(prefs->default_reply_to);
g_free(prefs->default_cc);
@@ -301,6 +308,8 @@ void folder_item_prefs_copy_prefs(FolderItem * src, FolderItem * dest)
tmp_prefs.processing = tmp_prop_list;
tmp_prefs.request_return_receipt = src->prefs->request_return_receipt;
+ tmp_prefs.enable_default_from = src->prefs->enable_default_from;
+ tmp_prefs.default_from = g_strdup(src->prefs->default_from);
tmp_prefs.enable_default_to = src->prefs->enable_default_to;
tmp_prefs.default_to = g_strdup(src->prefs->default_to);
tmp_prefs.enable_default_reply_to = src->prefs->enable_default_reply_to;
diff --git a/src/folder_item_prefs.h b/src/folder_item_prefs.h
index 6f9cac114..8b72e1d0b 100644
--- a/src/folder_item_prefs.h
+++ b/src/folder_item_prefs.h
@@ -1,6 +1,6 @@
/*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2021 the Claws Mail team and 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
@@ -54,6 +54,8 @@ struct _FolderItemPrefs {
gboolean skip_on_goto_unread_or_new;
gboolean request_return_receipt;
+ gboolean enable_default_from;
+ gchar *default_from;
gboolean enable_default_to;
gchar *default_to;
gboolean enable_default_reply_to;
diff --git a/src/prefs_folder_item.c b/src/prefs_folder_item.c
index c79675f65..c3e720041 100644
--- a/src/prefs_folder_item.c
+++ b/src/prefs_folder_item.c
@@ -116,6 +116,8 @@ struct _FolderItemComposePage
GtkWidget *no_save_warning;
GtkWidget *checkbtn_request_return_receipt;
GtkWidget *checkbtn_save_copy_to_folder;
+ GtkWidget *checkbtn_default_from;
+ GtkWidget *entry_default_from;
GtkWidget *checkbtn_default_to;
GtkWidget *entry_default_to;
GtkWidget *checkbtn_default_reply_to;
@@ -140,6 +142,7 @@ struct _FolderItemComposePage
/* apply to sub folders */
GtkWidget *request_return_receipt_rec_checkbtn;
GtkWidget *save_copy_to_folder_rec_checkbtn;
+ GtkWidget *default_from_rec_checkbtn;
GtkWidget *default_to_rec_checkbtn;
GtkWidget *default_reply_to_rec_checkbtn;
GtkWidget *default_cc_rec_checkbtn;
@@ -863,6 +866,8 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
GtkWidget *no_save_warning = NULL;
GtkWidget *checkbtn_request_return_receipt = NULL;
GtkWidget *checkbtn_save_copy_to_folder = NULL;
+ GtkWidget *checkbtn_default_from = NULL;
+ GtkWidget *entry_default_from = NULL;
GtkWidget *checkbtn_default_to = NULL;
GtkWidget *entry_default_to = NULL;
GtkWidget *checkbtn_default_reply_to = NULL;
@@ -892,6 +897,7 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
GtkListStore *always_encrypt_menu;
GtkWidget *request_return_receipt_rec_checkbtn = NULL;
GtkWidget *save_copy_to_folder_rec_checkbtn = NULL;
+ GtkWidget *default_from_rec_checkbtn = NULL;
GtkWidget *default_to_rec_checkbtn = NULL;
GtkWidget *default_reply_to_rec_checkbtn = NULL;
GtkWidget *default_cc_rec_checkbtn = NULL;
@@ -954,6 +960,31 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
gtk_grid_attach(GTK_GRID(table), save_copy_to_folder_rec_checkbtn, 2, rowcount, 1, 1);
rowcount++;
+ /* Default From */
+ tr = g_strdup(C_("folder properties: %s stands for a header name",
+ "Default %s"));
+ text = g_strdup_printf(tr, prefs_common_translated_header_name("From:"));
+ checkbtn_default_from = gtk_check_button_new_with_label(text);
+ gtk_grid_attach(GTK_GRID(table), checkbtn_default_from, 0, rowcount, 1, 1);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_from),
+ item->prefs->enable_default_from);
+ g_free(text);
+ g_free(tr);
+
+ entry_default_from = gtk_entry_new();
+ gtk_grid_attach(GTK_GRID(table), entry_default_from, 1, rowcount, 1, 1);
+ gtk_widget_set_hexpand(entry_default_from, TRUE);
+ gtk_widget_set_halign(entry_default_from, GTK_ALIGN_FILL);
+ SET_TOGGLE_SENSITIVITY(checkbtn_default_from, entry_default_from);
+ gtk_entry_set_text(GTK_ENTRY(entry_default_from), SAFE_STRING(item->prefs->default_from));
+ address_completion_register_entry(GTK_ENTRY(entry_default_from),
+ TRUE);
+
+ default_from_rec_checkbtn = gtk_check_button_new();
+ gtk_grid_attach(GTK_GRID(table), default_from_rec_checkbtn, 2, rowcount, 1, 1);
+
+ rowcount++;
+
/* Default To */
tr = g_strdup(C_("folder properties: %s stands for a header name",
"Default %s"));
@@ -1259,6 +1290,8 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
page->no_save_warning = no_save_warning;
page->checkbtn_request_return_receipt = checkbtn_request_return_receipt;
page->checkbtn_save_copy_to_folder = checkbtn_save_copy_to_folder;
+ page->checkbtn_default_from = checkbtn_default_from;
+ page->entry_default_from = entry_default_from;
page->checkbtn_default_to = checkbtn_default_to;
page->entry_default_to = entry_default_to;
page->checkbtn_default_reply_to = checkbtn_default_reply_to;
@@ -1282,6 +1315,7 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
page->request_return_receipt_rec_checkbtn = request_return_receipt_rec_checkbtn;
page->save_copy_to_folder_rec_checkbtn = save_copy_to_folder_rec_checkbtn;
+ page->default_from_rec_checkbtn = default_from_rec_checkbtn;
page->default_to_rec_checkbtn = default_to_rec_checkbtn;
page->default_reply_to_rec_checkbtn = default_reply_to_rec_checkbtn;
page->default_cc_rec_checkbtn = default_cc_rec_checkbtn;
@@ -1302,6 +1336,8 @@ static void prefs_folder_item_compose_destroy_widget_func(PrefsPage *page_)
{
FolderItemComposePage *page = (FolderItemComposePage *) page_;
+ if (page->entry_default_from)
+ address_completion_unregister_entry(GTK_ENTRY(page->entry_default_from));
if (page->entry_default_to)
address_completion_unregister_entry(GTK_ENTRY(page->entry_default_to));
if (page->entry_default_reply_to)
@@ -1346,8 +1382,14 @@ static void compose_save_folder_prefs(FolderItem *folder, FolderItemComposePage
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_save_copy_to_folder));
}
- if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_to_rec_checkbtn))) {
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_from_rec_checkbtn))) {
+ prefs->enable_default_from =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_default_from));
+ ASSIGN_STRING(prefs->default_from,
+ gtk_editable_get_chars(GTK_EDITABLE(page->entry_default_from), 0, -1));
+ }
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_to_rec_checkbtn))) {
prefs->enable_default_to =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_default_to));
ASSIGN_STRING(prefs->default_to,
@@ -1388,6 +1430,7 @@ static void compose_save_folder_prefs(FolderItem *folder, FolderItemComposePage
} else {
prefs->request_return_receipt = FALSE;
prefs->save_copy_to_folder = FALSE;
+ prefs->enable_default_from = FALSE;
prefs->enable_default_to = FALSE;
prefs->enable_default_reply_to = FALSE;
prefs->enable_default_cc = FALSE;
@@ -1448,6 +1491,7 @@ static gboolean compose_save_recurse_func(GNode *node, gpointer data)
if ((node == page->item->node) && item_protocol(item) != A_NNTP &&
!(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->request_return_receipt_rec_checkbtn)) ||
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->save_copy_to_folder_rec_checkbtn)) ||
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_from_rec_checkbtn)) ||
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_to_rec_checkbtn)) ||
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_account_rec_checkbtn)) ||
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_cc_rec_checkbtn)) ||
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list