[Commits] [SCM] claws branch, master, updated. 3.18.0-236-g4cf2d14f1

paul at claws-mail.org paul at claws-mail.org
Mon Oct 4 14:16:54 CEST 2021


The branch, master has been updated
       via  4cf2d14f1056a16445858e5ce070b2138ab7c5b3 (commit)
      from  6dea1d0af5a9539b0eaed5a71184416df7258f1a (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 | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
 4 files changed, 65 insertions(+), 6 deletions(-)


- Log -----------------------------------------------------------------
commit 4cf2d14f1056a16445858e5ce070b2138ab7c5b3
Author: Paul <paul at claws-mail.org>
Date:   Mon Oct 4 13:16:51 2021 +0100

    add 'Default From:' to folder prefs

diff --git a/src/compose.c b/src/compose.c
index 3db0f7780..94ef48696 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -3293,6 +3293,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 73d174e85..b8ae56bb7 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;
@@ -251,6 +257,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);
@@ -298,6 +305,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 2a1427ffb..be183da6b 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 a2cf2cc34..3375f306e 100644
--- a/src/prefs_folder_item.c
+++ b/src/prefs_folder_item.c
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2016 Hiroyuki Yamamoto and the Claws Mail team
+ * 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
@@ -117,6 +117,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;
@@ -141,6 +143,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;
@@ -857,6 +860,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;
@@ -886,6 +891,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;
@@ -958,6 +964,33 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
 
 		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_table_attach(GTK_TABLE(table), checkbtn_default_from, 0, 1, 
+				 rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+		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_table_attach(GTK_TABLE(table), entry_default_from, 1, 2,
+				 rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
+		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_table_attach(GTK_TABLE(table), default_from_rec_checkbtn, 2, 3, 
+				 rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+		rowcount++;
+
 		/* Default To */
 		tr = g_strdup(C_("folder properties: %s stands for a header name",
 				 	  "Default %s"));
@@ -1279,6 +1312,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;
@@ -1302,6 +1337,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;
@@ -1322,6 +1358,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)
@@ -1366,8 +1404,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,

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list