summaryrefslogtreecommitdiffstats
path: root/source/ap/vim/patches/7.3.592
blob: be13ef744a36b4d15e4a38dce7d7ea0004bf11db (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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    ///