annotate Gui/mplayer/gtk/fs.c @ 6044:153fc4ed86ad

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