Mercurial > mplayer.hg
annotate gui/ui/gtk/fileselect.c @ 35350:ee265b18d653
Rename import_file_into_gui() add_to_gui_playlist().
This seems to be a more appropriate name.
Additionally, use self-explanatory enum constants instead of numeric
ones, change the parameter names and a declaration to const, check the
parameters and print the debug message only if the item will really be
added.
(For the sake of consistency, adjust the Win32 code as well.)
author | ib |
---|---|
date | Thu, 22 Nov 2012 13:57:40 +0000 |
parents | 3aba69339390 |
children | 96cda43fe250 |
rev | line source |
---|---|
33572 | 1 /* |
2 * This file is part of MPlayer. | |
3 * | |
4 * MPlayer is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
6 * the Free Software Foundation; either version 2 of the License, or | |
7 * (at your option) any later version. | |
8 * | |
9 * MPlayer is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License along | |
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 */ | |
18 | |
19 #include <stdlib.h> | |
20 #include <stdio.h> | |
21 #include <string.h> | |
22 #include <sys/stat.h> | |
23 #include <glob.h> | |
24 #include <unistd.h> | |
25 | |
26 #include "config.h" | |
27 #include "gui/ui/gmplayer.h" | |
28 | |
29 #include "gui/ui/pixmaps/up.xpm" | |
30 #include "gui/ui/pixmaps/dir.xpm" | |
31 #include "gui/ui/pixmaps/file.xpm" | |
32 | |
33 #include "gui/app.h" | |
34 #include "gui/interface.h" | |
35350 | 35 #include "gui/util/list.h" |
33739 | 36 #include "gui/util/mem.h" |
33737 | 37 #include "gui/util/string.h" |
33572 | 38 #include "help_mp.h" |
39 #include "mpcommon.h" | |
40 #include "stream/stream.h" | |
33751
c28c967e40e9
Replace numeric constant fsPersistant_MaxPos for fsHistory array size.
ib
parents:
33740
diff
changeset
|
41 #include "libavutil/common.h" |
33572 | 42 |
43 #include "gui/ui/widgets.h" | |
44 #include "fileselect.h" | |
45 #include "preferences.h" | |
46 #include "tools.h" | |
47 | |
48 #ifndef __linux__ | |
49 #define get_current_dir_name() getcwd(NULL, PATH_MAX) | |
50 #else | |
51 char * get_current_dir_name( void ); | |
52 #endif | |
53 | |
54 gchar * fsSelectedFile = NULL; | |
55 gchar * fsSelectedFileUtf8 = NULL; | |
56 gchar * fsSelectedDirectory = NULL; | |
33787
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
57 gchar * fsSelectedDirectoryUtf8 = NULL; |
33572 | 58 unsigned char * fsThatDir = "."; |
59 const gchar * fsFilter = "*"; | |
60 | |
61 int fsType = 0; | |
62 | |
34364 | 63 static gint fsCurrFNameListSelected, fsLastFNameListSelected; |
64 | |
33572 | 65 char * fsVideoFilterNames[][2] = |
66 { | |
34857
cceef8552b0c
Enable translation of video and audio file filter items.
ib
parents:
34856
diff
changeset
|
67 { MSGTR_Filter_AVIFiles, "*.avi" }, |
cceef8552b0c
Enable translation of video and audio file filter items.
ib
parents:
34856
diff
changeset
|
68 { MSGTR_Filter_DivXFiles, "*.divx" }, |
cceef8552b0c
Enable translation of video and audio file filter items.
ib
parents:
34856
diff
changeset
|
69 { MSGTR_Filter_FlashVideo, "*.flv" }, |
cceef8552b0c
Enable translation of video and audio file filter items.
ib
parents:
34856
diff
changeset
|
70 { MSGTR_Filter_MP3Files, "*.mp3" }, |
cceef8552b0c
Enable translation of video and audio file filter items.
ib
parents:
34856
diff
changeset
|
71 { MSGTR_Filter_MP4Files, "*.aac,*.f4a,*.f4b,*.f4v,*.m4a,*.m4b,*.m4v,*.mp4" }, |
cceef8552b0c
Enable translation of video and audio file filter items.
ib
parents:
34856
diff
changeset
|
72 { MSGTR_Filter_MPEGFiles, "*.m1v,*.m2v,*.mp2,*.mpe,*.mpeg,*.mpg,*.mpga,*.vdr,*.vob" }, |
cceef8552b0c
Enable translation of video and audio file filter items.
ib
parents:
34856
diff
changeset
|
73 { MSGTR_Filter_MP2TS, "*.bdm,*.bdmv,*.clpi,*.cpi,*.m2t,*.m2ts,*.mpl,*.mpls,*.mts,*.rec,*.trp,*.ts,*.ty" }, |
cceef8552b0c
Enable translation of video and audio file filter items.
ib
parents:
34856
diff
changeset
|
74 { MSGTR_Filter_MatroskaMedia, "*.mka,*.mkv" }, |
cceef8552b0c
Enable translation of video and audio file filter items.
ib
parents:
34856
diff
changeset
|
75 { MSGTR_Filter_OGGMedia, "*.oga,*.ogg,*.ogm,*.ogv,*.ogx,*.spx" }, |
cceef8552b0c
Enable translation of video and audio file filter items.
ib
parents:
34856
diff
changeset
|
76 { MSGTR_Filter_QTMedia, "*.moov,*.mov,*.qt,*.qtvr" }, |
cceef8552b0c
Enable translation of video and audio file filter items.
ib
parents:
34856
diff
changeset
|
77 { MSGTR_Filter_RNMedia, "*.ra,*.rm,*.rmvb,*.rv" }, |
cceef8552b0c
Enable translation of video and audio file filter items.
ib
parents:
34856
diff
changeset
|
78 { MSGTR_Filter_VideoCDImages, "*.bin" }, |
cceef8552b0c
Enable translation of video and audio file filter items.
ib
parents:
34856
diff
changeset
|
79 { MSGTR_Filter_WAVFiles, "*.wav" }, |
cceef8552b0c
Enable translation of video and audio file filter items.
ib
parents:
34856
diff
changeset
|
80 { MSGTR_Filter_WindowsMedia, "*.asf,*.wma,*.wmv" }, |
34869
30fad98fad6e
Add Windows Media Station file (application/x-netshow-channel) support.
ib
parents:
34868
diff
changeset
|
81 { MSGTR_Filter_Playlists, "*.asx,*.m3u,*.m3u8,*.nsc,*.pls,*.ram,*.smi,*.smil,*.sml,*.vlc,*.wax,*.wmx,*.wvx" }, |
35142
1accad685563
Add TAK file extension to the audio file filter of the file selector.
ib
parents:
34892
diff
changeset
|
82 { MSGTR_Filter_AllAudioFiles, "*.aac,*.ac3,*.aif,*.aifc,*.aiff,*.amr,*.ape,*.au,*.awb,*.cdg,*.f4a,*.f4b,*.flac,*.m4a,*.m4b,*.mka,*.mp+,*.mp2,*.mp3,*.mpc,*.mpga,*.mpp,*.nsa,*.oga,*.ogg,*.pcm,*.qcp,*.ra,*.snd,*.spx,*.tak,*.voc,*.vqf,*.w64,*.wav,*.wma,*.wv,*.wvp" }, |
34892
b538985dfaac
Add some file extensions to the video file filter of the file selector.
ib
parents:
34871
diff
changeset
|
83 { MSGTR_Filter_AllVideoFiles, "*.264,*.3g2,*.3ga,*.3gp,*.3gp2,*.3gpp,*.3gpp2,*.asf,*.avi,*.bdm,*.bdmv,*.bin,*.clpi,*.cpi,*.cpk,*.divx,*.dv,*.f4v,*.flc,*.fli,*.flv,*.m1v,*.m2t,*.m2ts,*.m2v,*.m4v,*.mjpg,*.mkv,*.moov,*.mov,*.mp2,*.mp4,*.mpe,*.mpeg,*.mpg,*.mpl,*.mpls,*.mts,*.mxf,*.nsv,*.nuv,*.ogg,*.ogm,*.ogv,*.ogx,*.pva,*.qt,*.qtvr,*.rec,*.rm,*.rmvb,*.roq,*.rv,*.spl,*.str,*.swf,*.trp,*.ts,*.ty,*.vdr,*.viv,*.vivo,*.vob,*.webm,*.wmv,*.y4m" }, |
34857
cceef8552b0c
Enable translation of video and audio file filter items.
ib
parents:
34856
diff
changeset
|
84 { MSGTR_Filter_AllFiles, "*" }, |
33572 | 85 { NULL,NULL } |
86 }; | |
87 int fsLastVideoFilterSelected = -1; | |
88 | |
89 char * fsSubtitleFilterNames[][2] = | |
90 { | |
34849 | 91 { "AQTitle (*.aqt)", "*.aqt" }, |
92 { "Advanced SubStation Alpha (*.ass)", "*.ass" }, | |
93 { "JACOSub (*.jss) ", "*.jss" }, | |
94 { "RealText (*.rt) ", "*.rt" }, | |
95 { "SAMI (*.smi)", "*.smi" }, | |
96 { "SubRip (*.srt)", "*.srt" }, | |
97 { "SubStation Alpha (*.ssa)", "*.ssa" }, | |
98 { "MicroDVD (*.sub)", "*.sub" }, | |
99 { "Text (*.txt)", "*.txt" }, | |
34868
1a07230149a0
Revise UTF-8 encoded subtitle file filter for file selector.
ib
parents:
34867
diff
changeset
|
100 { MSGTR_Filter_UTF8Subtitles, "*.utf,*.utf-8,*.utf8" }, |
34850 | 101 { MSGTR_Filter_AllSubtitles, "*.aqt,*.ass,*.jss,*.rt,*.smi,*.srt,*.ssa,*.sub,*.txt,*.utf" }, |
102 { MSGTR_Filter_AllFiles, "*" }, | |
33572 | 103 { NULL,NULL } |
104 }; | |
105 int fsLastSubtitleFilterSelected = -1; | |
106 | |
107 char * fsOtherFilterNames[][2] = | |
108 { | |
34854 | 109 { MSGTR_Filter_AllFiles, "*" }, |
33572 | 110 { NULL,NULL } |
111 }; | |
112 | |
113 char * fsAudioFileNames[][2] = | |
114 { | |
34853
f6f1cfdaaccf
Enable translation of external audio file filter items.
ib
parents:
34852
diff
changeset
|
115 { MSGTR_Filter_DDRawAudio, "*.ac3,*.pcm" }, |
34856 | 116 { MSGTR_Filter_MPEGAudio, "*.aac,*.f4a,*.m4a,*.mp2,*.mp3,*.mpga" }, |
34853
f6f1cfdaaccf
Enable translation of external audio file filter items.
ib
parents:
34852
diff
changeset
|
117 { MSGTR_Filter_MatroskaAudio, "*.mka" }, |
f6f1cfdaaccf
Enable translation of external audio file filter items.
ib
parents:
34852
diff
changeset
|
118 { MSGTR_Filter_OGGAudio, "*.oga,*.ogg,*.spx" }, |
f6f1cfdaaccf
Enable translation of external audio file filter items.
ib
parents:
34852
diff
changeset
|
119 { MSGTR_Filter_WAVAudio, "*.wav" }, |
f6f1cfdaaccf
Enable translation of external audio file filter items.
ib
parents:
34852
diff
changeset
|
120 { MSGTR_Filter_WMAAudio, "*.wma" }, |
34856 | 121 { MSGTR_Filter_AllAudioFiles, "*.aac,*.ac3,*.f4a,*.m4a,*.mka,*.mp2,*.mp3,*.mpga,*.oga,*.ogg,*.pcm,*.spx,*.wav,*.wma" }, |
34853
f6f1cfdaaccf
Enable translation of external audio file filter items.
ib
parents:
34852
diff
changeset
|
122 { MSGTR_Filter_AllFiles, "*" }, |
33572 | 123 { NULL, NULL } |
124 }; | |
125 int fsLastAudioFilterSelected = -1; | |
126 | |
127 char * fsFontFileNames[][2] = | |
128 { | |
129 #ifdef CONFIG_FREETYPE | |
34851 | 130 { MSGTR_Filter_TTF, "*.ttf" }, |
131 { MSGTR_Filter_Type1, "*.pfb" }, | |
34856 | 132 { MSGTR_Filter_AllFonts, "*.pfb,*.ttf" }, |
33572 | 133 #else |
34851 | 134 { MSGTR_Filter_FontFiles, "*.desc" }, |
33572 | 135 #endif |
34851 | 136 { MSGTR_Filter_AllFiles, "*" }, |
33572 | 137 { NULL,NULL } |
138 }; | |
139 int fsLastFontFilterSelected = -1; | |
140 | |
141 GtkWidget * fsFileNamesList; | |
142 GtkWidget * fsFNameList; | |
143 GtkWidget * fsFileSelect = NULL; | |
144 GdkColormap * fsColorMap; | |
145 GtkWidget * fsOk; | |
146 GtkWidget * fsUp; | |
147 GtkWidget * fsCancel; | |
148 GtkWidget * fsCombo4; | |
149 GtkWidget * fsPathCombo; | |
150 GList * fsList_items = NULL; | |
151 GList * fsTopList_items = NULL; | |
152 GtkWidget * List; | |
153 GtkWidget * fsFilterCombo; | |
154 | |
155 GtkStyle * style; | |
156 GdkPixmap * dpixmap; | |
157 GdkPixmap * fpixmap; | |
158 GdkBitmap * dmask; | |
159 GdkBitmap * fmask; | |
160 | |
161 static char * get_current_dir_name_utf8( void ) | |
162 { | |
163 char * dir, * utf8dir; | |
164 dir = get_current_dir_name(); | |
165 utf8dir = g_filename_to_utf8( dir, -1, NULL, NULL, NULL ); | |
166 if ( !utf8dir ) utf8dir = g_strdup( dir ); | |
167 free( dir ); | |
168 return utf8dir; | |
169 } | |
170 | |
171 static void clist_append_fname(GtkWidget * list, char *fname, | |
172 GdkPixmap *pixmap, GdkPixmap *mask) { | |
173 gint pos; | |
174 gchar *filename, *str[2]; | |
175 filename = g_filename_to_utf8(fname, -1, NULL, NULL, NULL); | |
176 str[0] = NULL; | |
177 str[1] = filename ? filename : fname; | |
178 pos = gtk_clist_append(GTK_CLIST(list), str); | |
179 gtk_clist_set_pixmap(GTK_CLIST(list), pos, 0, pixmap, mask); | |
180 g_free(filename); | |
181 } | |
182 | |
183 static void CheckDir( GtkWidget * list ) | |
184 { | |
185 struct stat fs; | |
34838 | 186 unsigned int i, j, fn; |
33572 | 187 glob_t gg; |
34836 | 188 gchar *filter, **fext; |
33572 | 189 |
190 if ( !fsFilter[0] ) return; | |
191 | |
192 gtk_widget_hide( list ); | |
193 gtk_clist_clear( GTK_CLIST( list ) ); | |
194 | |
195 clist_append_fname(list, ".", dpixmap, dmask); | |
196 clist_append_fname(list, "..", dpixmap, dmask); | |
197 | |
198 glob( "*",0,NULL,&gg ); | |
34838 | 199 for( i=0;i<gg.gl_pathc;i++ ) |
33572 | 200 { |
201 stat( gg.gl_pathv[i],&fs ); | |
202 if( !S_ISDIR( fs.st_mode ) ) continue; | |
203 clist_append_fname(list, gg.gl_pathv[i], dpixmap, dmask); | |
204 } | |
34836 | 205 |
206 for (fn = 1, i = 0; fsFilter[i]; i++) | |
207 if (fsFilter[i] == ',') fn++; | |
208 | |
209 filter = g_strdup(fsFilter); | |
210 fext = calloc(fn, sizeof(gchar *)); | |
33572 | 211 |
34836 | 212 if (filter && fext) |
213 { | |
214 for (j = 0, i = 0; filter[i]; i++) | |
215 { | |
216 if (filter[i] == '.') fext[j] = filter + i; | |
217 | |
218 if (filter[i] == ',') | |
219 { | |
220 filter[i] = 0; | |
221 j++; | |
222 } | |
223 } | |
33572 | 224 |
34838 | 225 for( i=0;i<gg.gl_pathc;i++ ) |
34837 | 226 { |
34836 | 227 char *ext; |
228 | |
34837 | 229 stat( gg.gl_pathv[i],&fs ); |
230 if( S_ISDIR( fs.st_mode ) ) continue; | |
34836 | 231 |
232 ext = strrchr(gg.gl_pathv[i], '.'); | |
233 | |
234 if (ext || !fext[0]) | |
235 { | |
236 for (j = 0; j < fn; j++) | |
237 { | |
238 if (fext[j] == NULL || strcasecmp(fext[j], ext) == 0) | |
239 { | |
34837 | 240 clist_append_fname(list, gg.gl_pathv[i], fpixmap, fmask); |
34836 | 241 break; |
242 } | |
243 } | |
244 } | |
34837 | 245 } |
34836 | 246 } |
247 | |
248 free(fext); | |
249 g_free(filter); | |
33572 | 250 globfree( &gg ); |
251 | |
252 gtk_clist_set_column_width( GTK_CLIST( list ),0,17 ); | |
253 gtk_widget_show( list ); | |
254 } | |
255 | |
256 void ShowFileSelect( int type,int modal ) | |
257 { | |
33787
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
258 int i, k, fsMedium; |
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
259 char * tmp = NULL, * dir = NULL; |
34366
b8a4787f363b
Add /mnt only to the file selector path list if it exists.
ib
parents:
34364
diff
changeset
|
260 struct stat f; |
33572 | 261 |
262 if ( fsFileSelect ) gtkActive( fsFileSelect ); | |
263 else fsFileSelect=create_FileSelect(); | |
264 | |
265 fsType=type; | |
266 switch ( type ) | |
267 { | |
268 case fsVideoSelector: | |
269 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect ); | |
270 fsList_items=NULL; | |
271 for( i=0;fsVideoFilterNames[i][0];i++ ) | |
272 fsList_items=g_list_append( fsList_items,fsVideoFilterNames[i][0] ); | |
273 k = fsLastVideoFilterSelected; | |
274 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); | |
275 g_list_free( fsList_items ); | |
276 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsVideoFilterNames[k >= 0 ? k : i-2][0] ); | |
277 tmp=guiInfo.Filename; | |
278 break; | |
279 case fsSubtitleSelector: | |
280 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_SubtitleSelect ); | |
281 fsList_items=NULL; | |
282 for( i=0;fsSubtitleFilterNames[i][0];i++ ) | |
283 fsList_items=g_list_append( fsList_items,fsSubtitleFilterNames[i][0] ); | |
284 k = fsLastSubtitleFilterSelected; | |
285 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); | |
286 g_list_free( fsList_items ); | |
287 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsSubtitleFilterNames[k >= 0 ? k : i-2][0] ); | |
33897 | 288 tmp=guiInfo.SubtitleFilename; |
33572 | 289 break; |
33776 | 290 /* case fsOtherSelector: |
33572 | 291 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_OtherSelect ); |
292 fsList_items=NULL; | |
293 for( i=0;fsOtherFilterNames[i][0];i++ ) | |
294 fsList_items=g_list_append( fsList_items,fsOtherFilterNames[i][0] ); | |
295 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); | |
296 g_list_free( fsList_items ); | |
297 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsOtherFilterNames[0][0] ); | |
298 tmp=guiInfo.Othername; | |
33776 | 299 break;*/ |
33572 | 300 case fsAudioSelector: |
301 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_AudioFileSelect ); | |
302 fsList_items=NULL; | |
303 for( i=0;fsAudioFileNames[i][0];i++ ) | |
304 fsList_items=g_list_append( fsList_items,fsAudioFileNames[i][0] ); | |
305 k = fsLastAudioFilterSelected; | |
306 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); | |
307 g_list_free( fsList_items ); | |
308 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsAudioFileNames[k >= 0 ? k : i-2][0] ); | |
33897 | 309 tmp=guiInfo.AudioFilename; |
33572 | 310 break; |
311 case fsFontSelector: | |
312 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FontSelect ); | |
313 fsList_items=NULL; | |
314 for( i=0;fsFontFileNames[i][0];i++ ) | |
315 fsList_items=g_list_append( fsList_items,fsFontFileNames[i][0] ); | |
316 k = fsLastFontFilterSelected; | |
317 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); | |
318 g_list_free( fsList_items ); | |
319 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsFontFileNames[k >= 0 ? k : i-2][0] ); | |
320 tmp=font_name; | |
321 break; | |
322 } | |
323 | |
33787
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
324 fsMedium=(fsType == fsVideoSelector || fsType == fsSubtitleSelector || fsType == fsAudioSelector); |
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
325 |
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
326 if ( !tmp && fsMedium ) tmp=guiInfo.Filename; |
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
327 |
33572 | 328 if ( tmp && tmp[0] ) |
329 { | |
33787
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
330 dir = strdup( tmp ); |
33572 | 331 |
332 do | |
333 { | |
334 char * c = strrchr( dir,'/' ); | |
335 stat( dir,&f ); | |
336 if ( S_ISDIR( f.st_mode ) ) break; | |
337 if ( c ) *c=0; | |
338 } while ( strrchr( dir,'/' ) ); | |
339 | |
33787
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
340 if ( !dir[0] ) nfree( dir ); |
33572 | 341 } |
342 | |
343 if ( fsTopList_items ) g_list_free( fsTopList_items ); fsTopList_items=NULL; | |
344 { | |
33751
c28c967e40e9
Replace numeric constant fsPersistant_MaxPos for fsHistory array size.
ib
parents:
33740
diff
changeset
|
345 unsigned int i, c = 1; |
33572 | 346 |
33787
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
347 |
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
348 if ( fsMedium ) |
33572 | 349 { |
33751
c28c967e40e9
Replace numeric constant fsPersistant_MaxPos for fsHistory array size.
ib
parents:
33740
diff
changeset
|
350 for ( i=0;i < FF_ARRAY_ELEMS(fsHistory);i++ ) |
33787
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
351 if ( fsHistory[i] ) { fsTopList_items=g_list_append( fsTopList_items,fsHistory[i] ); if ( c ) c=gstrcmp( dir,fsHistory[i] ); } |
33572 | 352 } |
33787
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
353 if ( c && dir ) |
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
354 { |
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
355 g_free( fsSelectedDirectoryUtf8 ); |
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
356 fsSelectedDirectoryUtf8=g_filename_to_utf8( dir, -1, NULL, NULL, NULL ); |
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
357 fsTopList_items=g_list_prepend( fsTopList_items,fsSelectedDirectoryUtf8 ); |
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
358 } |
33572 | 359 } |
33787
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
360 free( dir ); |
33572 | 361 if ( getenv( "HOME" ) ) fsTopList_items=g_list_append( fsTopList_items,getenv( "HOME" ) ); |
34368
dbb38c5293b0
Add /home only to the file selector path list if HOME isn't set.
ib
parents:
34367
diff
changeset
|
362 else fsTopList_items=g_list_append( fsTopList_items,"/home" ); |
34367
b370a9fd85b3
Cosmetic: Swap /mnt and /media in the file selector path list.
ib
parents:
34366
diff
changeset
|
363 if (stat( "/media",&f ) == 0) fsTopList_items=g_list_append( fsTopList_items,"/media" ); |
34366
b8a4787f363b
Add /mnt only to the file selector path list if it exists.
ib
parents:
34364
diff
changeset
|
364 if (stat( "/mnt",&f ) == 0) fsTopList_items=g_list_append( fsTopList_items,"/mnt" ); |
33572 | 365 fsTopList_items=g_list_append( fsTopList_items,"/" ); |
366 gtk_combo_set_popdown_strings( GTK_COMBO( fsCombo4 ),fsTopList_items ); | |
367 | |
34346 | 368 gtk_widget_grab_focus( fsFNameList ); |
34518 | 369 if (fsLastFNameListSelected + 1 > ((GtkCList *)fsFNameList)->rows) fsLastFNameListSelected = 0; |
34364 | 370 ((GtkCList *)fsFNameList)->focus_row = fsLastFNameListSelected; |
371 gtk_clist_select_row( GTK_CLIST( fsFNameList ),fsLastFNameListSelected,1 ); | |
372 fsLastFNameListSelected = 0; | |
34346 | 373 |
33572 | 374 gtk_window_set_modal( GTK_WINDOW( fsFileSelect ),modal ); |
375 | |
376 gtk_widget_show( fsFileSelect ); | |
377 } | |
378 | |
379 void HideFileSelect( void ) | |
380 { | |
381 if ( !fsFileSelect ) return; | |
382 gtk_widget_hide( fsFileSelect ); | |
383 gtk_widget_destroy( fsFileSelect ); | |
384 fsFileSelect=NULL; | |
34364 | 385 fsLastFNameListSelected = fsCurrFNameListSelected; |
33572 | 386 } |
387 | |
388 static void fs_PersistantHistory( char * subject ) | |
389 { | |
33751
c28c967e40e9
Replace numeric constant fsPersistant_MaxPos for fsHistory array size.
ib
parents:
33740
diff
changeset
|
390 unsigned int i; |
33572 | 391 |
392 if ( fsType != fsVideoSelector ) return; | |
393 | |
33751
c28c967e40e9
Replace numeric constant fsPersistant_MaxPos for fsHistory array size.
ib
parents:
33740
diff
changeset
|
394 for ( i=0;i < FF_ARRAY_ELEMS(fsHistory);i++ ) |
33572 | 395 if ( fsHistory[i] && !strcmp( fsHistory[i],subject ) ) |
396 { | |
397 char * tmp = fsHistory[i]; fsHistory[i]=fsHistory[0]; fsHistory[0]=tmp; | |
398 return; | |
399 } | |
33751
c28c967e40e9
Replace numeric constant fsPersistant_MaxPos for fsHistory array size.
ib
parents:
33740
diff
changeset
|
400 nfree( fsHistory[FF_ARRAY_ELEMS(fsHistory) - 1] ); |
c28c967e40e9
Replace numeric constant fsPersistant_MaxPos for fsHistory array size.
ib
parents:
33740
diff
changeset
|
401 for ( i=FF_ARRAY_ELEMS(fsHistory) - 1;i;i-- ) fsHistory[i]=fsHistory[i - 1]; |
33572 | 402 fsHistory[0]=gstrdup( subject ); |
403 } | |
34684 | 404 /* ----------------------------------------------- */ |
33572 | 405 |
34466
a650895d50a5
Use correct data types and common variable names in GTK callback functions.
ib
parents:
34368
diff
changeset
|
406 static void fs_fsFilterCombo_activate( GtkEntry * entry, |
33572 | 407 gpointer user_data ) |
408 { | |
409 fsFilter=gtk_entry_get_text( GTK_ENTRY( user_data ) ); | |
410 CheckDir( fsFNameList ); | |
411 } | |
412 | |
413 static void fs_fsFilterCombo_changed( GtkEditable * editable, | |
414 gpointer user_data ) | |
415 { | |
416 const char * str; | |
417 int i; | |
418 | |
419 str=gtk_entry_get_text( GTK_ENTRY(user_data ) ); | |
420 | |
421 switch ( fsType ) | |
422 { | |
423 case fsVideoSelector: | |
424 for( i=0;fsVideoFilterNames[i][0];i++ ) | |
425 if( !strcmp( str,fsVideoFilterNames[i][0] ) ) | |
426 { fsFilter=fsVideoFilterNames[i][1]; fsLastVideoFilterSelected = i; break; } | |
427 break; | |
428 case fsSubtitleSelector: | |
429 for( i=0;fsSubtitleFilterNames[i][0];i++ ) | |
430 if( !strcmp( str,fsSubtitleFilterNames[i][0] ) ) | |
431 { fsFilter=fsSubtitleFilterNames[i][1]; fsLastSubtitleFilterSelected = i; break; } | |
432 break; | |
33776 | 433 /* case fsOtherSelector: |
33572 | 434 for( i=0;fsOtherFilterNames[i][0];i++ ) |
435 if( !strcmp( str,fsOtherFilterNames[i][0] ) ) | |
436 { fsFilter=fsOtherFilterNames[i][1]; break; } | |
33776 | 437 break;*/ |
33572 | 438 case fsAudioSelector: |
439 for( i=0;fsAudioFileNames[i][0];i++ ) | |
440 if( !strcmp( str,fsAudioFileNames[i][0] ) ) | |
441 { fsFilter=fsAudioFileNames[i][1]; fsLastAudioFilterSelected = i; break; } | |
442 break; | |
443 case fsFontSelector: | |
444 for( i=0;fsFontFileNames[i][0];i++ ) | |
445 if( !strcmp( str,fsFontFileNames[i][0] ) ) | |
446 { fsFilter=fsFontFileNames[i][1]; fsLastFontFilterSelected = i; break; } | |
447 break; | |
448 default: return; | |
449 } | |
450 CheckDir( fsFNameList ); | |
451 } | |
452 | |
34466
a650895d50a5
Use correct data types and common variable names in GTK callback functions.
ib
parents:
34368
diff
changeset
|
453 static void fs_fsPathCombo_activate( GtkEntry * entry, |
33572 | 454 gpointer user_data ) |
455 { | |
456 const unsigned char * str; | |
457 gchar * dirname; | |
458 | |
459 str=gtk_entry_get_text( GTK_ENTRY( user_data ) ); | |
460 dirname = g_filename_from_utf8( str, -1, NULL, NULL, NULL ); | |
461 if ( chdir( dirname ? (const unsigned char *)dirname : str ) != -1 ) CheckDir( fsFNameList ); | |
462 g_free( dirname ); | |
463 } | |
464 | |
465 static void fs_fsPathCombo_changed( GtkEditable * editable, | |
466 gpointer user_data ) | |
467 { | |
468 const unsigned char * str; | |
469 gchar * dirname; | |
470 | |
471 str=gtk_entry_get_text( GTK_ENTRY( user_data ) ); | |
472 dirname = g_filename_from_utf8( str, -1, NULL, NULL, NULL ); | |
473 if ( chdir( dirname ? (const unsigned char *)dirname : str ) != -1 ) CheckDir( fsFNameList ); | |
474 g_free( dirname ); | |
475 } | |
476 | |
477 static void fs_Up_released( GtkButton * button, gpointer user_data ) | |
478 { | |
479 chdir( ".." ); | |
480 fsSelectedFile=fsThatDir; | |
481 CheckDir( fsFNameList ); | |
482 gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name_utf8() ); | |
483 return; | |
484 } | |
485 | |
486 static void fs_Ok_released( GtkButton * button, gpointer user_data ) | |
487 { | |
488 GList * item; | |
34859 | 489 int i = 1, l; |
33572 | 490 struct stat fs; |
35348 | 491 gchar * selected; |
33572 | 492 |
493 stat( fsSelectedFile,&fs ); | |
494 if( S_ISDIR(fs.st_mode ) ) | |
495 { | |
496 chdir( fsSelectedFile ); | |
497 fsSelectedFile=fsThatDir; | |
498 CheckDir( fsFNameList ); | |
499 gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name_utf8() ); | |
34364 | 500 gtk_widget_grab_focus( fsFNameList ); |
33572 | 501 return; |
502 } | |
503 | |
504 fsSelectedDirectory=(unsigned char *)get_current_dir_name(); | |
505 switch ( fsType ) | |
506 { | |
507 case fsVideoSelector: | |
34859 | 508 for (l = 0; fsVideoFilterNames[l][0]; l++) |
509 if (strcmp(fsVideoFilterNames[l][0], MSGTR_Filter_Playlists) == 0) break; | |
510 uiSetFileName( fsSelectedDirectory,fsSelectedFile, fsLastVideoFilterSelected == l ? STREAMTYPE_PLAYLIST : STREAMTYPE_FILE ); | |
35348 | 511 selected = g_strconcat(fsSelectedDirectory, "/", fsSelectedFile, NULL); |
512 if (selected) | |
513 { | |
35350 | 514 add_to_gui_playlist(selected, PLAYLIST_ITEM_APPEND); |
35348 | 515 g_free(selected); |
516 } | |
33894 | 517 guiInfo.NewPlay=GUI_FILE_NEW; sub_fps=0; |
33572 | 518 fs_PersistantHistory( get_current_dir_name_utf8() ); //totem, write into history |
519 break; | |
520 case fsSubtitleSelector: | |
33897 | 521 setddup( &guiInfo.SubtitleFilename,fsSelectedDirectory,fsSelectedFile ); |
522 mplayerLoadSubtitle( guiInfo.SubtitleFilename ); | |
33572 | 523 break; |
33776 | 524 /* case fsOtherSelector: |
33740
2c02269701bd
Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents:
33739
diff
changeset
|
525 setddup( &guiInfo.Othername,fsSelectedDirectory,fsSelectedFile ); |
33776 | 526 break;*/ |
33572 | 527 case fsAudioSelector: |
33897 | 528 setddup( &guiInfo.AudioFilename,fsSelectedDirectory,fsSelectedFile ); |
33572 | 529 break; |
530 case fsFontSelector: | |
33740
2c02269701bd
Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents:
33739
diff
changeset
|
531 setddup( &font_name,fsSelectedDirectory,fsSelectedFile ); |
33763 | 532 mplayerLoadFont(); |
33572 | 533 if ( Preferences ) gtk_entry_set_text( GTK_ENTRY( prEFontName ),font_name ); |
534 break; | |
535 } | |
536 | |
537 HideFileSelect(); | |
538 | |
539 item=fsTopList_items; | |
540 while( item ) | |
541 { | |
542 if ( !strcmp( item->data,fsSelectedDirectory ) ) i=0; | |
543 item=item->next; | |
544 } | |
545 if ( i ) fsTopList_items=g_list_prepend( fsTopList_items,(gchar *)get_current_dir_name_utf8() ); | |
546 if ( uiMainAutoPlay ) { uiMainAutoPlay=0; uiEventHandling( evPlay,0 ); } | |
33731
81f71d910333
Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents:
33725
diff
changeset
|
547 else gui( GUI_SET_STATE,(void *) GUI_STOP ); |
33572 | 548 } |
549 | |
550 static void fs_Cancel_released( GtkButton * button,gpointer user_data ) | |
551 { | |
552 HideFileSelect(); | |
553 fs_PersistantHistory( get_current_dir_name_utf8() ); //totem, write into history file | |
554 } | |
555 | |
34466
a650895d50a5
Use correct data types and common variable names in GTK callback functions.
ib
parents:
34368
diff
changeset
|
556 static void fs_fsFNameList_select_row( GtkCList * clist, gint row, gint column, |
a650895d50a5
Use correct data types and common variable names in GTK callback functions.
ib
parents:
34368
diff
changeset
|
557 GdkEvent * event, gpointer user_data) |
33572 | 558 { |
34364 | 559 fsCurrFNameListSelected = row; |
34466
a650895d50a5
Use correct data types and common variable names in GTK callback functions.
ib
parents:
34368
diff
changeset
|
560 gtk_clist_get_text( clist,row,1,&fsSelectedFile ); |
33572 | 561 g_free( fsSelectedFileUtf8 ); |
562 fsSelectedFileUtf8 = g_filename_from_utf8( fsSelectedFile, -1, NULL, NULL, NULL ); | |
563 if ( fsSelectedFileUtf8 ) fsSelectedFile = fsSelectedFileUtf8; | |
34466
a650895d50a5
Use correct data types and common variable names in GTK callback functions.
ib
parents:
34368
diff
changeset
|
564 if( event && event->type == GDK_BUTTON_PRESS ) gtk_button_released( GTK_BUTTON( fsOk ) ); |
33572 | 565 } |
566 | |
567 static gboolean on_FileSelect_key_release_event( GtkWidget * widget, | |
34466
a650895d50a5
Use correct data types and common variable names in GTK callback functions.
ib
parents:
34368
diff
changeset
|
568 GdkEvent * event, |
33572 | 569 gpointer user_data ) |
570 { | |
34344 | 571 if ( GTK_WIDGET_TYPE( widget ) == GTK_TYPE_BUTTON ) |
572 { | |
34466
a650895d50a5
Use correct data types and common variable names in GTK callback functions.
ib
parents:
34368
diff
changeset
|
573 if (event->key.keyval == GDK_Return) gtk_button_released( GTK_BUTTON( widget ) ); |
34344 | 574 } |
575 else | |
576 { | |
34466
a650895d50a5
Use correct data types and common variable names in GTK callback functions.
ib
parents:
34368
diff
changeset
|
577 switch ( event->key.keyval ) |
34345 | 578 { |
579 case GDK_Escape: | |
580 gtk_button_released( GTK_BUTTON( fsCancel ) ); | |
581 break; | |
582 case GDK_Return: | |
583 gtk_button_released( GTK_BUTTON( fsOk ) ); | |
584 break; | |
585 case GDK_BackSpace: | |
586 gtk_button_released( GTK_BUTTON( fsUp ) ); | |
34351
52a18f850c28
Leave the focus in fsFNameList after key event in file selector.
ib
parents:
34346
diff
changeset
|
587 gtk_widget_grab_focus( fsFNameList ); |
34345 | 588 break; |
589 } | |
34344 | 590 } |
33572 | 591 return FALSE; |
592 } | |
593 | |
594 static gboolean fs_fsFNameList_event( GtkWidget * widget, | |
595 GdkEvent * event, | |
596 gpointer user_data ) | |
597 { | |
598 GdkEventButton *bevent; | |
599 gint row, col; | |
600 | |
601 bevent = (GdkEventButton *) event; | |
602 | |
603 if ( event->type == GDK_BUTTON_RELEASE && bevent->button == 2 ) | |
604 { | |
605 if ( gtk_clist_get_selection_info( GTK_CLIST( widget ), bevent->x, bevent->y, &row, &col ) ) | |
606 { | |
607 gtk_clist_get_text( GTK_CLIST( widget ), row, 1, &fsSelectedFile ); | |
608 g_free( fsSelectedFileUtf8 ); | |
609 fsSelectedFileUtf8 = g_filename_from_utf8( fsSelectedFile, -1, NULL, NULL, NULL ); | |
610 if ( fsSelectedFileUtf8 ) fsSelectedFile = fsSelectedFileUtf8; | |
611 gtk_button_released( GTK_BUTTON( fsOk ) ); | |
612 return TRUE; | |
613 } | |
614 } | |
615 | |
616 return FALSE; | |
617 } | |
618 | |
619 static void fs_Destroy( void ) | |
620 { | |
621 g_free( fsSelectedFileUtf8 ); | |
622 fsSelectedFileUtf8 = NULL; | |
33787
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
623 g_free( fsSelectedDirectoryUtf8 ); |
42feff0f8a7b
Start all file dialogs always in last active directory.
ib
parents:
33776
diff
changeset
|
624 fsSelectedDirectoryUtf8 = NULL; |
33572 | 625 WidgetDestroy( fsFileSelect, &fsFileSelect ); |
626 } | |
627 | |
628 GtkWidget * create_FileSelect( void ) | |
629 { | |
630 GtkWidget * vbox4; | |
631 GtkWidget * hbox4; | |
632 GtkWidget * vseparator1; | |
633 GtkWidget * hbox6; | |
634 GtkWidget * fsFNameListWindow; | |
635 GtkWidget * hbuttonbox3; | |
636 | |
637 GtkWidget * uppixmapwid; | |
638 GdkPixmap * uppixmap; | |
639 GdkBitmap * upmask; | |
640 GtkStyle * upstyle; | |
641 | |
642 | |
643 fsFileSelect=gtk_window_new( GTK_WINDOW_TOPLEVEL ); | |
644 gtk_widget_set_name( fsFileSelect,"fsFileSelect" ); | |
645 gtk_object_set_data( GTK_OBJECT( fsFileSelect ),"fsFileSelect",fsFileSelect ); | |
646 gtk_widget_set_usize( fsFileSelect,512,300 ); | |
647 GTK_WIDGET_SET_FLAGS( fsFileSelect,GTK_CAN_DEFAULT ); | |
648 gtk_widget_set_events( fsFileSelect,GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK ); | |
649 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect ); | |
650 gtk_window_set_position( GTK_WINDOW( fsFileSelect ),GTK_WIN_POS_CENTER ); | |
651 gtk_window_set_policy( GTK_WINDOW( fsFileSelect ),TRUE,TRUE,TRUE ); | |
652 gtk_window_set_wmclass( GTK_WINDOW( fsFileSelect ),"FileSelect","MPlayer" ); | |
653 fsColorMap=gdk_colormap_get_system(); | |
654 | |
655 gtk_widget_realize( fsFileSelect ); | |
656 gtkAddIcon( fsFileSelect ); | |
657 | |
658 style=gtk_widget_get_style( fsFileSelect ); | |
659 dpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&dmask,&style->bg[GTK_STATE_NORMAL],(gchar **)dir_xpm ); | |
660 fpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&fmask,&style->bg[GTK_STATE_NORMAL],(gchar **)file_xpm ); | |
661 | |
662 vbox4=AddVBox( AddDialogFrame( fsFileSelect ),0 ); | |
663 hbox4=AddHBox( vbox4,1 ); | |
664 | |
665 fsCombo4=gtk_combo_new(); | |
666 gtk_widget_set_name( fsCombo4,"fsCombo4" ); | |
667 gtk_widget_show( fsCombo4 ); | |
668 gtk_box_pack_start( GTK_BOX( hbox4 ),fsCombo4,TRUE,TRUE,0 ); | |
669 gtk_widget_set_usize( fsCombo4,-2,20 ); | |
670 | |
671 fsPathCombo=GTK_COMBO( fsCombo4 )->entry; | |
672 gtk_widget_set_name( fsPathCombo,"fsPathCombo" ); | |
673 gtk_widget_show( fsPathCombo ); | |
674 gtk_widget_set_usize( fsPathCombo,-2,20 ); | |
675 | |
676 vseparator1=gtk_vseparator_new(); | |
677 gtk_widget_set_name( vseparator1,"vseparator1" ); | |
678 gtk_widget_show( vseparator1 ); | |
679 gtk_box_pack_start( GTK_BOX( hbox4 ),vseparator1,FALSE,TRUE,0 ); | |
680 gtk_widget_set_usize( vseparator1,7,20 ); | |
681 | |
682 upstyle=gtk_widget_get_style( fsFileSelect ); | |
683 uppixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&upmask,&upstyle->bg[GTK_STATE_NORMAL],(gchar **)up_xpm ); | |
684 uppixmapwid=gtk_pixmap_new( uppixmap,upmask ); | |
685 gtk_widget_show( uppixmapwid ); | |
686 | |
687 fsUp=gtk_button_new(); | |
688 gtk_container_add( GTK_CONTAINER(fsUp ),uppixmapwid ); | |
689 gtk_widget_show( fsUp ); | |
690 gtk_box_pack_start( GTK_BOX( hbox4 ),fsUp,FALSE,FALSE,0 ); | |
691 gtk_widget_set_usize( fsUp,65,15 ); | |
692 | |
693 AddHSeparator( vbox4 ); | |
694 | |
695 hbox6=AddHBox( NULL,0 ); | |
696 gtk_box_pack_start( GTK_BOX( vbox4 ),hbox6,TRUE,TRUE,0 ); | |
697 | |
698 fsFNameListWindow=gtk_scrolled_window_new( NULL,NULL ); | |
699 gtk_widget_set_name( fsFNameListWindow,"fsFNameListWindow" ); | |
700 gtk_widget_show( fsFNameListWindow ); | |
701 gtk_box_pack_start( GTK_BOX( hbox6 ),fsFNameListWindow,TRUE,TRUE,0 ); | |
702 gtk_widget_set_usize( fsFNameListWindow,-2,145 ); | |
703 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( fsFNameListWindow ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC ); | |
704 | |
705 fsFNameList=gtk_clist_new( 2 ); | |
706 gtk_widget_set_name( fsFNameList,"fsFNameList" ); | |
707 gtk_container_add( GTK_CONTAINER( fsFNameListWindow ),fsFNameList ); | |
708 gtk_clist_set_column_width( GTK_CLIST( fsFNameList ),0,80 ); | |
709 gtk_clist_set_selection_mode( GTK_CLIST( fsFNameList ),GTK_SELECTION_BROWSE ); | |
710 gtk_clist_column_titles_hide( GTK_CLIST( fsFNameList ) ); | |
711 gtk_clist_set_shadow_type( GTK_CLIST( fsFNameList ),GTK_SHADOW_ETCHED_OUT ); | |
712 | |
713 AddHSeparator( vbox4 ); | |
714 | |
715 List=gtk_combo_new(); | |
716 gtk_widget_set_name( List,"List" ); | |
717 gtk_widget_ref( List ); | |
718 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"List",List,(GtkDestroyNotify)gtk_widget_unref ); | |
719 gtk_widget_show( List ); | |
720 gtk_box_pack_start( GTK_BOX( vbox4 ),List,FALSE,FALSE,0 ); | |
721 gtk_widget_set_usize( List,-2,20 ); | |
722 | |
723 fsFilterCombo=GTK_COMBO( List )->entry; | |
724 gtk_widget_set_name( fsFilterCombo,"fsFilterCombo" ); | |
725 gtk_widget_show( fsFilterCombo ); | |
726 gtk_entry_set_editable (GTK_ENTRY( fsFilterCombo ),FALSE ); | |
34871 | 727 gtk_widget_set_usize( fsFilterCombo,-2,20 ); |
33572 | 728 |
729 AddHSeparator( vbox4 ); | |
730 | |
731 hbuttonbox3=AddHButtonBox( vbox4 ); | |
732 gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox3 ),GTK_BUTTONBOX_END ); | |
733 gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox3 ),10 ); | |
734 | |
735 fsOk=AddButton( MSGTR_Ok,hbuttonbox3 ); | |
736 fsCancel=AddButton( MSGTR_Cancel,hbuttonbox3 ); | |
737 | |
738 gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"destroy",GTK_SIGNAL_FUNC( fs_Destroy ), NULL ); | |
739 gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"key_release_event",GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),NULL ); | |
740 | |
741 gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"changed",GTK_SIGNAL_FUNC( fs_fsFilterCombo_changed ),fsFilterCombo ); | |
742 gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"activate",GTK_SIGNAL_FUNC( fs_fsFilterCombo_activate ),fsFilterCombo ); | |
743 gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"changed",GTK_SIGNAL_FUNC( fs_fsPathCombo_changed ),fsPathCombo ); | |
744 gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"activate",GTK_SIGNAL_FUNC( fs_fsPathCombo_activate ),fsPathCombo ); | |
745 gtk_signal_connect( GTK_OBJECT( fsUp ),"released",GTK_SIGNAL_FUNC( fs_Up_released ),fsFNameList ); | |
34344 | 746 gtk_signal_connect( GTK_OBJECT( fsUp ),"key_release_event",GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),NULL ); |
33572 | 747 gtk_signal_connect( GTK_OBJECT( fsOk ),"released",GTK_SIGNAL_FUNC( fs_Ok_released ),fsCombo4 ); |
34344 | 748 gtk_signal_connect( GTK_OBJECT( fsOk ),"key_release_event",GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),NULL ); |
33572 | 749 gtk_signal_connect( GTK_OBJECT( fsCancel ),"released",GTK_SIGNAL_FUNC( fs_Cancel_released ),NULL ); |
34344 | 750 gtk_signal_connect( GTK_OBJECT( fsCancel ),"key_release_event",GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),NULL ); |
33572 | 751 gtk_signal_connect( GTK_OBJECT( fsFNameList ),"select_row",(GtkSignalFunc)fs_fsFNameList_select_row,NULL ); |
752 gtk_signal_connect( GTK_OBJECT( fsFNameList ),"event", (GtkSignalFunc)fs_fsFNameList_event,NULL ); | |
753 | |
754 return fsFileSelect; | |
755 } |