[Commits] [SCM] claws branch, master, updated. 4.1.1-71-ga8f5ca94d

paul at claws-mail.org paul at claws-mail.org
Sat Aug 12 05:28:52 UTC 2023


The branch, master has been updated
       via  a8f5ca94d3365f4e0ff02dffdbffc20104bb0a73 (commit)
      from  18c51de5c8256da1133b672c0eeef49c4199b800 (commit)

Summary of changes:
 AUTHORS                               |  3 ++-
 src/gtk/authors.h                     |  1 +
 src/gtk/filesel.c                     | 23 ++++++++++-------------
 src/plugins/archive/archiver_gtk.c    | 15 +++++++--------
 src/plugins/clamd/clamav_plugin_gtk.c | 16 ++++++++--------
 5 files changed, 28 insertions(+), 30 deletions(-)


- Log -----------------------------------------------------------------
commit a8f5ca94d3365f4e0ff02dffdbffc20104bb0a73
Author: Paul <paul at claws-mail.org>
Date:   Sat Aug 12 06:28:45 2023 +0100

    add RFE 4686, 'use gtk native filechooser'
    
    patch by nycex

diff --git a/AUTHORS b/AUTHORS
index ef3ff92f7..43f331afc 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -346,4 +346,5 @@ contributors (in addition to the above; based on Changelog)
 	Viatrix
 	Roland Haas
 	Sakaguchi Takayuki
-	 Charles Huber
+	Charles Huber
+	nycex
diff --git a/src/gtk/authors.h b/src/gtk/authors.h
index 8f679f5f3..875af7d81 100644
--- a/src/gtk/authors.h
+++ b/src/gtk/authors.h
@@ -248,6 +248,7 @@ static char *CONTRIBS_LIST[] = {
 "Ales Nosek",
 "Emilian Nowak",
 "James Noyes",
+"nycex",
 "Jens Oberender",
 "Ofer",
 "Ohmasa",
diff --git a/src/gtk/filesel.c b/src/gtk/filesel.c
index ed71b5312..41b9f89f7 100644
--- a/src/gtk/filesel.c
+++ b/src/gtk/filesel.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
+ * 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
@@ -83,11 +83,9 @@ static GList *filesel_create(const gchar *title, const gchar *path,
 					       GTK_FILE_CHOOSER_ACTION_SAVE);
 			
 	gchar * action_btn = (open == TRUE) ? _("_Open"):_("_Save");
-	GtkWidget *chooser = gtk_file_chooser_dialog_new
+	GtkFileChooserNative *chooser = gtk_file_chooser_native_new
 				(title, NULL, action, 
-				_("_Cancel"), GTK_RESPONSE_CANCEL,
-				action_btn, GTK_RESPONSE_ACCEPT, 
-				NULL);
+				action_btn, _("_Cancel"));
 
 	gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(chooser), FALSE);
 
@@ -101,8 +99,8 @@ static GList *filesel_create(const gchar *title, const gchar *path,
 	if (action == GTK_FILE_CHOOSER_ACTION_OPEN) {
 		GtkImage *preview;
 		preview = GTK_IMAGE(gtk_image_new ());
-		gtk_file_chooser_set_preview_widget (GTK_FILE_CHOOSER(chooser), GTK_WIDGET(preview));
-		g_signal_connect (chooser, "update-preview",
+		gtk_file_chooser_set_preview_widget(GTK_FILE_CHOOSER(chooser), GTK_WIDGET(preview));
+		g_signal_connect(chooser, "update-preview",
 			    G_CALLBACK (update_preview_cb), preview);
 
 	}
@@ -111,10 +109,10 @@ static GList *filesel_create(const gchar *title, const gchar *path,
 		gtk_dialog_set_default_response(GTK_DIALOG(chooser), GTK_RESPONSE_ACCEPT);
 	}
 
-	manage_window_set_transient (GTK_WINDOW(chooser));
+	manage_window_set_transient(GTK_WINDOW(chooser));
 	gtk_window_set_modal(GTK_WINDOW(chooser), TRUE);
 
-	gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER(chooser), multiple_files);
+	gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(chooser), multiple_files);
 
 	if (path && strlen(path) > 0) {
 		char *filename = NULL;
@@ -154,11 +152,10 @@ static GList *filesel_create(const gchar *title, const gchar *path,
 		g_free(tmp);
 	}
 
-	if (gtk_dialog_run (GTK_DIALOG (chooser)) == GTK_RESPONSE_ACCEPT) 
-		slist = gtk_file_chooser_get_filenames (GTK_FILE_CHOOSER (chooser));
+	if (gtk_native_dialog_run(GTK_NATIVE_DIALOG(chooser)) == GTK_RESPONSE_ACCEPT) 
+		slist = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER (chooser));
 	
