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