[Commits] [SCM] claws branch, gtk2, updated. 3.19.1-25-g48939ec76

wwp at claws-mail.org wwp at claws-mail.org
Mon Jan 2 17:31:58 UTC 2023


The branch, gtk2 has been updated
       via  48939ec76cd3720170fa688be02ce912b6153ed7 (commit)
      from  cf111cdd482d1161316ab01f3840922d866ec3f2 (commit)

Summary of changes:
 src/folderview.c      | 22 ++++++++++++--
 src/main.c            |  8 +++--
 src/prefs_common.c    |  6 +++-
 src/prefs_common.h    |  4 ++-
 src/prefs_summaries.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++--
 5 files changed, 113 insertions(+), 8 deletions(-)


- Log -----------------------------------------------------------------
commit 48939ec76cd3720170fa688be02ce912b6153ed7
Author: Paul <paul at claws-mail.org>
Date:   Mon Jan 2 17:27:07 2023 +0000

    add an easy way to open any folder on start-up

diff --git a/src/folderview.c b/src/folderview.c
index 6c94761d8..e7d0ab6cd 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -1,6 +1,6 @@
 /*
- * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2019 the Claws Mail team and Hiroyuki Yamamoto
+ * Claws Mail -- a GTK based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2023 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
@@ -189,6 +189,8 @@ static void folderview_search_cb	(GtkAction 	*action,
 					 gpointer	 data);
 static void folderview_run_processing_cb(GtkAction 	*action,
 					 gpointer	 data);
+static void folderview_startup_folder_cb(GtkAction	*action,
+					 gpointer	 data);
 
 static void folderview_property_cb	(GtkAction 	*action,
 					 gpointer	 data);
@@ -252,6 +254,7 @@ static GtkActionEntry folderview_common_popup_entries[] =
 	{"FolderViewPopup/---",              NULL, "---", NULL, NULL , NULL},
 	{"FolderViewPopup/RunProcessing",    NULL, N_("R_un processing rules"), NULL, NULL, G_CALLBACK(folderview_run_processing_cb) },
 	{"FolderViewPopup/SearchFolder",     NULL, N_("_Search folder..."), NULL, NULL, G_CALLBACK(folderview_search_cb) },
+	{"FolderViewPopup/OpenFolder",       NULL, N_("Open on start-up"), NULL, NULL, G_CALLBACK(folderview_startup_folder_cb) },
 	{"FolderViewPopup/Properties",       NULL, N_("_Properties..."), NULL, NULL, G_CALLBACK(folderview_property_cb) },
 	{"FolderViewPopup/Processing",       NULL, N_("Process_ing..."), NULL, NULL, G_CALLBACK(folderview_processing_cb) },
 	{"FolderViewPopup/EmptyTrash",       NULL, N_("Empty _trash..."), NULL, NULL, G_CALLBACK(folderview_empty_trash_cb) },
@@ -1960,6 +1963,7 @@ static void folderview_set_sens_and_popup_menu(FolderView *folderview, gint row,
 	MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup", "Separator1", "FolderViewPopup/---", GTK_UI_MANAGER_SEPARATOR)
 	MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup", "RunProcessing", "FolderViewPopup/RunProcessing", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup", "SearchFolder", "FolderViewPopup/SearchFolder", GTK_UI_MANAGER_MENUITEM)
+	MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup", "OpenFolder", "FolderViewPopup/OpenFolder", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup", "Properties", "FolderViewPopup/Properties", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(ui_manager, "/Popup/FolderViewPopup", "Processing", "FolderViewPopup/Processing", GTK_UI_MANAGER_MENUITEM)
 
@@ -2572,6 +2576,20 @@ static void folderview_search_cb(GtkAction *action, gpointer data)
 	summary_search(folderview->summaryview);
 }
 
+static void folderview_startup_folder_cb(GtkAction *action, gpointer data)
+{
+	FolderView *folderview = (FolderView *)data;
+	FolderItem *item;
+
+	if (!folderview->selected) return;
+
+	item = folderview_get_selected_item(folderview);
+
+	prefs_common.goto_last_folder_on_startup = FALSE;
+	prefs_common.goto_folder_on_startup = TRUE;
+	prefs_common.startup_folder = folder_item_get_identifier(item);
+}
+
 static void folderview_run_processing_cb(GtkAction *action, gpointer data)
 {
 	FolderView *folderview = (FolderView *)data;
diff --git a/src/main.c b/src/main.c
index fd51c0c71..bf1ed927c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2022 the Claws Mail team and Hiroyuki Yamamoto
+ * Copyright (C) 1999-2023 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
@@ -1618,7 +1618,11 @@ int main(int argc, char *argv[])
 	folderview_thaw(mainwin->folderview);
 	main_window_cursor_normal(mainwin);
 
-	if (!cmd.target && prefs_common.goto_last_folder_on_startup &&
+	if (!cmd.target && prefs_common.goto_folder_on_startup &&
+	    folder_find_item_from_identifier(prefs_common.startup_folder) != NULL &&
+	    !claws_crashed()) {
+		cmd.target = prefs_common.startup_folder;
+	} else if (!cmd.target && prefs_common.goto_last_folder_on_startup &&
 	    folder_find_item_from_identifier(prefs_common.last_opened_folder) != NULL &&
 	    !claws_crashed()) {
 		cmd.target = prefs_common.last_opened_folder;
diff --git a/src/prefs_common.c b/src/prefs_common.c
index 74ba3a7b6..b684b4fe7 100644
--- a/src/prefs_common.c
+++ b/src/prefs_common.c
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2022 the Claws Mail team and Hiroyuki Yamamoto
+ * Copyright (C) 1999-2023 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
@@ -1216,6 +1216,10 @@ static PrefParam param[] = {
 	P_STRING, NULL, NULL, NULL },
 	{"goto_last_folder_on_startup", "FALSE", &prefs_common.goto_last_folder_on_startup,
 	P_BOOL, NULL, NULL, NULL },
+	{"startup_folder", "", &prefs_common.startup_folder,
+	P_STRING, NULL, NULL, NULL },
+	{"goto_folder_on_startup", "FALSE", &prefs_common.goto_folder_on_startup,
+	P_BOOL, NULL, NULL, NULL },
 	{"summary_quicksearch_sticky", "1", &prefs_common.summary_quicksearch_sticky, P_INT,
 	 NULL, NULL, NULL},
 	{"summary_quicksearch_dynamic", "0", &prefs_common.summary_quicksearch_dynamic, P_INT,
diff --git a/src/prefs_common.h b/src/prefs_common.h
index b99bf749b..8d7a12ce8 100644
--- a/src/prefs_common.h
+++ b/src/prefs_common.h
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2022 the Claws Mail team and Hiroyuki Yamamoto
+ * Copyright (C) 1999-2023 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
@@ -277,6 +277,8 @@ struct _PrefsCommon
 
 	gchar *last_opened_folder;
 	gboolean goto_last_folder_on_startup;
+	gchar *startup_folder;
+	gboolean goto_folder_on_startup;
 
 	ToolbarStyle toolbar_style;
 	gboolean toolbar_detachable;
diff --git a/src/prefs_summaries.c b/src/prefs_summaries.c
index dd87456ed..db64819e4 100644
--- a/src/prefs_summaries.c
+++ b/src/prefs_summaries.c
@@ -1,6 +1,6 @@
 /*
- * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2005-2018 Colin Leroy and The Claws Mail Team
+ * Claws Mail -- a GTK based, lightweight, and fast e-mail client
+ * Copyright (C) 2005-2023 the Claws Mail Team and Colin Leroy
  *
  * 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
@@ -31,6 +31,7 @@
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
+#include "foldersel.h"
 #include "prefs_common.h"
 #include "prefs_gtk.h"
 #include "prefs_summary_open.h"
@@ -59,6 +60,9 @@ typedef struct _SummariesPage
 	GtkWidget *entry_datefmt;
 
 	GtkWidget *checkbtn_reopen_last_folder;
+	GtkWidget *checkbtn_startup_folder;
+	GtkWidget *startup_folder_entry;
+	GtkWidget *startup_folder_select;
 	GtkWidget *checkbtn_always_show_msg;
 	GtkWidget *checkbtn_show_on_folder_open;
 	GtkWidget *checkbtn_show_on_search_results;
@@ -111,6 +115,41 @@ static void mark_as_read_toggled		(GtkToggleButton *button,
 static void always_show_msg_toggled		(GtkToggleButton *button,
 						 gpointer user_data);
 
+static void reopen_last_folder_toggled(GtkToggleButton *toggle_btn, GtkWidget *widget)
+{
+	gboolean is_active;
+
+	is_active = gtk_toggle_button_get_active(toggle_btn);
+	gtk_widget_set_sensitive(widget, !is_active);
+	if (is_active)
+		prefs_common.goto_folder_on_startup = FALSE;
+}
+
+static void startup_folder_toggled(GtkToggleButton *toggle_btn, GtkWidget *widget)
+{
+	gboolean is_active;
+
+	is_active = gtk_toggle_button_get_active(toggle_btn);
+	gtk_widget_set_sensitive(widget, !is_active);
+	if (is_active)
+		prefs_common.goto_last_folder_on_startup = FALSE;
+}
+
+static void foldersel_cb(GtkWidget *widget, gpointer data)
+{
+	GtkWidget *entry = (GtkWidget *) data;
+	FolderItem *item;
+	gchar *item_id;
+	gint newpos = 0;
+	
+	item = foldersel_folder_sel(NULL, FOLDER_SEL_ALL, NULL, FALSE, NULL);
+	if (item && (item_id = folder_item_get_identifier(item)) != NULL) {
+		gtk_editable_delete_text(GTK_EDITABLE(entry), 0, -1);
+		gtk_editable_insert_text(GTK_EDITABLE(entry), item_id, strlen(item_id), &newpos);
+		g_free(item_id);
+	}
+}
+
 static GtkWidget *date_format_create(GtkButton *button, void *data)
 {
 	static GtkWidget *datefmt_win = NULL;
@@ -339,6 +378,9 @@ static void prefs_summaries_create_widget(PrefsPage *_page, GtkWindow *window,
 	GtkWidget *entry_datefmt;
 	GtkWidget *button_dispitem;
 	GtkWidget *checkbtn_reopen_last_folder;
+	GtkWidget *checkbtn_startup_folder;
+	GtkWidget *startup_folder_entry;
+	GtkWidget *startup_folder_select;
 	GtkWidget *checkbtn_always_show_msg;
 	GtkWidget *checkbtn_show_on_folder_open;
 	GtkWidget *checkbtn_show_on_search_results;
@@ -414,6 +456,31 @@ static void prefs_summaries_create_widget(PrefsPage *_page, GtkWindow *window,
 		(vbox1, checkbtn_reopen_last_folder,
 		 _("Open last opened folder at start-up"));
 
+	hbox0 = gtk_hbox_new(FALSE, 8);
+	gtk_widget_show(hbox0);
+	gtk_box_pack_start(GTK_BOX(vbox1), hbox0, FALSE, FALSE, 0);
+
+	PACK_CHECK_BUTTON
+		(hbox0, checkbtn_startup_folder,
+		 _("Open selected folder at start-up"));
+
+	startup_folder_entry = gtk_entry_new();
+	gtk_widget_show(startup_folder_entry);
+	gtk_box_pack_start(GTK_BOX(hbox0), startup_folder_entry, TRUE, TRUE, 0);
+	startup_folder_select = gtkut_get_browse_directory_btn(_("_Browse"));
+	gtk_widget_show(startup_folder_select);
+	gtk_box_pack_start(GTK_BOX(hbox0), startup_folder_select, FALSE, FALSE, 0);
+
+	SET_TOGGLE_SENSITIVITY(checkbtn_startup_folder, startup_folder_entry)
+	SET_TOGGLE_SENSITIVITY(checkbtn_startup_folder, startup_folder_select)
+
+	g_signal_connect(G_OBJECT(checkbtn_reopen_last_folder), "toggled",
+			 G_CALLBACK(reopen_last_folder_toggled), checkbtn_startup_folder);
+	g_signal_connect(G_OBJECT(checkbtn_startup_folder), "toggled",
+			 G_CALLBACK(startup_folder_toggled), checkbtn_reopen_last_folder);
+	g_signal_connect(G_OBJECT(startup_folder_select), "clicked",
+			 G_CALLBACK(foldersel_cb), startup_folder_entry);
+
 	PACK_CHECK_BUTTON
 		(vbox1, checkbtn_run_processingrules_mark_all_read,
 		 _("Run processing rules before marking all messages in a folder as read or unread"));
@@ -681,6 +748,8 @@ static void prefs_summaries_create_widget(PrefsPage *_page, GtkWindow *window,
 	prefs_summaries->checkbtn_threadsubj = checkbtn_threadsubj;
 	prefs_summaries->entry_datefmt = entry_datefmt;
 	prefs_summaries->checkbtn_reopen_last_folder = checkbtn_reopen_last_folder;
+	prefs_summaries->checkbtn_startup_folder = checkbtn_startup_folder;
+	prefs_summaries->startup_folder_entry = startup_folder_entry;
 
 	prefs_summaries->checkbtn_always_show_msg = checkbtn_always_show_msg;
 	prefs_summaries->checkbtn_show_on_folder_open = checkbtn_show_on_folder_open;
@@ -731,6 +800,10 @@ static void prefs_summaries_create_widget(PrefsPage *_page, GtkWindow *window,
 			prefs_common.date_format?prefs_common.date_format:"");	
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_reopen_last_folder),
 			prefs_common.goto_last_folder_on_startup);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_startup_folder),
+			prefs_common.goto_folder_on_startup);
+	gtk_entry_set_text(GTK_ENTRY(startup_folder_entry),
+			   prefs_common.startup_folder?prefs_common.startup_folder:"");
 
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_always_show_msg),
 			prefs_common.always_show_msg);
@@ -809,6 +882,10 @@ static void prefs_summaries_save(PrefsPage *_page)
 
 	prefs_common.goto_last_folder_on_startup = gtk_toggle_button_get_active(
 		GTK_TOGGLE_BUTTON(page->checkbtn_reopen_last_folder));
+	prefs_common.goto_folder_on_startup = gtk_toggle_button_get_active(
+		GTK_TOGGLE_BUTTON(page->checkbtn_startup_folder));
+	prefs_common.startup_folder = gtk_editable_get_chars(
+			GTK_EDITABLE(page->startup_folder_entry), 0, -1);
 
 	prefs_common.always_show_msg = gtk_toggle_button_get_active(
 		GTK_TOGGLE_BUTTON(page->checkbtn_always_show_msg));

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list