Patch 8.2.1649
Problem: GTK3: using old file chooser.
Solution: Use native file chooser on GTK 3.20 and above. (Yogeshwar
Velingker, closes #6909)
Files: src/gui_gtk.c
*** ../vim-8.2.1648/src/gui_gtk.c 2020-07-17 20:43:37.288617050 +0200
--- src/gui_gtk.c 2020-09-09 20:56:58.389150100 +0200
***************
*** 1199,1205 ****
char_u *filter)
{
#ifdef USE_FILE_CHOOSER
! GtkWidget *fc;
#endif
char_u dirbuf[MAXPATHL];
guint log_handler;
--- 1199,1209 ----
char_u *filter)
{
#ifdef USE_FILE_CHOOSER
! # if GTK_CHECK_VERSION(3,20,0)
! GtkFileChooserNative *fc;
! # else
! GtkWidget *fc;
! # endif
#endif
char_u dirbuf[MAXPATHL];
guint log_handler;
***************
*** 1226,1243 ****
#ifdef USE_FILE_CHOOSER
// We create the dialog each time, so that the button text can be "Open"
// or "Save" according to the action.
! fc = gtk_file_chooser_dialog_new((const gchar *)title,
GTK_WINDOW(gui.mainwin),
saving ? GTK_FILE_CHOOSER_ACTION_SAVE
: GTK_FILE_CHOOSER_ACTION_OPEN,
! # if GTK_CHECK_VERSION(3,10,0)
_("_Cancel"), GTK_RESPONSE_CANCEL,
saving ? _("_Save") : _("_Open"), GTK_RESPONSE_ACCEPT,
! # else
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
saving ? GTK_STOCK_SAVE : GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
! # endif
NULL);
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fc),
(const gchar *)dirbuf);
--- 1230,1256 ----
#ifdef USE_FILE_CHOOSER
// We create the dialog each time, so that the button text can be "Open"
// or "Save" according to the action.
! # if GTK_CHECK_VERSION(3,20,0)
! fc = gtk_file_chooser_native_new(
! # else
! fc = gtk_file_chooser_dialog_new(
! # endif
! (const gchar *)title,
GTK_WINDOW(gui.mainwin),
saving ? GTK_FILE_CHOOSER_ACTION_SAVE
: GTK_FILE_CHOOSER_ACTION_OPEN,
! # if GTK_CHECK_VERSION(3,20,0)
! saving ? _("_Save") : _("_Open"), _("_Cancel"));
! # else
! # if GTK_CHECK_VERSION(3,10,0)
_("_Cancel"), GTK_RESPONSE_CANCEL,
saving ? _("_Save") : _("_Open"), GTK_RESPONSE_ACCEPT,
! # else
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
saving ? GTK_STOCK_SAVE : GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
! # endif
NULL);
+ # endif
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fc),
(const gchar *)dirbuf);
***************
*** 1263,1269 ****
gtk_file_filter_add_pattern(gfilter, (gchar *)patt);
if (*p == '\n')
{
! gtk_file_chooser_add_filter((GtkFileChooser *)fc,
gfilter);
if (*(p + 1) != NUL)
gfilter = gtk_file_filter_new();
--- 1276,1282 ----
gtk_file_filter_add_pattern(gfilter, (gchar *)patt);
if (*p == '\n')
{
! gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fc),
gfilter);
if (*(p + 1) != NUL)
gfilter = gtk_file_filter_new();
***************
*** 1284,1290 ****
--- 1297,1307 ----
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(fc), (char *)dflt);
gui.browse_fname = NULL;
+ # if GTK_CHECK_VERSION(3,20,0)
+ if (gtk_native_dialog_run(GTK_NATIVE_DIALOG(fc)) == GTK_RESPONSE_ACCEPT)
+ # else
if (gtk_dialog_run(GTK_DIALOG(fc)) == GTK_RESPONSE_ACCEPT)
+ #endif
{
char *filename;
***************
*** 1292,1298 ****
--- 1309,1319 ----
gui.browse_fname = (char_u *)g_strdup(filename);
g_free(filename);
}
+ # if GTK_CHECK_VERSION(3,20,0)
+ g_object_unref(fc);
+ # else
gtk_widget_destroy(GTK_WIDGET(fc));
+ # endif
#else // !USE_FILE_CHOOSER
*** ../vim-8.2.1648/src/version.c 2020-09-09 20:41:21.588337124 +0200
--- src/version.c 2020-09-09 20:58:27.576847160 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 1649,
/**/
--
ARTHUR: What does it say?
BROTHER MAYNARD: It reads ... "Here may be found the last words of Joseph of
Aramathea." "He who is valorous and pure of heart may find
the Holy Grail in the aaaaarrrrrrggghhh..."
ARTHUR: What?
BROTHER MAYNARD: "The Aaaaarrrrrrggghhh..."
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202009091859.089IxOVX416232%40masaka.moolenaar.net.