annotate Gui/mplayer/gtk/fs.c @ 6765:9c6ed4f15acc

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