annotate gui/ui/gtk/fileselect.c @ 33768:cee9987bc81d

Remove guiExit(). Integrate it into mplayer().
author ib
date Sat, 09 Jul 2011 10:23:47 +0000
parents 03824cf8728d
children 4fae8b19fbbd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
1 /*
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
2 * This file is part of MPlayer.
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
3 *
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
7 * (at your option) any later version.
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
8 *
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
12 * GNU General Public License for more details.
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
13 *
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License along
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
17 */
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
18
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
19 #include <stdlib.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
20 #include <stdio.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
21 #include <string.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
22 #include <sys/stat.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
23 #include <glob.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
24 #include <unistd.h>
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
25
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
26 #include "config.h"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
27 #include "gui/ui/gmplayer.h"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
28
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
29 #include "gui/ui/pixmaps/up.xpm"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
30 #include "gui/ui/pixmaps/dir.xpm"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
31 #include "gui/ui/pixmaps/file.xpm"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
32
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
33 #include "gui/app.h"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
34 #include "gui/interface.h"
33739
9f6d46d325de Remove gfree() from interface.c.
ib
parents: 33737
diff changeset
35 #include "gui/util/mem.h"
33737
71c29e8ec68f Move string functions from interface.c to string.c.
ib
parents: 33731
diff changeset
36 #include "gui/util/string.h"
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
37 #include "help_mp.h"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
38 #include "mpcommon.h"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
39 #include "stream/stream.h"
33751
c28c967e40e9 Replace numeric constant fsPersistant_MaxPos for fsHistory array size.
ib
parents: 33740
diff changeset
40 #include "libavutil/common.h"
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
41
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
42 #include "gui/ui/widgets.h"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
43 #include "fileselect.h"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
44 #include "preferences.h"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
45 #include "tools.h"
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
46
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
47 #ifndef __linux__
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
48 #define get_current_dir_name() getcwd(NULL, PATH_MAX)
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
49 #else
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
50 char * get_current_dir_name( void );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
51 #endif
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
52
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
53 gchar * fsSelectedFile = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
54 gchar * fsSelectedFileUtf8 = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
55 gchar * fsSelectedDirectory = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
56 unsigned char * fsThatDir = ".";
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
57 const gchar * fsFilter = "*";
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
58
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
59 int fsType = 0;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
60
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
61 char * fsVideoFilterNames[][2] =
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
62 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
63 { "ASF files (*.asf)", "*.asf" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
64 { "AVI files (*.avi)", "*.avi" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
65 { "Autodesk animations (*.fli,*.flc)", "*.fli,*.flc" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
66 { "DGStation Cuberevo recordings (*.trp)", "*.trp" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
67 { "DiVX files (*.divx)", "*.divx" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
68 { "MP3 files (*.mp3,*.mp2)", "*.mp3,*.mp2" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
69 { "MPEG files (*.mpg,*.mpeg,*.m1v)", "*.mpg,*.mpeg,*.m1v" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
70 { "Macromedia Flash Video (*.flv)", "*.flv" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
71 { "Matroska Audio files (*.mka)", "*.mka" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
72 { "Matroska Media files (*.mkv)", "*.mkv" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
73 { "NuppelVideo files (*.nuv)", "*.nuv" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
74 { "OGG Vorbis files (*.ogg)", "*.ogg" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
75 { "OGG Media files (*.ogm)", "*.ogm" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
76 { "QuickTime files (*.mov,*.qt,*.mp4)", "*.mov,*.qt,*.mp4" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
77 { "RealVideo files (*.rm,*.rmvb)", "*.rm,*.rmvb" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
78 { "Tivo files (*.ty)", "*.ty" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
79 { "VCD/SVCD Images (*.bin)", "*.bin" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
80 { "VIVO files (*.viv)", "*.viv" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
81 { "VOB files (*.vob)", "*.vob" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
82 { "Wave files (*.wav)", "*.wav" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
83 { "Windows Media Audio (*.wma)", "*.wma" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
84 { "Windows Media Video (*.wmv)", "*.wmv" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
85 { "Audio files", "*.mp2,*.mp3,*.mka,*.ogg,*.wav,*.wma" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
86 { "Video files", "*.asf,*.avi,*.fli,*.flc,*.trp,*.divx,*.mpg,*.mpeg,*.m1v,*.flv,*.mkv,*.nuv,*.ogm,*.mov,*.qt,*.mp4,*.rm,*.rmvb,*.ty,*.bin,*.viv,*.vob,*.wmv" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
87 { "All files", "*" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
88 { NULL,NULL }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
89 };
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
90 int fsLastVideoFilterSelected = -1;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
91
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
92 char * fsSubtitleFilterNames[][2] =
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
93 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
94 { "AQT (*.aqt)", "*.aqt" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
95 { "ASS (*.ass)", "*.ass" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
96 { "RT (*.rt) ", "*.rt" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
97 { "SMI (*.smi)", "*.smi" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
98 { "SRT (*.srt)", "*.srt" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
99 { "SSA (*.ssa)", "*.ssa" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
100 { "SUB (*.sub)", "*.sub" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
101 { "TXT (*.txt)", "*.txt" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
102 { "UTF (*.utf)", "*.utf" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
103 { "Subtitles", "*.aqt,*.ass,*.rt,*.smi,*.srt,*.ssa,*.sub,*.txt,*.utf" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
104 { "All files", "*" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
105 { NULL,NULL }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
106 };
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
107 int fsLastSubtitleFilterSelected = -1;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
108
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
109 char * fsOtherFilterNames[][2] =
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
110 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
111 { "All files", "*" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
112 { NULL,NULL }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
113 };
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
114
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
115 char * fsAudioFileNames[][2] =
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
116 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
117 { "MP3 files (*.mp2, *.mp3)", "*.mp2,*.mp3" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
118 { "Matroska Audio files (*.mka)", "*.mka" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
119 { "OGG Vorbis files (*.ogg)", "*.ogg" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
120 { "WAV files (*.wav)", "*.wav" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
121 { "WMA files (*.wma)", "*.wma" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
122 { "Audio files", "*.mp2,*.mp3,*.mka,*.ogg,*.wav,*.wma" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
123 { "All files", "*" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
124 { NULL, NULL }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
125 };
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
126 int fsLastAudioFilterSelected = -1;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
127
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
128 char * fsFontFileNames[][2] =
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
129 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
130 #ifdef CONFIG_FREETYPE
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
131 { "True Type fonts (*.ttf)", "*.ttf" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
132 { "Type1 fonts (*.pfb)", "*.pfb" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
133 { "All fonts", "*.ttf,*.pfb" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
134 #else
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
135 { "Font files (*.desc)", "*.desc" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
136 #endif
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
137 { "All files", "*" },
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
138 { NULL,NULL }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
139 };
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
140 int fsLastFontFilterSelected = -1;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
141
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
142 GtkWidget * fsFileNamesList;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
143 GtkWidget * fsFNameList;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
144 GtkWidget * fsFileSelect = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
145 GdkColormap * fsColorMap;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
146 GtkWidget * fsOk;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
147 GtkWidget * fsUp;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
148 GtkWidget * fsCancel;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
149 GtkWidget * fsCombo4;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
150 GtkWidget * fsPathCombo;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
151 GList * fsList_items = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
152 GList * fsTopList_items = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
153 GtkWidget * List;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
154 GtkWidget * fsFilterCombo;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
155
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
156 GtkStyle * style;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
157 GdkPixmap * dpixmap;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
158 GdkPixmap * fpixmap;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
159 GdkBitmap * dmask;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
160 GdkBitmap * fmask;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
161
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
162 static char * get_current_dir_name_utf8( void )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
163 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
164 char * dir, * utf8dir;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
165 dir = get_current_dir_name();
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
166 utf8dir = g_filename_to_utf8( dir, -1, NULL, NULL, NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
167 if ( !utf8dir ) utf8dir = g_strdup( dir );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
168 free( dir );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
169 return utf8dir;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
170 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
171
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
172 static char * Filter( const char * name )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
173 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
174 static char tmp[32];
33755
90a5fdb500db Use unsigned index variable for comparison with string length.
ib
parents: 33751
diff changeset
175 unsigned int i,c;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
176 for ( i=0,c=0;i < strlen( name );i++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
177 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
178 if ( ( name[i] >='a' )&&( name[i] <= 'z' ) ) { tmp[c++]='['; tmp[c++]=name[i]; tmp[c++]=name[i] - 32; tmp[c++]=']'; }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
179 else tmp[c++]=name[i];
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
180 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
181 tmp[c]=0;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
182 return tmp;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
183 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
184
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
185 static void clist_append_fname(GtkWidget * list, char *fname,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
186 GdkPixmap *pixmap, GdkPixmap *mask) {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
187 gint pos;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
188 gchar *filename, *str[2];
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
189 filename = g_filename_to_utf8(fname, -1, NULL, NULL, NULL);
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
190 str[0] = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
191 str[1] = filename ? filename : fname;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
192 pos = gtk_clist_append(GTK_CLIST(list), str);
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
193 gtk_clist_set_pixmap(GTK_CLIST(list), pos, 0, pixmap, mask);
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
194 g_free(filename);
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
195 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
196
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
197 static void CheckDir( GtkWidget * list )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
198 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
199 struct stat fs;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
200 int i;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
201 glob_t gg;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
202
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
203 if ( !fsFilter[0] ) return;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
204
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
205 gtk_widget_hide( list );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
206 gtk_clist_clear( GTK_CLIST( list ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
207
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
208 clist_append_fname(list, ".", dpixmap, dmask);
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
209 clist_append_fname(list, "..", dpixmap, dmask);
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
210
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
211 glob( "*",0,NULL,&gg );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
212 for( i=0;(unsigned)i<gg.gl_pathc;i++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
213 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
214 stat( gg.gl_pathv[i],&fs );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
215 if( !S_ISDIR( fs.st_mode ) ) continue;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
216 clist_append_fname(list, gg.gl_pathv[i], dpixmap, dmask);
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
217 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
218 globfree( &gg );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
219
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
220 if ( strchr( fsFilter,',' ) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
221 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
222 char tmp[8];
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
223 int i,c,glob_param = 0;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
224 for ( i=0,c=0;i<(int)strlen( fsFilter ) + 1;i++,c++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
225 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
226 tmp[c]=fsFilter[i];
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
227 if ( ( tmp[c] == ',' )||( tmp[c] == '\0' ) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
228 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
229 tmp[c]=0; c=-1;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
230 glob( Filter( tmp ),glob_param,NULL,&gg );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
231 glob_param=GLOB_APPEND;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
232 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
233 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
234 } else glob( Filter( fsFilter ),0,NULL,&gg );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
235
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
236 for( i=0;(unsigned)i<gg.gl_pathc;i++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
237 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
238 stat( gg.gl_pathv[i],&fs );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
239 if( S_ISDIR( fs.st_mode ) ) continue;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
240 clist_append_fname(list, gg.gl_pathv[i], fpixmap, fmask);
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
241 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
242 globfree( &gg );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
243
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
244 gtk_clist_set_column_width( GTK_CLIST( list ),0,17 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
245 gtk_clist_select_row( GTK_CLIST( list ),0,1 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
246 gtk_widget_show( list );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
247 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
248
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
249 void ShowFileSelect( int type,int modal )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
250 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
251 int i, k;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
252 char * tmp = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
253
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
254 if ( fsFileSelect ) gtkActive( fsFileSelect );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
255 else fsFileSelect=create_FileSelect();
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
256
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
257 fsType=type;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
258 switch ( type )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
259 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
260 case fsVideoSelector:
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
261 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
262 fsList_items=NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
263 for( i=0;fsVideoFilterNames[i][0];i++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
264 fsList_items=g_list_append( fsList_items,fsVideoFilterNames[i][0] );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
265 k = fsLastVideoFilterSelected;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
266 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
267 g_list_free( fsList_items );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
268 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsVideoFilterNames[k >= 0 ? k : i-2][0] );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
269 tmp=guiInfo.Filename;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
270 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
271 case fsSubtitleSelector:
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
272 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_SubtitleSelect );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
273 fsList_items=NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
274 for( i=0;fsSubtitleFilterNames[i][0];i++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
275 fsList_items=g_list_append( fsList_items,fsSubtitleFilterNames[i][0] );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
276 k = fsLastSubtitleFilterSelected;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
277 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
278 g_list_free( fsList_items );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
279 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsSubtitleFilterNames[k >= 0 ? k : i-2][0] );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
280 tmp=guiInfo.Subtitlename;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
281 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
282 case fsOtherSelector:
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
283 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_OtherSelect );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
284 fsList_items=NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
285 for( i=0;fsOtherFilterNames[i][0];i++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
286 fsList_items=g_list_append( fsList_items,fsOtherFilterNames[i][0] );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
287 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
288 g_list_free( fsList_items );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
289 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsOtherFilterNames[0][0] );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
290 tmp=guiInfo.Othername;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
291 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
292 case fsAudioSelector:
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
293 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_AudioFileSelect );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
294 fsList_items=NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
295 for( i=0;fsAudioFileNames[i][0];i++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
296 fsList_items=g_list_append( fsList_items,fsAudioFileNames[i][0] );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
297 k = fsLastAudioFilterSelected;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
298 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
299 g_list_free( fsList_items );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
300 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsAudioFileNames[k >= 0 ? k : i-2][0] );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
301 tmp=guiInfo.AudioFile;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
302 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
303 case fsFontSelector:
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
304 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FontSelect );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
305 fsList_items=NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
306 for( i=0;fsFontFileNames[i][0];i++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
307 fsList_items=g_list_append( fsList_items,fsFontFileNames[i][0] );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
308 k = fsLastFontFilterSelected;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
309 gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
310 g_list_free( fsList_items );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
311 gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsFontFileNames[k >= 0 ? k : i-2][0] );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
312 tmp=font_name;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
313 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
314 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
315
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
316 if ( tmp && tmp[0] )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
317 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
318 struct stat f;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
319 char * dir = strdup( tmp );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
320
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
321 do
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
322 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
323 char * c = strrchr( dir,'/' );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
324 stat( dir,&f );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
325 if ( S_ISDIR( f.st_mode ) ) break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
326 if ( c ) *c=0;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
327 } while ( strrchr( dir,'/' ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
328
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
329 if ( dir[0] ) chdir( dir );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
330
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
331 free( dir );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
332 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
333
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
334 if ( fsTopList_items ) g_list_free( fsTopList_items ); fsTopList_items=NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
335 {
33751
c28c967e40e9 Replace numeric constant fsPersistant_MaxPos for fsHistory array size.
ib
parents: 33740
diff changeset
336 unsigned int i, c = 1;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
337
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
338 if ( fsType == fsVideoSelector )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
339 {
33751
c28c967e40e9 Replace numeric constant fsPersistant_MaxPos for fsHistory array size.
ib
parents: 33740
diff changeset
340 for ( i=0;i < FF_ARRAY_ELEMS(fsHistory);i++ )
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
341 if ( fsHistory[i] ) { fsTopList_items=g_list_append( fsTopList_items,fsHistory[i] ); c=0; }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
342 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
343 if ( c ) fsTopList_items=g_list_append( fsTopList_items,(gchar *)get_current_dir_name_utf8() );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
344 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
345 if ( getenv( "HOME" ) ) fsTopList_items=g_list_append( fsTopList_items,getenv( "HOME" ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
346 fsTopList_items=g_list_append( fsTopList_items,"/home" );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
347 fsTopList_items=g_list_append( fsTopList_items,"/mnt" );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
348 fsTopList_items=g_list_append( fsTopList_items,"/" );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
349 gtk_combo_set_popdown_strings( GTK_COMBO( fsCombo4 ),fsTopList_items );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
350
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
351 gtk_window_set_modal( GTK_WINDOW( fsFileSelect ),modal );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
352
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
353 gtk_widget_show( fsFileSelect );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
354 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
355
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
356 void HideFileSelect( void )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
357 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
358 if ( !fsFileSelect ) return;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
359 gtk_widget_hide( fsFileSelect );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
360 gtk_widget_destroy( fsFileSelect );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
361 fsFileSelect=NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
362 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
363
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
364 static void fs_PersistantHistory( char * subject )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
365 {
33751
c28c967e40e9 Replace numeric constant fsPersistant_MaxPos for fsHistory array size.
ib
parents: 33740
diff changeset
366 unsigned int i;
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
367
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
368 if ( fsType != fsVideoSelector ) return;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
369
33751
c28c967e40e9 Replace numeric constant fsPersistant_MaxPos for fsHistory array size.
ib
parents: 33740
diff changeset
370 for ( i=0;i < FF_ARRAY_ELEMS(fsHistory);i++ )
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
371 if ( fsHistory[i] && !strcmp( fsHistory[i],subject ) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
372 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
373 char * tmp = fsHistory[i]; fsHistory[i]=fsHistory[0]; fsHistory[0]=tmp;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
374 return;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
375 }
33751
c28c967e40e9 Replace numeric constant fsPersistant_MaxPos for fsHistory array size.
ib
parents: 33740
diff changeset
376 nfree( fsHistory[FF_ARRAY_ELEMS(fsHistory) - 1] );
c28c967e40e9 Replace numeric constant fsPersistant_MaxPos for fsHistory array size.
ib
parents: 33740
diff changeset
377 for ( i=FF_ARRAY_ELEMS(fsHistory) - 1;i;i-- ) fsHistory[i]=fsHistory[i - 1];
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
378 fsHistory[0]=gstrdup( subject );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
379 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
380 //-----------------------------------------------
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
381
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
382 static void fs_fsFilterCombo_activate( GtkEditable * editable,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
383 gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
384 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
385 fsFilter=gtk_entry_get_text( GTK_ENTRY( user_data ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
386 CheckDir( fsFNameList );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
387 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
388
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
389 static void fs_fsFilterCombo_changed( GtkEditable * editable,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
390 gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
391 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
392 const char * str;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
393 int i;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
394
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
395 str=gtk_entry_get_text( GTK_ENTRY(user_data ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
396
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
397 switch ( fsType )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
398 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
399 case fsVideoSelector:
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
400 for( i=0;fsVideoFilterNames[i][0];i++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
401 if( !strcmp( str,fsVideoFilterNames[i][0] ) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
402 { fsFilter=fsVideoFilterNames[i][1]; fsLastVideoFilterSelected = i; break; }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
403 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
404 case fsSubtitleSelector:
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
405 for( i=0;fsSubtitleFilterNames[i][0];i++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
406 if( !strcmp( str,fsSubtitleFilterNames[i][0] ) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
407 { fsFilter=fsSubtitleFilterNames[i][1]; fsLastSubtitleFilterSelected = i; break; }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
408 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
409 case fsOtherSelector:
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
410 for( i=0;fsOtherFilterNames[i][0];i++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
411 if( !strcmp( str,fsOtherFilterNames[i][0] ) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
412 { fsFilter=fsOtherFilterNames[i][1]; break; }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
413 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
414 case fsAudioSelector:
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
415 for( i=0;fsAudioFileNames[i][0];i++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
416 if( !strcmp( str,fsAudioFileNames[i][0] ) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
417 { fsFilter=fsAudioFileNames[i][1]; fsLastAudioFilterSelected = i; break; }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
418 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
419 case fsFontSelector:
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
420 for( i=0;fsFontFileNames[i][0];i++ )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
421 if( !strcmp( str,fsFontFileNames[i][0] ) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
422 { fsFilter=fsFontFileNames[i][1]; fsLastFontFilterSelected = i; break; }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
423 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
424 default: return;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
425 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
426 CheckDir( fsFNameList );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
427 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
428
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
429 static void fs_fsPathCombo_activate( GtkEditable * editable,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
430 gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
431 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
432 const unsigned char * str;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
433 gchar * dirname;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
434
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
435 str=gtk_entry_get_text( GTK_ENTRY( user_data ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
436 dirname = g_filename_from_utf8( str, -1, NULL, NULL, NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
437 if ( chdir( dirname ? (const unsigned char *)dirname : str ) != -1 ) CheckDir( fsFNameList );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
438 g_free( dirname );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
439 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
440
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
441 static void fs_fsPathCombo_changed( GtkEditable * editable,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
442 gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
443 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
444 const unsigned char * str;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
445 gchar * dirname;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
446
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
447 str=gtk_entry_get_text( GTK_ENTRY( user_data ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
448 dirname = g_filename_from_utf8( str, -1, NULL, NULL, NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
449 if ( chdir( dirname ? (const unsigned char *)dirname : str ) != -1 ) CheckDir( fsFNameList );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
450 g_free( dirname );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
451 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
452
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
453 static void fs_Up_released( GtkButton * button, gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
454 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
455 chdir( ".." );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
456 fsSelectedFile=fsThatDir;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
457 CheckDir( fsFNameList );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
458 gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name_utf8() );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
459 return;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
460 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
461
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
462 static void fs_Ok_released( GtkButton * button, gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
463 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
464 GList * item;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
465 int i = 1;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
466 struct stat fs;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
467
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
468 stat( fsSelectedFile,&fs );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
469 if( S_ISDIR(fs.st_mode ) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
470 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
471 chdir( fsSelectedFile );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
472 fsSelectedFile=fsThatDir;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
473 CheckDir( fsFNameList );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
474 gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name_utf8() );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
475 return;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
476 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
477
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
478 fsSelectedDirectory=(unsigned char *)get_current_dir_name();
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
479 switch ( fsType )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
480 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
481 case fsVideoSelector:
33740
2c02269701bd Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents: 33739
diff changeset
482 setddup( &guiInfo.Filename,fsSelectedDirectory,fsSelectedFile );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
483 guiInfo.StreamType=STREAMTYPE_FILE;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
484 guiInfo.FilenameChanged=1; sub_fps=0;
33739
9f6d46d325de Remove gfree() from interface.c.
ib
parents: 33737
diff changeset
485 nfree( guiInfo.AudioFile );
9f6d46d325de Remove gfree() from interface.c.
ib
parents: 33737
diff changeset
486 nfree( guiInfo.Subtitlename );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
487 fs_PersistantHistory( get_current_dir_name_utf8() ); //totem, write into history
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
488 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
489 case fsSubtitleSelector:
33740
2c02269701bd Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents: 33739
diff changeset
490 setddup( &guiInfo.Subtitlename,fsSelectedDirectory,fsSelectedFile );
33763
03824cf8728d Cosmetic: Rename two functions that do MPlayer calls.
ib
parents: 33755
diff changeset
491 mplayerLoadSubtitle( guiInfo.Subtitlename );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
492 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
493 case fsOtherSelector:
33740
2c02269701bd Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents: 33739
diff changeset
494 setddup( &guiInfo.Othername,fsSelectedDirectory,fsSelectedFile );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
495 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
496 case fsAudioSelector:
33740
2c02269701bd Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents: 33739
diff changeset
497 setddup( &guiInfo.AudioFile,fsSelectedDirectory,fsSelectedFile );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
498 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
499 case fsFontSelector:
33740
2c02269701bd Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents: 33739
diff changeset
500 setddup( &font_name,fsSelectedDirectory,fsSelectedFile );
33763
03824cf8728d Cosmetic: Rename two functions that do MPlayer calls.
ib
parents: 33755
diff changeset
501 mplayerLoadFont();
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
502 if ( Preferences ) gtk_entry_set_text( GTK_ENTRY( prEFontName ),font_name );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
503 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
504 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
505
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
506 HideFileSelect();
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
507
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
508 item=fsTopList_items;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
509 while( item )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
510 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
511 if ( !strcmp( item->data,fsSelectedDirectory ) ) i=0;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
512 item=item->next;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
513 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
514 if ( i ) fsTopList_items=g_list_prepend( fsTopList_items,(gchar *)get_current_dir_name_utf8() );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
515 if ( uiMainAutoPlay ) { uiMainAutoPlay=0; uiEventHandling( evPlay,0 ); }
33731
81f71d910333 Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents: 33725
diff changeset
516 else gui( GUI_SET_STATE,(void *) GUI_STOP );
33572
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
517 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
518
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
519 static void fs_Cancel_released( GtkButton * button,gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
520 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
521 HideFileSelect();
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
522 fs_PersistantHistory( get_current_dir_name_utf8() ); //totem, write into history file
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
523 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
524
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
525 static void fs_fsFNameList_select_row( GtkWidget * widget, gint row, gint column,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
526 GdkEventButton *bevent, gpointer user_data)
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
527 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
528 gtk_clist_get_text( GTK_CLIST(widget ),row,1,&fsSelectedFile );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
529 g_free( fsSelectedFileUtf8 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
530 fsSelectedFileUtf8 = g_filename_from_utf8( fsSelectedFile, -1, NULL, NULL, NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
531 if ( fsSelectedFileUtf8 ) fsSelectedFile = fsSelectedFileUtf8;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
532 if( bevent && bevent->type == GDK_BUTTON_PRESS ) gtk_button_released( GTK_BUTTON( fsOk ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
533 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
534
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
535 static gboolean on_FileSelect_key_release_event( GtkWidget * widget,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
536 GdkEventKey * event,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
537 gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
538 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
539 switch ( event->keyval )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
540 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
541 case GDK_Escape:
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
542 gtk_button_released( GTK_BUTTON( fsCancel ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
543 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
544 case GDK_Return:
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
545 gtk_button_released( GTK_BUTTON( fsOk ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
546 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
547 case GDK_BackSpace:
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
548 gtk_button_released( GTK_BUTTON( fsUp ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
549 break;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
550 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
551 return FALSE;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
552 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
553
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
554 static gboolean fs_fsFNameList_event( GtkWidget * widget,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
555 GdkEvent * event,
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
556 gpointer user_data )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
557 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
558 GdkEventButton *bevent;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
559 gint row, col;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
560
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
561 (void) user_data;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
562
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
563 bevent = (GdkEventButton *) event;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
564
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
565 if ( event->type == GDK_BUTTON_RELEASE && bevent->button == 2 )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
566 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
567 if ( gtk_clist_get_selection_info( GTK_CLIST( widget ), bevent->x, bevent->y, &row, &col ) )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
568 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
569 gtk_clist_get_text( GTK_CLIST( widget ), row, 1, &fsSelectedFile );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
570 g_free( fsSelectedFileUtf8 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
571 fsSelectedFileUtf8 = g_filename_from_utf8( fsSelectedFile, -1, NULL, NULL, NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
572 if ( fsSelectedFileUtf8 ) fsSelectedFile = fsSelectedFileUtf8;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
573 gtk_button_released( GTK_BUTTON( fsOk ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
574 return TRUE;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
575 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
576 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
577
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
578 return FALSE;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
579 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
580
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
581 static void fs_Destroy( void )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
582 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
583 g_free( fsSelectedFileUtf8 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
584 fsSelectedFileUtf8 = NULL;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
585 WidgetDestroy( fsFileSelect, &fsFileSelect );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
586 }
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
587
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
588 GtkWidget * create_FileSelect( void )
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
589 {
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
590 GtkWidget * vbox4;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
591 GtkWidget * hbox4;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
592 GtkWidget * vseparator1;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
593 GtkWidget * hbox6;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
594 GtkWidget * fsFNameListWindow;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
595 GtkWidget * hbuttonbox3;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
596
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
597 GtkWidget * uppixmapwid;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
598 GdkPixmap * uppixmap;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
599 GdkBitmap * upmask;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
600 GtkStyle * upstyle;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
601
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
602
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
603 fsFileSelect=gtk_window_new( GTK_WINDOW_TOPLEVEL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
604 gtk_widget_set_name( fsFileSelect,"fsFileSelect" );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
605 gtk_object_set_data( GTK_OBJECT( fsFileSelect ),"fsFileSelect",fsFileSelect );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
606 gtk_widget_set_usize( fsFileSelect,512,300 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
607 GTK_WIDGET_SET_FLAGS( fsFileSelect,GTK_CAN_DEFAULT );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
608 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 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
609 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
610 gtk_window_set_position( GTK_WINDOW( fsFileSelect ),GTK_WIN_POS_CENTER );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
611 gtk_window_set_policy( GTK_WINDOW( fsFileSelect ),TRUE,TRUE,TRUE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
612 gtk_window_set_wmclass( GTK_WINDOW( fsFileSelect ),"FileSelect","MPlayer" );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
613 fsColorMap=gdk_colormap_get_system();
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
614
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
615 gtk_widget_realize( fsFileSelect );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
616 gtkAddIcon( fsFileSelect );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
617
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
618 style=gtk_widget_get_style( fsFileSelect );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
619 dpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&dmask,&style->bg[GTK_STATE_NORMAL],(gchar **)dir_xpm );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
620 fpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&fmask,&style->bg[GTK_STATE_NORMAL],(gchar **)file_xpm );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
621
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
622 vbox4=AddVBox( AddDialogFrame( fsFileSelect ),0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
623 hbox4=AddHBox( vbox4,1 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
624
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
625 fsCombo4=gtk_combo_new();
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
626 gtk_widget_set_name( fsCombo4,"fsCombo4" );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
627 gtk_widget_show( fsCombo4 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
628 gtk_box_pack_start( GTK_BOX( hbox4 ),fsCombo4,TRUE,TRUE,0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
629 gtk_widget_set_usize( fsCombo4,-2,20 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
630
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
631 fsPathCombo=GTK_COMBO( fsCombo4 )->entry;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
632 gtk_widget_set_name( fsPathCombo,"fsPathCombo" );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
633 gtk_widget_show( fsPathCombo );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
634 gtk_widget_set_usize( fsPathCombo,-2,20 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
635
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
636 vseparator1=gtk_vseparator_new();
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
637 gtk_widget_set_name( vseparator1,"vseparator1" );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
638 gtk_widget_show( vseparator1 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
639 gtk_box_pack_start( GTK_BOX( hbox4 ),vseparator1,FALSE,TRUE,0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
640 gtk_widget_set_usize( vseparator1,7,20 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
641
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
642 upstyle=gtk_widget_get_style( fsFileSelect );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
643 uppixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&upmask,&upstyle->bg[GTK_STATE_NORMAL],(gchar **)up_xpm );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
644 uppixmapwid=gtk_pixmap_new( uppixmap,upmask );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
645 gtk_widget_show( uppixmapwid );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
646
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
647 fsUp=gtk_button_new();
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
648 gtk_container_add( GTK_CONTAINER(fsUp ),uppixmapwid );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
649 gtk_widget_show( fsUp );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
650 gtk_box_pack_start( GTK_BOX( hbox4 ),fsUp,FALSE,FALSE,0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
651 gtk_widget_set_usize( fsUp,65,15 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
652
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
653 AddHSeparator( vbox4 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
654
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
655 hbox6=AddHBox( NULL,0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
656 gtk_box_pack_start( GTK_BOX( vbox4 ),hbox6,TRUE,TRUE,0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
657
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
658 fsFNameListWindow=gtk_scrolled_window_new( NULL,NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
659 gtk_widget_set_name( fsFNameListWindow,"fsFNameListWindow" );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
660 gtk_widget_show( fsFNameListWindow );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
661 gtk_box_pack_start( GTK_BOX( hbox6 ),fsFNameListWindow,TRUE,TRUE,0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
662 gtk_widget_set_usize( fsFNameListWindow,-2,145 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
663 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( fsFNameListWindow ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
664
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
665 fsFNameList=gtk_clist_new( 2 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
666 gtk_widget_set_name( fsFNameList,"fsFNameList" );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
667 gtk_container_add( GTK_CONTAINER( fsFNameListWindow ),fsFNameList );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
668 gtk_clist_set_column_width( GTK_CLIST( fsFNameList ),0,80 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
669 gtk_clist_set_selection_mode( GTK_CLIST( fsFNameList ),GTK_SELECTION_BROWSE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
670 gtk_clist_column_titles_hide( GTK_CLIST( fsFNameList ) );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
671 gtk_clist_set_shadow_type( GTK_CLIST( fsFNameList ),GTK_SHADOW_ETCHED_OUT );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
672
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
673 AddHSeparator( vbox4 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
674
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
675 List=gtk_combo_new();
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
676 gtk_widget_set_name( List,"List" );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
677 gtk_widget_ref( List );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
678 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"List",List,(GtkDestroyNotify)gtk_widget_unref );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
679 gtk_widget_show( List );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
680 gtk_box_pack_start( GTK_BOX( vbox4 ),List,FALSE,FALSE,0 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
681 gtk_widget_set_usize( List,-2,20 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
682
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
683 fsFilterCombo=GTK_COMBO( List )->entry;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
684 gtk_widget_set_name( fsFilterCombo,"fsFilterCombo" );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
685 gtk_widget_show( fsFilterCombo );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
686 gtk_entry_set_editable (GTK_ENTRY( fsFilterCombo ),FALSE );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
687
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
688 AddHSeparator( vbox4 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
689
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
690 hbuttonbox3=AddHButtonBox( vbox4 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
691 gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox3 ),GTK_BUTTONBOX_END );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
692 gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox3 ),10 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
693
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
694 fsOk=AddButton( MSGTR_Ok,hbuttonbox3 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
695 fsCancel=AddButton( MSGTR_Cancel,hbuttonbox3 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
696
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
697 gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"destroy",GTK_SIGNAL_FUNC( fs_Destroy ), NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
698 gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"key_release_event",GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
699
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
700 gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"changed",GTK_SIGNAL_FUNC( fs_fsFilterCombo_changed ),fsFilterCombo );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
701 gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"activate",GTK_SIGNAL_FUNC( fs_fsFilterCombo_activate ),fsFilterCombo );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
702 gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"changed",GTK_SIGNAL_FUNC( fs_fsPathCombo_changed ),fsPathCombo );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
703 gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"activate",GTK_SIGNAL_FUNC( fs_fsPathCombo_activate ),fsPathCombo );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
704 gtk_signal_connect( GTK_OBJECT( fsUp ),"released",GTK_SIGNAL_FUNC( fs_Up_released ),fsFNameList );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
705 gtk_signal_connect( GTK_OBJECT( fsOk ),"released",GTK_SIGNAL_FUNC( fs_Ok_released ),fsCombo4 );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
706 gtk_signal_connect( GTK_OBJECT( fsCancel ),"released",GTK_SIGNAL_FUNC( fs_Cancel_released ),NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
707 gtk_signal_connect( GTK_OBJECT( fsFNameList ),"select_row",(GtkSignalFunc)fs_fsFNameList_select_row,NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
708 gtk_signal_connect( GTK_OBJECT( fsFNameList ),"event", (GtkSignalFunc)fs_fsFNameList_event,NULL );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
709
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
710 gtk_widget_grab_focus( fsFNameList );
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
711
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
712 return fsFileSelect;
d9b805602aa1 Rename some gtk files.
ib
parents:
diff changeset
713 }