-	manage_window_focus_out(chooser, NULL, NULL);
-	gtk_widget_destroy (chooser);
+	g_object_unref(chooser);
 
 	slist_orig = slist;
 	
diff --git a/src/plugins/archive/archiver_gtk.c b/src/plugins/archive/archiver_gtk.c
index b352634cc..9ede62910 100644
--- a/src/plugins/archive/archiver_gtk.c
+++ b/src/plugins/archive/archiver_gtk.c
@@ -2,7 +2,7 @@
 
 /*
  * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2022 Michael Rasmussen and the Claws Mail Team
+ * Copyright (C) 1999-2023 Michael Rasmussen and the Claws Mail Team
  *
  * 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
@@ -932,18 +932,17 @@ static void foldersel_cb(GtkWidget *widget, gpointer data)
 
 static void filesel_cb(GtkWidget *widget, gpointer data)
 {
-	GtkWidget *dialog;
+	GtkFileChooserNative *dialog;
 	gchar* file;
 	gint newpos = 0;
 	struct ArchivePage* page = (struct ArchivePage *) data;
 
-	dialog = gtk_file_chooser_dialog_new(
+	dialog = gtk_file_chooser_native_new(
 		_("Select file name for archive [suffix should reflect archive like .tgz]"),
 			NULL,
 			GTK_FILE_CHOOSER_ACTION_SAVE,
-			_("_Cancel"), GTK_RESPONSE_CANCEL,
-			_("_Apply"), GTK_RESPONSE_APPLY,
-			NULL);
+			_("_Apply"),
+			_("_Cancel"));
 
 	if (archiver_prefs.save_folder)
 		gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
@@ -951,7 +950,7 @@ static void filesel_cb(GtkWidget *widget, gpointer data)
 	else
 		gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
 						    get_home_dir());
-	if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_APPLY) {
+	if (gtk_native_dialog_run (GTK_NATIVE_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
 		file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
 		if (file) {
 			gtk_editable_delete_text(GTK_EDITABLE(page->file), 0, -1);
@@ -962,7 +961,7 @@ static void filesel_cb(GtkWidget *widget, gpointer data)
 			page->force_overwrite = TRUE;
 		}
 	}
-	gtk_widget_destroy(dialog);
+	g_object_unref(dialog);
 	debug_print("Name for archive: %s\n",
 				gtk_entry_get_text(GTK_ENTRY(page->file)));
 }
diff --git a/src/plugins/clamd/clamav_plugin_gtk.c b/src/plugins/clamd/clamav_plugin_gtk.c
index c5b72a638..7791bbc71 100644
--- a/src/plugins/clamd/clamav_plugin_gtk.c
+++ b/src/plugins/clamd/clamav_plugin_gtk.c
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 2003-2021 the Claws Mail Team
+ * Copyright (C) 2003-2023 the Claws Mail Team
  *
  * 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
@@ -79,20 +79,20 @@ static void foldersel_cb(GtkWidget *widget, gpointer data)
 
 static void clamd_folder_cb(GtkWidget *widget, gpointer data)
 {
-	GtkWidget *dialog;
+	GtkFileChooserNative *dialog;
 	gchar* file;
 	gint newpos = 0;
 	struct ClamAvPage *page = (struct ClamAvPage *) data;
 
-	dialog = gtk_file_chooser_dialog_new(
+	dialog = gtk_file_chooser_native_new(
 					"Select file with clamd configuration [clamd.conf]",
 					NULL,
 					GTK_FILE_CHOOSER_ACTION_OPEN,
-					_("_Cancel"), GTK_RESPONSE_CANCEL,
-					_("_Apply"), GTK_RESPONSE_APPLY,
-					NULL);
+					_("_Apply"),
+					_("_Cancel"));
+
 	gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), "/etc");
-	if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_APPLY) {
+	if (gtk_native_dialog_run (GTK_NATIVE_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
 		file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
 		debug_print("New clamd.conf: %s\n", file);
 		if (file) {
@@ -101,7 +101,7 @@ static void clamd_folder_cb(GtkWidget *widget, gpointer data)
 			g_free(file);
 		}
 	}
-	gtk_widget_destroy(dialog);
+	g_object_unref(dialog);
 }
 
 static void check_permission(gchar* folder) {

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list