summaryrefslogblamecommitdiffstats
path: root/source/ap/vim/patches/7.3.592
blob: be13ef744a36b4d15e4a38dce7d7ea0004bf11db (plain) (tree)





























































































































                                                                              
To: vim_dev@googlegroups.com
Subject: Patch 7.3.592
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.592
Problem:    Vim on GTK does not support g:browsefilter.
Solution:   Add a GtkFileFilter to the file chooser. (Christian Brabandt)
Files:	    src/gui_gtk.c


*** ../vim-7.3.591/src/gui_gtk.c	2012-06-06 16:14:36.000000000 +0200
--- src/gui_gtk.c	2012-07-10 13:08:06.000000000 +0200
***************
*** 840,846 ****
  	       char_u *dflt,
  	       char_u *ext UNUSED,
  	       char_u *initdir,
! 	       char_u *filter UNUSED)
  {
  #ifdef USE_FILE_CHOOSER
      GtkWidget		*fc;
--- 840,846 ----
  	       char_u *dflt,
  	       char_u *ext UNUSED,
  	       char_u *initdir,
! 	       char_u *filter)
  {
  #ifdef USE_FILE_CHOOSER
      GtkWidget		*fc;
***************
*** 848,853 ****
--- 848,854 ----
      char_u		dirbuf[MAXPATHL];
      guint		log_handler;
      const gchar		*domain = "Gtk";
+     GtkFileFilter	*gfilter;
  
      title = CONVERT_TO_UTF8(title);
  
***************
*** 879,884 ****
--- 880,924 ----
  	    NULL);
      gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fc),
  						       (const gchar *)dirbuf);
+ 
+     if (filter != NULL && *filter != NUL)
+     {
+ 	int     i = 0;
+ 	char_u  *patt;
+ 	char_u  *p = filter;
+ 
+ 	gfilter = gtk_file_filter_new();
+ 	patt = alloc(STRLEN(filter));
+ 	while (p != NULL && *p != NUL)
+ 	{
+ 	    if (*p == '\n' || *p == ';' || *p == '\t')
+ 	    {
+ 		STRNCPY(patt, filter, i);
+ 		patt[i] = '\0';
+ 		if (*p == '\t')
+ 		    gtk_file_filter_set_name(gfilter, (gchar *)patt);
+ 		else
+ 		{
+ 		    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();
+ 		    }
+ 		}
+ 		filter = ++p;
+ 		i = 0;
+ 	    }
+ 	    else
+ 	    {
+ 		p++;
+ 		i++;
+ 	    }
+ 	}
+ 	vim_free(patt);
+     }
      if (saving && dflt != NULL && *dflt != NUL)
  	gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(fc), (char *)dflt);
  
***************
*** 1304,1310 ****
  	gtk_widget_show(entry);
  
  	/* Make Enter work like pressing OK. */
!         gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
  
  	text = CONVERT_TO_UTF8(textfield);
  	gtk_entry_set_text(GTK_ENTRY(entry), (const char *)text);
--- 1344,1350 ----
  	gtk_widget_show(entry);
  
  	/* Make Enter work like pressing OK. */
! 	gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
  
  	text = CONVERT_TO_UTF8(textfield);
  	gtk_entry_set_text(GTK_ENTRY(entry), (const char *)text);
*** ../vim-7.3.591/src/version.c	2012-07-06 18:27:34.000000000 +0200
--- src/version.c	2012-07-10 13:00:29.000000000 +0200
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     592,
  /**/

-- 
To be rich is not the end, but only a change of worries.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- 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    ///