2901
|
1
|
|
2 #include <stdlib.h>
|
|
3 #include <stdio.h>
|
|
4 #include <string.h>
|
|
5 #include <sys/stat.h>
|
|
6 #include <glob.h>
|
|
7 #include <unistd.h>
|
|
8
|
|
9 #include "./mplayer.h"
|
|
10 #include "psignal.h"
|
|
11 #include "../error.h"
|
|
12
|
|
13 #include "pixmaps/up.xpm"
|
|
14 #include "pixmaps/dir.xpm"
|
|
15 #include "pixmaps/file.xpm"
|
|
16
|
|
17 #include "../../events.h"
|
|
18 #include "../../../config.h"
|
|
19 #include "../../../help_mp.h"
|
|
20
|
|
21 #include "../widgets.h"
|
|
22 #include "fs.h"
|
|
23
|
|
24 #ifndef __linux__
|
|
25 #define get_current_dir_name() getcwd(NULL, PATH_MAX)
|
|
26 #endif
|
|
27
|
|
28 #ifndef get_current_dir_name
|
|
29 extern char * get_current_dir_name( void );
|
|
30 #endif
|
|
31
|
|
32 gchar * fsSelectedFile = NULL;
|
|
33 gchar * fsSelectedDirectory = NULL;
|
|
34 unsigned char * fsThatDir = ".";
|
3499
|
35 gchar fsFilter[8] = "*";
|
2901
|
36
|
|
37 int fsPressed = 0;
|
3499
|
38 int fsMessage = -1;
|
|
39 int fsType = 0;
|
3054
|
40
|
3499
|
41 #define fsNumberOfVideoFilterNames 6
|
|
42 char * fsVideoFilterNames[fsNumberOfVideoFilterNames+1][2] =
|
|
43 { { "MPEG files ( *.mpg )", "*.mpg" },
|
|
44 { "VOB files ( *.vob )", "*.vob" },
|
|
45 { "AVI files ( *.avi )", "*.avi" },
|
|
46 { "QT files ( *.mov )", "*.mov" },
|
|
47 { "ASF files ( *.asf )", "*.asf" },
|
|
48 { "VIVO files ( *.viv )", "*.viv" },
|
|
49 { "All files ( * )", "*" } };
|
|
50
|
|
51 #define fsNumberOfSubtitleFilterNames 8
|
|
52 char * fsSubtitleFilterNames[fsNumberOfSubtitleFilterNames+1][2] =
|
|
53 { { "UTF ( *.utf )", "*.utf" },
|
|
54 { "SUB ( *.sub )", "*.sub" },
|
|
55 { "SRT ( *.srt )", "*.str" },
|
|
56 { "SMI ( *.smi )", "*.smi" },
|
|
57 { "RT ( *.rt )", "*.rt" },
|
|
58 { "TXT ( *.txt )", "*.txt" },
|
|
59 { "SSA ( *.ssa )", "*.ssa" },
|
|
60 { "AQT ( *.aqt )", "*.aqt" },
|
|
61 { "All files ( * )", "*" } };
|
|
62
|
|
63 #define fsNumberOfOtherFilterNames 0
|
|
64 char * fsOtherFilterNames[fsNumberOfOtherFilterNames+1][2] =
|
3587
|
65 { { "All files ( * )", "*" } };
|
2901
|
66
|
|
67 GtkWidget * fsFileNamesList;
|
|
68 GtkWidget * fsFNameList;
|
|
69 GtkWidget * fsFileSelect;
|
|
70 GdkColormap * fsColorMap;
|
|
71 GtkWidget * fsOk;
|
|
72 GtkWidget * fsUp;
|
|
73 GtkWidget * fsCancel;
|
|
74 GtkWidget * fsCombo4;
|
3499
|
75 GtkWidget * fsPathCombo;
|
2901
|
76 GList * fsList_items = NULL;
|
|
77 GList * fsTopList_items = NULL;
|
3499
|
78 GtkWidget * List;
|
|
79 GtkWidget * fsFilterCombo;
|
2901
|
80
|
3499
|
81
|
|
82 GtkStyle * style;
|
|
83 GdkPixmap * dpixmap;
|
|
84 GdkPixmap * fpixmap;
|
|
85 GdkBitmap * dmask;
|
|
86 GdkBitmap * fmask;
|
|
87
|
|
88 void CheckDir( GtkWidget * list,char * directory )
|
2901
|
89 {
|
|
90 struct stat fs;
|
|
91 int i,c=2;
|
|
92 gchar * str[1][2];
|
3499
|
93 GdkPixmap * pixmap;
|
|
94 GdkBitmap * mask;
|
2901
|
95 glob_t gg;
|
|
96
|
3499
|
97 if ( !fsFilter[0] ) return;
|
|
98
|
2901
|
99 gtk_widget_hide( list );
|
3499
|
100 gtk_clist_clear( GTK_CLIST( list ) );
|
2901
|
101 str[0][0]=NULL;
|
3499
|
102
|
2901
|
103 pixmap=dpixmap; mask=dmask;
|
|
104 str[0][0]=NULL; str[0][1]=(gchar *)malloc( 3 );
|
3499
|
105 strcpy( str[0][1],"." ); gtk_clist_append( GTK_CLIST( list ),str[0] ); gtk_clist_set_pixmap( GTK_CLIST( list ),0,0,pixmap,mask );
|
|
106 strcpy( str[0][1],".." ); gtk_clist_append( GTK_CLIST( list ),str[0] ); gtk_clist_set_pixmap( GTK_CLIST( list ),1,0,pixmap,mask );
|
2901
|
107 free( str[0][0] );
|
|
108
|
3499
|
109 glob( "*",0,NULL,&gg );
|
2901
|
110 // glob( ".*",GLOB_NOSORT | GLOB_APPEND,NULL,&gg );
|
|
111 for( i=0;i<gg.gl_pathc;i++ )
|
|
112 {
|
|
113 stat( gg.gl_pathv[i],&fs );
|
3499
|
114 if( !S_ISDIR( fs.st_mode ) ) continue;
|
|
115
|
|
116 str[0][1]=(gchar *)malloc( strlen( gg.gl_pathv[i] ) + 1 );
|
|
117 strcpy( str[0][1],gg.gl_pathv[i] );
|
|
118 pixmap=dpixmap; mask=dmask;
|
|
119 gtk_clist_append( GTK_CLIST( list ),str[0] );
|
|
120 gtk_clist_set_pixmap( GTK_CLIST( list ),c++,0,pixmap,mask );
|
|
121 free( str[0][1] );
|
2901
|
122 }
|
|
123 globfree( &gg );
|
3499
|
124
|
|
125 glob( fsFilter,0,NULL,&gg );
|
|
126
|
|
127 #if 0
|
|
128 if ( !strcmp( fsFilter,"*" ) )
|
|
129 {
|
|
130 char * f = strdup( fsFilter );
|
|
131 int i;
|
|
132 for( i=0;i<strlen( f );i++ )
|
|
133 if ( ( f[i] >= 'A' )&&( f[i] <= 'Z' ) ) f[i]+=32;
|
|
134 glob( f,GLOB_APPEND,NULL,&gg );
|
|
135
|
|
136 for( i=0;i<strlen( f );i++ )
|
|
137 if ( ( f[i] >= 'a' )&&( f[i] <= 'z' ) ) f[i]-=32;
|
|
138 glob( f,GLOB_APPEND,NULL,&gg );
|
|
139 free( f );
|
|
140 }
|
|
141 #endif
|
|
142
|
2901
|
143 // glob( ".*",GLOB_NOSORT | GLOB_APPEND,NULL,&gg );
|
|
144 pixmap=fpixmap; mask=fmask;
|
|
145 for( i=0;i<gg.gl_pathc;i++ )
|
|
146 {
|
|
147 stat( gg.gl_pathv[i],&fs );
|
|
148 if( S_ISDIR( fs.st_mode ) ) continue;
|
3499
|
149
|
|
150 str[0][1]=(gchar *)malloc( strlen( gg.gl_pathv[i] ) + 1 );
|
|
151 strcpy( str[0][1],gg.gl_pathv[i] );
|
2901
|
152 gtk_clist_append( GTK_CLIST( list ),str[0] );
|
3499
|
153 gtk_clist_set_pixmap( GTK_CLIST( list ),c++,0,pixmap,mask );
|
2901
|
154 free( str[0][1] );
|
|
155 }
|
|
156 globfree( &gg );
|
|
157
|
|
158 gtk_clist_set_column_width( GTK_CLIST( list ),0,17 );
|
|
159 gtk_clist_select_row( GTK_CLIST( list ),0,1 );
|
|
160 gtk_widget_show( list );
|
|
161 }
|
|
162
|
3499
|
163 void ShowFileSelect( int type )
|
|
164 {
|
|
165 int i;
|
|
166 if ( gtkVisibleFileSelect ) gtk_widget_hide( FileSelect );
|
|
167 fsType=type;
|
|
168 switch ( type )
|
|
169 {
|
|
170 case fsVideoSelector:
|
|
171 fsMessage=evFileLoaded;
|
|
172 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect );
|
|
173 fsList_items=NULL;
|
|
174 for( i=0;i<fsNumberOfVideoFilterNames + 1;i++ )
|
|
175 fsList_items=g_list_append( fsList_items,fsVideoFilterNames[i][0] );
|
|
176 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
|
|
177 g_list_free( fsList_items );
|
|
178 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsVideoFilterNames[fsNumberOfVideoFilterNames][0] );
|
|
179 break;
|
|
180 case fsSubtitleSelector:
|
|
181 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_SubtitleSelect );
|
|
182 fsList_items=NULL;
|
|
183 for( i=0;i<fsNumberOfSubtitleFilterNames + 1;i++ )
|
|
184 fsList_items=g_list_append( fsList_items,fsSubtitleFilterNames[i][0] );
|
|
185 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
|
|
186 g_list_free( fsList_items );
|
|
187 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsSubtitleFilterNames[fsNumberOfSubtitleFilterNames][0] );
|
|
188 break;
|
|
189 case fsOtherSelector:
|
|
190 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_OtherSelect );
|
|
191 fsList_items=NULL;
|
|
192 for( i=0;i<fsNumberOfSubtitleFilterNames + 1;i++ )
|
|
193 fsList_items=g_list_append( fsList_items,fsOtherFilterNames[i][0] );
|
|
194 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
|
|
195 g_list_free( fsList_items );
|
|
196 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsOtherFilterNames[fsNumberOfOtherFilterNames][0] );
|
|
197 break;
|
|
198 }
|
|
199 gtk_widget_show( FileSelect );
|
|
200 gtkVisibleFileSelect=1;
|
|
201 }
|
|
202
|
2901
|
203 void HideFileSelect( void )
|
|
204 {
|
|
205 gtk_widget_hide( fsFileSelect );
|
|
206 gtkVisibleFileSelect=0;
|
|
207 gtkShMem->vs.window=evLoad;
|
|
208 gtkSendMessage( evHideWindow );
|
|
209 }
|
|
210
|
|
211 void fs_fsFileSelect_destroy( GtkObject * object,gpointer user_data )
|
|
212 { HideFileSelect(); }
|
|
213
|
3499
|
214 void fs_fsFilterCombo_activate( GtkEditable * editable,gpointer user_data )
|
2901
|
215 {
|
3499
|
216 strcpy( fsFilter,gtk_entry_get_text( GTK_ENTRY( user_data ) ) );
|
|
217 CheckDir( fsFNameList,get_current_dir_name() );
|
2901
|
218 }
|
|
219
|
3499
|
220 void fs_fsFilterCombo_changed( GtkEditable * editable,gpointer user_data )
|
2901
|
221 {
|
3499
|
222 char * str;
|
|
223 int i;
|
2901
|
224
|
|
225 str=gtk_entry_get_text( GTK_ENTRY(user_data ) );
|
3499
|
226
|
|
227 switch ( fsType )
|
2901
|
228 {
|
3499
|
229 case fsVideoSelector:
|
|
230 for( i=0;i<fsNumberOfVideoFilterNames+1;i++ )
|
|
231 if( !strcmp( str,fsVideoFilterNames[i][0] ) )
|
|
232 {
|
|
233 strcpy( fsFilter,fsVideoFilterNames[i][1] );
|
|
234 CheckDir( fsFNameList,get_current_dir_name() );
|
|
235 break;
|
|
236 }
|
|
237 break;
|
|
238 case fsSubtitleSelector:
|
|
239 for( i=0;i<fsNumberOfSubtitleFilterNames+1;i++ )
|
|
240 if( !strcmp( str,fsSubtitleFilterNames[i][0] ) )
|
|
241 {
|
|
242 strcpy( fsFilter,fsSubtitleFilterNames[i][1] );
|
|
243 CheckDir( fsFNameList,get_current_dir_name() );
|
|
244 break;
|
|
245 }
|
|
246 break;
|
|
247 case fsOtherSelector:
|
|
248 for( i=0;i<fsNumberOfOtherFilterNames+1;i++ )
|
|
249 if( !strcmp( str,fsOtherFilterNames[i][0] ) )
|
|
250 {
|
|
251 strcpy( fsFilter,fsOtherFilterNames[i][1] );
|
|
252 CheckDir( fsFNameList,get_current_dir_name() );
|
|
253 break;
|
|
254 }
|
|
255 break;
|
2901
|
256 }
|
|
257 }
|
|
258
|
3499
|
259 void fs_fsPathCombo_activate( GtkEditable * editable,gpointer user_data )
|
2901
|
260 {
|
|
261 unsigned char * str;
|
|
262
|
|
263 str=gtk_entry_get_text( GTK_ENTRY( user_data ) );
|
3499
|
264 if ( chdir( str ) != -1 ) CheckDir( fsFNameList,get_current_dir_name() );
|
2901
|
265 }
|
|
266
|
3499
|
267 void fs_fsPathCombo_changed( GtkEditable * editable,gpointer user_data )
|
2901
|
268 {
|
|
269 unsigned char * str;
|
|
270
|
|
271 str=gtk_entry_get_text( GTK_ENTRY( user_data ) );
|
|
272 fsPressed=2;
|
3499
|
273 if ( chdir( str ) != -1 ) CheckDir( fsFNameList,get_current_dir_name() );
|
2901
|
274 }
|
|
275
|
|
276 void fs_Up_released( GtkButton * button,gpointer user_data )
|
|
277 {
|
|
278 chdir( ".." );
|
|
279 fsSelectedFile=fsThatDir;
|
3499
|
280 CheckDir( fsFNameList,get_current_dir_name() );
|
|
281 gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name() );
|
2901
|
282 return;
|
|
283 }
|
|
284
|
|
285 int fsFileExist( unsigned char * fname )
|
|
286 {
|
|
287 FILE * f = fopen( fname,"r" );
|
|
288 if ( f == NULL ) return 0;
|
|
289 fclose( f );
|
|
290 return 1;
|
|
291 }
|
|
292
|
|
293 void fs_Ok_released( GtkButton * button,gpointer user_data )
|
|
294 {
|
|
295 unsigned char * str;
|
|
296 GList * item;
|
|
297 int size,j,i = 1;
|
|
298 struct stat fs;
|
|
299
|
|
300 stat( fsSelectedFile,&fs );
|
|
301 if( S_ISDIR(fs.st_mode ) )
|
|
302 {
|
|
303 chdir( fsSelectedFile );
|
|
304 fsSelectedFile=fsThatDir;
|
3499
|
305 CheckDir( fsFNameList,get_current_dir_name() );
|
|
306 gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name() );
|
2901
|
307 return;
|
|
308 }
|
|
309
|
|
310 HideFileSelect();
|
|
311
|
|
312 switch( fsPressed )
|
|
313 {
|
|
314 case 1:
|
|
315 fsSelectedDirectory=(unsigned char *)get_current_dir_name();
|
3499
|
316 // printf("[gtk-fs] 1-fsSelectedFile: %s\n",fsSelectedFile);
|
|
317 // #ifdef DEBUG
|
|
318 // dbprintf( 1,"[gtk-fs] fsSelectedFile: %s\n",fsSelectedFile );
|
|
319 // #endif
|
2901
|
320 break;
|
|
321 case 2:
|
3499
|
322 str=gtk_entry_get_text( GTK_ENTRY( fsPathCombo ) );
|
2901
|
323 fsSelectedFile=str;
|
3499
|
324 // printf("[gtk-fs] 2-fsSelectedFile: '%s' \n",fsSelectedFile);
|
|
325 // #ifdef DEBUG
|
|
326 // dbprintf( 1,"[gtk-fs] fsSelectedFile: %s\n",fsSelectedFile );
|
|
327 // #endif
|
2901
|
328 if ( !fsFileExist( fsSelectedFile ) ) return;
|
|
329 fsSelectedDirectory=fsSelectedFile;
|
|
330 size=strlen( fsSelectedDirectory );
|
|
331 for ( j=0;j<size;j++ )
|
|
332 {
|
|
333 if ( fsSelectedDirectory[ size - j ] == '/' )
|
|
334 {
|
|
335 fsSelectedFile+=size - j + 1;
|
|
336 fsSelectedDirectory[ size - j ]=0;
|
|
337 break;
|
|
338 }
|
|
339 }
|
3499
|
340 // printf("[gtk-fs-xxx] fsSelectedFile: '%s' \n",fsSelectedFile);
|
|
341 // printf("[gtk-fs-xxx] fsSelectedDirectory: '%s' \n",fsSelectedDirectory);
|
2901
|
342 break;
|
|
343 }
|
3499
|
344 // printf( "----gtk---> directory: %s\n",fsSelectedDirectory );
|
|
345 // printf( "----gtk---> filename: %s\n",fsSelectedFile );
|
|
346 switch ( fsType )
|
|
347 {
|
|
348 case fsVideoSelector:
|
|
349 strcpy( gtkShMem->fs.dir,fsSelectedDirectory );
|
|
350 strcpy( gtkShMem->fs.filename,fsSelectedFile );
|
|
351 // printf( "----gtksm-> directory: %s\n",gtkShMem->fs.dir );
|
|
352 // printf( "----gtksm-> filename: %s\n",gtkShMem->fs.filename );
|
|
353 gtkSendMessage( evFileLoaded );
|
|
354 break;
|
|
355 case fsSubtitleSelector:
|
|
356 strcpy( gtkShMem->fs.subtitlename,fsSelectedDirectory );
|
|
357 strcat( gtkShMem->fs.subtitlename,"/" );
|
|
358 strcat( gtkShMem->fs.subtitlename,fsSelectedFile );
|
|
359 gtkSendMessage( evSubtitleLoaded );
|
|
360 break;
|
|
361 case fsOtherSelector:
|
|
362 strcpy( gtkShMem->fs.otherfilename,fsSelectedDirectory );
|
|
363 strcat( gtkShMem->fs.subtitlename,"/" );
|
|
364 strcat( gtkShMem->fs.otherfilename,fsSelectedFile );
|
|
365 break;
|
|
366 }
|
2901
|
367 item=fsTopList_items;
|
|
368 while( item )
|
|
369 {
|
|
370 if ( !strcmp( item->data,fsSelectedDirectory ) ) i=0;
|
|
371 item=item->next;
|
|
372 }
|
|
373 if ( i )
|
|
374 {
|
|
375 fsTopList_items=g_list_prepend( fsTopList_items,(gchar *)get_current_dir_name() );
|
|
376 gtk_combo_set_popdown_strings( GTK_COMBO( user_data ),fsTopList_items );
|
|
377 }
|
|
378 }
|
|
379
|
|
380 void fs_Cancel_released( GtkButton * button,gpointer user_data )
|
|
381 { HideFileSelect(); }
|
|
382
|
|
383 void fs_fsFNameList_select_row( GtkWidget * widget,gint row,gint column,GdkEventButton *bevent,gpointer user_data )
|
|
384 {
|
3499
|
385 gtk_clist_get_text( GTK_CLIST(widget ),row,1,&fsSelectedFile );
|
2901
|
386 fsPressed=1;
|
|
387 if( !bevent ) return;
|
|
388 if( bevent->type == GDK_2BUTTON_PRESS ) gtk_button_released( GTK_BUTTON( fsOk ) );
|
|
389 }
|
|
390
|
|
391 gboolean on_FileSelect_key_release_event( GtkWidget * widget,GdkEventKey * event,gpointer user_data )
|
|
392 {
|
|
393 switch ( event->keyval )
|
|
394 {
|
|
395 case GDK_Escape:
|
|
396 gtk_button_released( GTK_BUTTON( fsCancel ) );
|
|
397 break;
|
|
398 case GDK_Return:
|
|
399 gtk_button_released( GTK_BUTTON( fsOk ) );
|
|
400 break;
|
|
401 case GDK_BackSpace:
|
|
402 gtk_button_released( GTK_BUTTON( fsUp ) );
|
|
403 break;
|
|
404 }
|
|
405 return FALSE;
|
|
406 }
|
|
407
|
|
408 GtkWidget * create_FileSelect( void )
|
|
409 {
|
|
410 GtkWidget * FSFrame;
|
|
411 GtkWidget * frame2;
|
|
412 GtkWidget * frame3;
|
|
413 GtkWidget * frame4;
|
|
414 GtkWidget * vbox4;
|
|
415 GtkWidget * hbox4;
|
|
416 GtkWidget * vseparator1;
|
|
417 GtkWidget * hseparator1;
|
|
418 GtkWidget * hbox6;
|
|
419 GtkWidget * fsFNameListWindow;
|
|
420 GtkWidget * label1;
|
|
421 GtkWidget * hseparator2;
|
|
422 GtkWidget * hseparator3;
|
|
423 GtkWidget * hbuttonbox3;
|
|
424 int i;
|
|
425
|
|
426 GtkWidget * uppixmapwid;
|
|
427 GdkPixmap * uppixmap;
|
|
428 GdkBitmap * upmask;
|
|
429 GtkStyle * upstyle;
|
|
430
|
|
431 fsFileSelect=gtk_window_new( GTK_WINDOW_DIALOG );
|
|
432 gtk_widget_set_name( fsFileSelect,"fsFileSelect" );
|
|
433 gtk_object_set_data( GTK_OBJECT( fsFileSelect ),"fsFileSelect",fsFileSelect );
|
|
434 gtk_widget_set_usize( fsFileSelect,416,256 );
|
|
435 GTK_WIDGET_SET_FLAGS( fsFileSelect,GTK_CAN_DEFAULT );
|
|
436 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 );
|
|
437 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect );
|
|
438 gtk_window_set_position( GTK_WINDOW( fsFileSelect ),GTK_WIN_POS_CENTER );
|
|
439 gtk_window_set_policy( GTK_WINDOW( fsFileSelect ),FALSE,FALSE,TRUE );
|
|
440 fsColorMap=gdk_colormap_get_system();
|
|
441
|
3499
|
442 style=gtk_widget_get_style( fsFileSelect );
|
|
443 dpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&dmask,&style->bg[GTK_STATE_NORMAL],(gchar **)dir_xpm );
|
|
444 fpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&fmask,&style->bg[GTK_STATE_NORMAL],(gchar **)file_xpm );
|
|
445
|
2901
|
446 FSFrame=gtk_frame_new( NULL );
|
|
447 gtk_widget_set_name( FSFrame,"FSFrame" );
|
|
448 gtk_widget_ref( FSFrame );
|
|
449 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"FSFrame",FSFrame,
|
|
450 ( GtkDestroyNotify ) gtk_widget_unref );
|
|
451 gtk_widget_show( FSFrame );
|
|
452 gtk_container_add( GTK_CONTAINER( fsFileSelect ),FSFrame );
|
|
453 gtk_container_set_border_width( GTK_CONTAINER( FSFrame ),1 );
|
|
454 gtk_frame_set_shadow_type( GTK_FRAME( FSFrame ),GTK_SHADOW_IN );
|
|
455
|
|
456 frame2=gtk_frame_new( NULL );
|
|
457 gtk_widget_set_name( frame2,"frame2" );
|
|
458 gtk_widget_ref( frame2 );
|
|
459 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"frame2",frame2,
|
|
460 ( GtkDestroyNotify ) gtk_widget_unref );
|
|
461 gtk_widget_show( frame2 );
|
|
462 gtk_container_add( GTK_CONTAINER( FSFrame ),frame2 );
|
|
463 gtk_frame_set_shadow_type( GTK_FRAME( frame2 ),GTK_SHADOW_NONE );
|
|
464
|
|
465 frame3=gtk_frame_new( NULL );
|
|
466 gtk_widget_set_name( frame3,"frame3" );
|
|
467 gtk_widget_ref( frame3 );
|
|
468 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"frame3",frame3,
|
|
469 ( GtkDestroyNotify ) gtk_widget_unref );
|
|
470 gtk_widget_show( frame3 );
|
|
471 gtk_container_add( GTK_CONTAINER( frame2 ),frame3 );
|
|
472 gtk_frame_set_shadow_type( GTK_FRAME( frame3 ),GTK_SHADOW_ETCHED_OUT );
|
|
473
|
|
474 frame4=gtk_frame_new( NULL );
|
|
475 gtk_widget_set_name( frame4,"frame4" );
|
|
476 gtk_widget_ref( frame4 );
|
|
477 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"frame4",frame4,
|
|
478 ( GtkDestroyNotify ) gtk_widget_unref );
|
|
479 gtk_widget_show( frame4 );
|
|
480 gtk_container_add( GTK_CONTAINER( frame3 ),frame4 );
|
|
481 gtk_container_set_border_width( GTK_CONTAINER( frame4 ),1 );
|
|
482 gtk_frame_set_shadow_type( GTK_FRAME( frame4 ),GTK_SHADOW_NONE );
|
|
483
|
|
484 vbox4=gtk_vbox_new( FALSE,0 );
|
|
485 gtk_widget_set_name( vbox4,"vbox4" );
|
|
486 gtk_widget_ref( vbox4 );
|
|
487 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"vbox4",vbox4,
|
|
488 ( GtkDestroyNotify ) gtk_widget_unref );
|
|
489 gtk_widget_show( vbox4 );
|
|
490 gtk_container_add( GTK_CONTAINER( frame4 ),vbox4 );
|
|
491
|
|
492 hbox4=gtk_hbox_new( FALSE,0 );
|
|
493 gtk_widget_set_name( hbox4,"hbox4" );
|
|
494 gtk_widget_ref( hbox4 );
|
|
495 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"hbox4",hbox4,
|
|
496 ( GtkDestroyNotify ) gtk_widget_unref );
|
|
497 gtk_widget_show( hbox4 );
|
|
498 gtk_box_pack_start( GTK_BOX( vbox4 ),hbox4,TRUE,TRUE,0 );
|
|
499
|
|
500 fsCombo4=gtk_combo_new();
|
|
501 gtk_widget_set_name( fsCombo4,"fsCombo4" );
|
|
502 gtk_widget_ref( fsCombo4 );
|
|
503 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"fsCombo4",fsCombo4,
|
|
504 ( GtkDestroyNotify ) gtk_widget_unref );
|
|
505 gtk_widget_show( fsCombo4 );
|
|
506 gtk_box_pack_start( GTK_BOX( hbox4 ),fsCombo4,TRUE,TRUE,0 );
|
|
507 gtk_widget_set_usize( fsCombo4,-2,20 );
|
|
508
|
|
509 fsTopList_items=g_list_append( fsTopList_items,(gchar *)get_current_dir_name() );
|
|
510 if ( getenv( "HOME" ) ) fsTopList_items=g_list_append( fsTopList_items,getenv( "HOME" ) );
|
|
511 fsTopList_items=g_list_append( fsTopList_items,"/home" );
|
|
512 fsTopList_items=g_list_append( fsTopList_items,"/mnt" );
|
|
513 fsTopList_items=g_list_append( fsTopList_items,"/" );
|
|
514 gtk_combo_set_popdown_strings( GTK_COMBO( fsCombo4 ),fsTopList_items );
|
|
515
|
3499
|
516 fsPathCombo=GTK_COMBO( fsCombo4 )->entry;
|
|
517 gtk_widget_set_name( fsPathCombo,"fsPathCombo" );
|
|
518 gtk_widget_ref( fsPathCombo );
|
|
519 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"fsPathCombo",fsPathCombo,( GtkDestroyNotify ) gtk_widget_unref );
|
|
520 gtk_widget_show( fsPathCombo );
|
|
521 gtk_widget_set_usize( fsPathCombo,-2,20 );
|
2901
|
522
|
|
523 vseparator1=gtk_vseparator_new();
|
|
524 gtk_widget_set_name( vseparator1,"vseparator1" );
|
|
525 gtk_widget_ref( vseparator1 );
|
|
526 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"vseparator1",vseparator1,
|
|
527 ( GtkDestroyNotify ) gtk_widget_unref );
|
|
528 gtk_widget_show( vseparator1 );
|
|
529 gtk_box_pack_start( GTK_BOX( hbox4 ),vseparator1,FALSE,TRUE,0 );
|
|
530 gtk_widget_set_usize( vseparator1,7,20 );
|
|
531
|
|
532 upstyle=gtk_widget_get_style( fsFileSelect );
|
|
533 uppixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&upmask,&upstyle->bg[GTK_STATE_NORMAL],(gchar **)up_xpm );
|
|
534 uppixmapwid=gtk_pixmap_new( uppixmap,upmask );
|
|
535 gtk_widget_show( uppixmapwid );
|
|
536
|
|
537 fsUp=gtk_button_new();
|
|
538 gtk_container_add( GTK_CONTAINER(fsUp ),uppixmapwid );
|
|
539 gtk_widget_show( fsUp );
|
|
540 gtk_box_pack_start( GTK_BOX( hbox4 ),fsUp,FALSE,FALSE,0 );
|
|
541 gtk_widget_set_usize( fsUp,65,15 );
|
|
542
|
|
543 hseparator1=gtk_hseparator_new();
|
|
544 gtk_widget_set_name( hseparator1,"hseparator1" );
|
|
545 gtk_widget_ref( hseparator1 );
|
|
546 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"hseparator1",hseparator1,
|
|
547 ( GtkDestroyNotify ) gtk_widget_unref );
|
|
548 gtk_widget_show( hseparator1 );
|
|
549 gtk_box_pack_start( GTK_BOX( vbox4 ),hseparator1,FALSE,TRUE,0 );
|
|
550 gtk_widget_set_usize( hseparator1,-2,8 );
|
|
551
|
|
552 hbox6=gtk_hbox_new( FALSE,0 );
|
|
553 gtk_widget_set_name( hbox6,"hbox6" );
|
|
554 gtk_widget_ref( hbox6 );
|
|
555 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"hbox6",hbox6,
|
|
556 ( GtkDestroyNotify ) gtk_widget_unref );
|
|
557 gtk_widget_show( hbox6 );
|
|
558 gtk_box_pack_start( GTK_BOX( vbox4 ),hbox6,TRUE,TRUE,0 );
|
|
559
|
|
560 fsFNameListWindow=gtk_scrolled_window_new( NULL,NULL );
|
|
561 gtk_widget_set_name( fsFNameListWindow,"fsFNameListWindow" );
|
|
562 gtk_widget_ref( fsFNameListWindow );
|
|
563 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"fsFNameListWindow",fsFNameListWindow,
|
|
564 ( GtkDestroyNotify ) gtk_widget_unref );
|
|
565 gtk_widget_show( fsFNameListWindow );
|
|
566 gtk_box_pack_start( GTK_BOX( hbox6 ),fsFNameListWindow,TRUE,TRUE,0 );
|
|
567 gtk_widget_set_usize( fsFNameListWindow,-2,145 );
|
|
568 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( fsFNameListWindow ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC );
|
|
569
|
|
570 fsFNameList=gtk_clist_new( 2 );
|
|
571 gtk_widget_set_name( fsFNameList,"fsFNameList" );
|
|
572 gtk_widget_ref( fsFNameList );
|
|
573 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"fsFNameList",fsFNameList,
|
|
574 ( GtkDestroyNotify ) gtk_widget_unref );
|
|
575 gtk_container_add( GTK_CONTAINER( fsFNameListWindow ),fsFNameList );
|
|
576 gtk_clist_set_column_width( GTK_CLIST( fsFNameList ),0,80 );
|
|
577 gtk_clist_set_selection_mode( GTK_CLIST( fsFNameList ),GTK_SELECTION_BROWSE );
|
|
578 gtk_clist_column_titles_hide( GTK_CLIST( fsFNameList ) );
|
|
579 gtk_clist_set_shadow_type( GTK_CLIST( fsFNameList ),GTK_SHADOW_ETCHED_OUT );
|
3499
|
580 CheckDir( fsFNameList,get_current_dir_name() );
|
2901
|
581
|
|
582 label1=gtk_label_new( "label1" );
|
|
583 gtk_widget_set_name( label1,"label1" );
|
|
584 gtk_widget_ref( label1 );
|
|
585 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"label1",label1,
|
|
586 ( GtkDestroyNotify ) gtk_widget_unref );
|
|
587 gtk_widget_show( label1 );
|
|
588 gtk_clist_set_column_widget( GTK_CLIST( fsFNameList ),0,label1 );
|
|
589
|
|
590 hseparator2=gtk_hseparator_new();
|
|
591 gtk_widget_set_name( hseparator2,"hseparator2" );
|
|
592 gtk_widget_ref( hseparator2 );
|
|
593 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"hseparator2",hseparator2,
|
|
594 ( GtkDestroyNotify ) gtk_widget_unref );
|
|
595 gtk_widget_show( hseparator2 );
|
|
596 gtk_box_pack_start( GTK_BOX( vbox4 ),hseparator2,FALSE,TRUE,0 );
|
|
597 gtk_widget_set_usize( hseparator2,-2,9 );
|
|
598
|
|
599 List=gtk_combo_new();
|
|
600 gtk_widget_set_name( List,"List" );
|
|
601 gtk_widget_ref( List );
|
|
602 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"List",List,
|
|
603 ( GtkDestroyNotify ) gtk_widget_unref );
|
|
604 gtk_widget_show( List );
|
|
605 gtk_box_pack_start( GTK_BOX( vbox4 ),List,FALSE,FALSE,0 );
|
|
606 gtk_widget_set_usize( List,-2,20 );
|
|
607 fsList_items=NULL;
|
3499
|
608 for( i=0;i<fsNumberOfVideoFilterNames + 1;i++ )
|
|
609 fsList_items=g_list_append( fsList_items,fsVideoFilterNames[i][0] );
|
2901
|
610 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
|
|
611 g_list_free( fsList_items );
|
|
612
|
3499
|
613 fsFilterCombo=GTK_COMBO( List )->entry;
|
|
614 gtk_widget_set_name( fsFilterCombo,"fsFilterCombo" );
|
|
615 gtk_widget_ref( fsFilterCombo );
|
|
616 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"fsFilterCombo",fsFilterCombo,
|
2901
|
617 ( GtkDestroyNotify ) gtk_widget_unref );
|
3499
|
618 gtk_widget_show( fsFilterCombo );
|
|
619 gtk_entry_set_editable (GTK_ENTRY( fsFilterCombo ),FALSE );
|
|
620 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsVideoFilterNames[fsNumberOfVideoFilterNames][0] );
|
2901
|
621
|
|
622 hseparator3=gtk_hseparator_new();
|
|
623 gtk_widget_set_name( hseparator3,"hseparator3" );
|
|
624 gtk_widget_ref( hseparator3 );
|
|
625 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"hseparator3",hseparator3,
|
|
626 ( GtkDestroyNotify ) gtk_widget_unref );
|
|
627 gtk_widget_show( hseparator3 );
|
|
628 gtk_box_pack_start( GTK_BOX( vbox4 ),hseparator3,FALSE,TRUE,0 );
|
|
629 gtk_widget_set_usize( hseparator3,-2,7 );
|
|
630
|
|
631 hbuttonbox3=gtk_hbutton_box_new();
|
|
632 gtk_widget_set_name( hbuttonbox3,"hbuttonbox3" );
|
|
633 gtk_widget_ref( hbuttonbox3 );
|
|
634 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"hbuttonbox3",hbuttonbox3,
|
|
635 ( GtkDestroyNotify ) gtk_widget_unref );
|
|
636 gtk_widget_show( hbuttonbox3 );
|
|
637 gtk_box_pack_start( GTK_BOX( vbox4 ),hbuttonbox3,FALSE,TRUE,0 );
|
|
638 gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox3 ),GTK_BUTTONBOX_END );
|
|
639 gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox3 ),10 );
|
|
640 gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox3 ),85,20 );
|
|
641 gtk_button_box_set_child_ipadding( GTK_BUTTON_BOX( hbuttonbox3 ),0,0 );
|
|
642
|
|
643 fsOk=gtk_button_new_with_label( MSGTR_Ok );
|
|
644 gtk_widget_set_name( fsOk,MSGTR_Ok );
|
|
645 gtk_widget_ref( fsOk );
|
|
646 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),MSGTR_Ok,fsOk,( GtkDestroyNotify )gtk_widget_unref );
|
|
647 gtk_container_add( GTK_CONTAINER( hbuttonbox3 ),fsOk );
|
|
648 gtk_widget_show( fsOk );
|
|
649
|
|
650 fsCancel=gtk_button_new_with_label( MSGTR_Cancel );
|
|
651 gtk_widget_set_name( fsCancel,MSGTR_Cancel );
|
|
652 gtk_widget_ref( fsCancel );
|
|
653 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),MSGTR_Cancel,fsCancel,( GtkDestroyNotify )gtk_widget_unref );
|
|
654 gtk_container_add( GTK_CONTAINER( hbuttonbox3 ),fsCancel );
|
|
655 gtk_widget_show( fsCancel );
|
|
656
|
|
657 gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"destroy",
|
|
658 GTK_SIGNAL_FUNC( fs_fsFileSelect_destroy ),
|
|
659 NULL );
|
|
660 gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"key_release_event",
|
|
661 GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),
|
|
662 NULL );
|
3499
|
663 gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"changed",
|
|
664 GTK_SIGNAL_FUNC( fs_fsFilterCombo_changed ),
|
|
665 fsFilterCombo );
|
|
666 gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"activate",
|
|
667 GTK_SIGNAL_FUNC( fs_fsFilterCombo_activate ),
|
|
668 fsFilterCombo );
|
|
669 gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"changed",
|
|
670 GTK_SIGNAL_FUNC( fs_fsPathCombo_changed ),
|
|
671 fsPathCombo );
|
|
672 gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"activate",
|
|
673 GTK_SIGNAL_FUNC( fs_fsPathCombo_activate ),
|
|
674 fsPathCombo );
|
2901
|
675 gtk_signal_connect( GTK_OBJECT( fsUp ),"released",
|
|
676 GTK_SIGNAL_FUNC( fs_Up_released ),
|
|
677 fsFNameList );
|
|
678 gtk_signal_connect( GTK_OBJECT( fsOk ),"released",
|
|
679 GTK_SIGNAL_FUNC( fs_Ok_released ),
|
|
680 fsCombo4 );
|
|
681 gtk_signal_connect( GTK_OBJECT( fsCancel ),"released",
|
|
682 GTK_SIGNAL_FUNC( fs_Cancel_released ),
|
|
683 NULL );
|
|
684
|
|
685 gtk_signal_connect( GTK_OBJECT( fsFNameList ),"select_row",
|
|
686 ( GtkSignalFunc ) fs_fsFNameList_select_row,
|
|
687 NULL );
|
|
688
|
|
689 gtk_widget_grab_focus( fsFNameList );
|
|
690
|
|
691 return fsFileSelect;
|
|
692 }
|
|
693
|