Mercurial > mplayer.hg
annotate gui/cfg.c @ 34585:60bf43f94f17
Cosmetic: Adjust indent.
author | ib |
---|---|
date | Thu, 09 Feb 2012 14:53:24 +0000 |
parents | 500ea19f03eb |
children | ebcc8c7e7fda |
rev | line source |
---|---|
26458 | 1 /* |
2 * This file is part of MPlayer. | |
3 * | |
4 * MPlayer is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
6 * the Free Software Foundation; either version 2 of the License, or | |
7 * (at your option) any later version. | |
8 * | |
9 * MPlayer is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License along | |
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 */ | |
23077 | 18 |
34562 | 19 #include <stdio.h> |
23077 | 20 #include <stdlib.h> |
21 #include <string.h> | |
22 | |
33179 | 23 #include "cfg.h" |
24 #include "interface.h" | |
33742
e1539e14d60f
Move purely list related parts of gtkSet() from interface.c to list.c.
ib
parents:
33737
diff
changeset
|
25 #include "util/list.h" |
33737 | 26 #include "util/string.h" |
33179 | 27 |
23077 | 28 #include "config.h" |
29 #include "help_mp.h" | |
30653
3d23e24c5c60
Declare externally used variables from vd.c as extern in vd.h.
diego
parents:
30633
diff
changeset
|
30 #include "libmpcodecs/vd.h" |
34562 | 31 #include "libmpdemux/demuxer.h" |
23077 | 32 #include "libvo/video_out.h" |
31385
f2aebe1309b2
Declare stop_xscreensaver extern in x11_common.h instead of all over the code.
diego
parents:
30901
diff
changeset
|
33 #include "libvo/x11_common.h" |
33179 | 34 #include "mixer.h" |
33768 | 35 #include "mp_core.h" |
33179 | 36 #include "mp_msg.h" |
37 #include "mpcommon.h" | |
38 #include "mplayer.h" | |
39 #include "parser-cfg.h" | |
40 #include "path.h" | |
34562 | 41 #include "stream/stream.h" |
42 #include "sub/ass_mp.h" | |
32981 | 43 #include "sub/font_load.h" |
33179 | 44 #include "sub/sub.h" |
23077 | 45 |
34576 | 46 #define GUI_CONFIGURATION "gui.conf" |
47 #define GUI_HISTORY "gui.history" | |
48 #define GUI_PLAYLIST "gui.pl" | |
49 #define GUI_URLLIST "gui.url" | |
50 | |
33265 | 51 m_config_t *gui_conf; |
52 | |
33220 | 53 int gtkCacheOn; |
33180 | 54 int gtkCacheSize = 2048; |
55 | |
33220 | 56 int gtkVfPP; |
23077 | 57 |
33249 | 58 int gtkVfLAVC; |
33180 | 59 char *gtkDXR3Device; |
60 | |
33220 | 61 int gtkAutoSyncOn; |
62 int gtkAutoSync; | |
23077 | 63 |
33220 | 64 int gtkAONorm; |
65 int gtkAOSurround; | |
66 int gtkAOExtraStereo; | |
33221 | 67 float gtkAOExtraStereoMul = 1.0f; |
33180 | 68 |
33179 | 69 char *gtkAOALSAMixer; |
70 char *gtkAOALSAMixerChannel; | |
71 char *gtkAOALSADevice; | |
33180 | 72 |
73 char *gtkAOOSSMixer; | |
74 char *gtkAOOSSMixerChannel; | |
75 char *gtkAOOSSDevice; | |
76 | |
33179 | 77 char *gtkAOESDDevice; |
23077 | 78 |
33180 | 79 char *gtkAOSDLDriver; |
23077 | 80 |
33220 | 81 int gtkEnableAudioEqualizer; |
33747 | 82 float gtkEquChannels[6][10]; |
23077 | 83 |
33220 | 84 int gtkSubDumpMPSub; |
85 int gtkSubDumpSrt; | |
23077 | 86 |
33180 | 87 gtkASS_t gtkASS; |
88 | |
33220 | 89 int gtkEnablePlayBar = 1; |
90 int gtkLoadFullscreen; | |
33179 | 91 int gtkShowVideoWindow = 1; |
23077 | 92 |
33179 | 93 int gui_save_pos = 1; |
33218
f0c2a62e3e89
Position windows initially at coordinates given in skin file.
ib
parents:
33180
diff
changeset
|
94 int gui_main_pos_x = -3; |
f0c2a62e3e89
Position windows initially at coordinates given in skin file.
ib
parents:
33180
diff
changeset
|
95 int gui_main_pos_y = -3; |
f0c2a62e3e89
Position windows initially at coordinates given in skin file.
ib
parents:
33180
diff
changeset
|
96 int gui_sub_pos_x = -3; |
f0c2a62e3e89
Position windows initially at coordinates given in skin file.
ib
parents:
33180
diff
changeset
|
97 int gui_sub_pos_y = -3; |
23077 | 98 |
33747 | 99 int guiWinID = -1; |
100 | |
101 char *skinName; | |
102 | |
33751
c28c967e40e9
Replace numeric constant fsPersistant_MaxPos for fsHistory array size.
ib
parents:
33750
diff
changeset
|
103 char *fsHistory[5]; |
33750
8b5898908212
Remove variable holding history of selected files from interface.[ch].
ib
parents:
33748
diff
changeset
|
104 |
33179 | 105 static const m_option_t gui_opts[] = { |
33478 | 106 { "cache", >kCacheOn, CONF_TYPE_FLAG, 0, 0, 1, NULL }, |
107 { "cache_size", >kCacheSize, CONF_TYPE_INT, CONF_RANGE, 32, 1048576, NULL }, | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28051
diff
changeset
|
108 |
33478 | 109 { "vf_pp", >kVfPP, CONF_TYPE_FLAG, 0, 0, 1, NULL }, |
33223 | 110 |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27359
diff
changeset
|
111 #ifdef CONFIG_DXR3 |
33478 | 112 { "vf_lavc", >kVfLAVC, CONF_TYPE_FLAG, 0, 0, 1, NULL }, |
113 { "vo_dxr3_device", >kDXR3Device, CONF_TYPE_STRING, 0, 0, 0, NULL }, | |
23077 | 114 #endif |
115 | |
33478 | 116 { "autosync", >kAutoSyncOn, CONF_TYPE_FLAG, 0, 0, 1, NULL }, |
117 { "autosync_size", >kAutoSync, CONF_TYPE_INT, CONF_RANGE, 0, 10000, NULL }, | |
23077 | 118 |
33478 | 119 { "ao_volnorm", >kAONorm, CONF_TYPE_FLAG, 0, 0, 1, NULL }, |
120 { "ao_surround", >kAOSurround, CONF_TYPE_FLAG, 0, 0, 1, NULL }, | |
121 { "ao_extra_stereo", >kAOExtraStereo, CONF_TYPE_FLAG, 0, 0, 1, NULL }, | |
122 { "ao_extra_stereo_coefficient", >kAOExtraStereoMul, CONF_TYPE_FLOAT, CONF_RANGE, -10.0, 10.0, NULL }, | |
33223 | 123 |
27390
9d95dc936e66
Introduce CONFIG_ALSA preprocessor directive for ALSA 0.9 and 1.x.
diego
parents:
27387
diff
changeset
|
124 #ifdef CONFIG_ALSA |
33478 | 125 { "ao_alsa_mixer", >kAOALSAMixer, CONF_TYPE_STRING, 0, 0, 0, NULL }, |
126 { "ao_alsa_mixer_channel", >kAOALSAMixerChannel, CONF_TYPE_STRING, 0, 0, 0, NULL }, | |
127 { "ao_alsa_device", >kAOALSADevice, CONF_TYPE_STRING, 0, 0, 0, NULL }, | |
23077 | 128 #endif |
33223 | 129 |
130 #ifdef CONFIG_OSS_AUDIO | |
33478 | 131 { "ao_oss_mixer", >kAOOSSMixer, CONF_TYPE_STRING, 0, 0, 0, NULL }, |
132 { "ao_oss_mixer_channel", >kAOOSSMixerChannel, CONF_TYPE_STRING, 0, 0, 0, NULL }, | |
133 { "ao_oss_device", >kAOOSSDevice, CONF_TYPE_STRING, 0, 0, 0, NULL }, | |
23077 | 134 #endif |
33223 | 135 |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
26458
diff
changeset
|
136 #ifdef CONFIG_ESD |
33478 | 137 { "ao_esd_device", >kAOESDDevice, CONF_TYPE_STRING, 0, 0, 0, NULL }, |
23077 | 138 #endif |
139 | |
33223 | 140 #ifdef CONFIG_SDL |
33478 | 141 { "ao_sdl_subdriver", >kAOSDLDriver, CONF_TYPE_STRING, 0, 0, 0, NULL }, |
23077 | 142 #endif |
143 | |
33478 | 144 { "enable_audio_equ", >kEnableAudioEqualizer, CONF_TYPE_FLAG, 0, 0, 1, NULL }, |
23077 | 145 |
33478 | 146 { "equ_channel_1", >kEquChannel1, CONF_TYPE_STRING, 0, 0, 0, NULL }, |
147 { "equ_channel_2", >kEquChannel2, CONF_TYPE_STRING, 0, 0, 0, NULL }, | |
148 { "equ_channel_3", >kEquChannel3, CONF_TYPE_STRING, 0, 0, 0, NULL }, | |
149 { "equ_channel_4", >kEquChannel4, CONF_TYPE_STRING, 0, 0, 0, NULL }, | |
150 { "equ_channel_5", >kEquChannel5, CONF_TYPE_STRING, 0, 0, 0, NULL }, | |
151 { "equ_channel_6", >kEquChannel6, CONF_TYPE_STRING, 0, 0, 0, NULL }, | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28051
diff
changeset
|
152 |
33223 | 153 #define audio_equ_row(i, j) \ |
33478 | 154 { "equ_band_" # i # j, >kEquChannels[i][j], CONF_TYPE_FLOAT, CONF_RANGE, -15.0, 15.0, NULL } |
33289 | 155 audio_equ_row(0, 0), audio_equ_row(0, 1), audio_equ_row(0, 2), audio_equ_row(0, 3), audio_equ_row(0, 4), audio_equ_row(0, 5), audio_equ_row(0, 6), audio_equ_row(0, 7), audio_equ_row(0, 8), audio_equ_row(0, 9), |
156 audio_equ_row(1, 0), audio_equ_row(1, 1), audio_equ_row(1, 2), audio_equ_row(1, 3), audio_equ_row(1, 4), audio_equ_row(1, 5), audio_equ_row(1, 6), audio_equ_row(1, 7), audio_equ_row(1, 8), audio_equ_row(1, 9), | |
157 audio_equ_row(2, 0), audio_equ_row(2, 1), audio_equ_row(2, 2), audio_equ_row(2, 3), audio_equ_row(2, 4), audio_equ_row(2, 5), audio_equ_row(2, 6), audio_equ_row(2, 7), audio_equ_row(2, 8), audio_equ_row(2, 9), | |
158 audio_equ_row(3, 0), audio_equ_row(3, 1), audio_equ_row(3, 2), audio_equ_row(3, 3), audio_equ_row(3, 4), audio_equ_row(3, 5), audio_equ_row(3, 6), audio_equ_row(3, 7), audio_equ_row(3, 8), audio_equ_row(3, 9), | |
159 audio_equ_row(4, 0), audio_equ_row(4, 1), audio_equ_row(4, 2), audio_equ_row(4, 3), audio_equ_row(4, 4), audio_equ_row(4, 5), audio_equ_row(4, 6), audio_equ_row(4, 7), audio_equ_row(4, 8), audio_equ_row(4, 9), | |
160 audio_equ_row(5, 0), audio_equ_row(5, 1), audio_equ_row(5, 2), audio_equ_row(5, 3), audio_equ_row(5, 4), audio_equ_row(5, 5), audio_equ_row(5, 6), audio_equ_row(5, 7), audio_equ_row(5, 8), audio_equ_row(5, 9), | |
23077 | 161 #undef audio_equ_row |
162 | |
33478 | 163 { "playbar", >kEnablePlayBar, CONF_TYPE_FLAG, 0, 0, 1, NULL }, |
164 { "load_fullscreen", >kLoadFullscreen, CONF_TYPE_FLAG, 0, 0, 1, NULL }, | |
165 { "show_videowin", >kShowVideoWindow, CONF_TYPE_FLAG, 0, 0, 1, NULL }, | |
33223 | 166 |
33478 | 167 { "gui_save_pos", &gui_save_pos, CONF_TYPE_FLAG, 0, 0, 1, NULL }, |
168 { "gui_main_pos_x", &gui_main_pos_x, CONF_TYPE_INT, 0, 0, 0, NULL }, | |
169 { "gui_main_pos_y", &gui_main_pos_y, CONF_TYPE_INT, 0, 0, 0, NULL }, | |
170 { "gui_video_out_pos_x", &gui_sub_pos_x, CONF_TYPE_INT, 0, 0, 0, NULL }, | |
171 { "gui_video_out_pos_y", &gui_sub_pos_y, CONF_TYPE_INT, 0, 0, 0, NULL }, | |
33223 | 172 |
33477 | 173 { "idle", &player_idle_mode, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL }, |
174 | |
33223 | 175 // NOTE TO MYSELF: Do we really need all/any non-gtkOptions, i.e. override mplayer options? |
176 | |
33478 | 177 { "gui_skin", &skinName, CONF_TYPE_STRING, 0, 0, 0, NULL }, |
33223 | 178 |
33478 | 179 { "stopxscreensaver", &stop_xscreensaver, CONF_TYPE_FLAG, 0, 0, 1, NULL }, |
33223 | 180 |
33478 | 181 { "cdrom_device", &cdrom_device, CONF_TYPE_STRING, 0, 0, 0, NULL }, |
182 { "dvd_device", &dvd_device, CONF_TYPE_STRING, 0, 0, 0, NULL }, | |
33223 | 183 |
33478 | 184 { "osd_level", &osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL }, |
33223 | 185 |
33478 | 186 { "vo_driver", &video_driver_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL }, |
187 { "v_vfm", &video_fm_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL }, | |
33223 | 188 |
33478 | 189 { "vf_autoq", &auto_quality, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL }, |
190 { "vo_direct_render", &vo_directrendering, CONF_TYPE_FLAG, 0, 0, 1, NULL }, | |
191 { "vo_doublebuffering", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 0, 1, NULL }, | |
192 { "vo_panscan", &vo_panscan, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 1.0, NULL }, | |
33223 | 193 |
33478 | 194 { "v_flip", &flip, CONF_TYPE_INT, CONF_RANGE, -1, 1, NULL }, |
195 { "v_framedrop", &frame_dropping, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL }, | |
196 { "v_idx", &index_mode, CONF_TYPE_INT, CONF_RANGE, -1, 2, NULL }, | |
197 { "v_ni", &force_ni, CONF_TYPE_FLAG, 0, 0, 1, NULL }, | |
33223 | 198 |
33478 | 199 { "ao_driver", &audio_driver_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL }, |
200 { "a_afm", &audio_fm_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL }, | |
33223 | 201 |
33478 | 202 { "softvol", &soft_vol, CONF_TYPE_FLAG, 0, 0, 1, NULL }, |
33223 | 203 |
33478 | 204 { "sub_auto_load", &sub_auto, CONF_TYPE_FLAG, 0, 0, 1, NULL }, |
33223 | 205 #ifdef CONFIG_ICONV |
33478 | 206 { "sub_cp", &sub_cp, CONF_TYPE_STRING, 0, 0, 0, NULL }, |
33223 | 207 #endif |
33478 | 208 { "sub_overlap", &suboverlap_enabled, CONF_TYPE_FLAG, 0, 0, 0, NULL }, |
209 { "sub_pos", &sub_pos, CONF_TYPE_INT, CONF_RANGE, 0, 200, NULL }, | |
210 { "sub_unicode", &sub_unicode, CONF_TYPE_FLAG, 0, 0, 1, NULL }, | |
33223 | 211 |
33478 | 212 { "font_factor", &font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, NULL }, |
213 { "font_name", &font_name, CONF_TYPE_STRING, 0, 0, 0, NULL }, | |
33223 | 214 |
215 #ifdef CONFIG_FREETYPE | |
33478 | 216 { "font_encoding", &subtitle_font_encoding, CONF_TYPE_STRING, 0, 0, 0, NULL }, |
217 { "font_text_scale", &text_font_scale_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 100.0, NULL }, | |
218 { "font_osd_scale", &osd_font_scale_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 100.0, NULL }, | |
219 { "font_blur", &subtitle_font_radius, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 8.0, NULL }, | |
220 { "font_outline", &subtitle_font_thickness, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 8.0, NULL }, | |
221 { "font_autoscale", &subtitle_autoscale, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL }, | |
33223 | 222 #endif |
223 | |
224 #ifdef CONFIG_ASS | |
33478 | 225 { "ass_enabled", &ass_enabled, CONF_TYPE_FLAG, 0, 0, 1, NULL }, |
226 { "ass_use_margins", &ass_use_margins, CONF_TYPE_FLAG, 0, 0, 1, NULL }, | |
227 { "ass_top_margin", &ass_top_margin, CONF_TYPE_INT, CONF_RANGE, 0, 512, NULL }, | |
228 { "ass_bottom_margin", &ass_bottom_margin, CONF_TYPE_INT, CONF_RANGE, 0, 512, NULL }, | |
33223 | 229 #endif |
230 | |
33478 | 231 { NULL, NULL, 0, 0, 0, 0, NULL } |
23077 | 232 }; |
233 | |
33565
9c4163ef54e4
Add const to string pointer argument that will not be modified.
reimar
parents:
33555
diff
changeset
|
234 int cfg_gui_include(m_option_t *conf, const char *filename) |
33470 | 235 { |
236 (void)conf; | |
237 | |
34172 | 238 return m_config_parse_config_file(gui_conf, filename, 0); |
33470 | 239 } |
240 | |
34561 | 241 void cfg_read(void) |
23077 | 242 { |
34580 | 243 char *fname, line[512]; |
34578 | 244 FILE *file; |
33179 | 245 |
33476 | 246 player_idle_mode = 1; // GUI is in idle mode by default |
247 | |
33179 | 248 // configuration |
249 | |
34578 | 250 fname = get_path(GUI_CONFIGURATION); |
33179 | 251 |
34578 | 252 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[cfg] file: %s\n", fname); |
33179 | 253 |
254 gui_conf = m_config_new(); | |
33480 | 255 |
256 if (!gui_conf) { | |
257 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed); | |
33768 | 258 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); |
33480 | 259 } |
260 | |
33179 | 261 m_config_register_options(gui_conf, gui_opts); |
262 | |
34578 | 263 if (!disable_gui_conf && (m_config_parse_config_file(gui_conf, fname, 1) < 0)) { |
34577
22887c794c02
In case of a GUI config error, exit MPlayer with error.
ib
parents:
34576
diff
changeset
|
264 gmp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_ConfigFileError "\n"); |
22887c794c02
In case of a GUI config error, exit MPlayer with error.
ib
parents:
34576
diff
changeset
|
265 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); |
33179 | 266 } |
267 | |
34578 | 268 free(fname); |
23077 | 269 |
33179 | 270 // playlist |
271 | |
34578 | 272 fname = get_path(GUI_PLAYLIST); |
273 file = fopen(fname, "rt"); | |
33179 | 274 |
34578 | 275 if (file) { |
34581 | 276 while (fgetstr(line, sizeof(line), file)) { |
33179 | 277 plItem *item; |
23077 | 278 |
34583 | 279 item = calloc(1, sizeof(plItem)); |
34582 | 280 |
281 if (!item) { | |
282 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed); | |
283 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); | |
284 } | |
285 | |
34580 | 286 item->path = strdup(line); |
34584 | 287 |
288 if (fgetstr(line, sizeof(line), file)) { | |
34585 | 289 item->name = strdup(line); |
290 listSet(gtkAddPlItem, item); | |
34584 | 291 } else { |
292 free(item->path); | |
293 free(item); | |
294 } | |
33179 | 295 } |
296 | |
34578 | 297 fclose(file); |
23077 | 298 } |
33179 | 299 |
34578 | 300 free(fname); |
33179 | 301 |
302 // URL list | |
303 | |
34578 | 304 fname = get_path(GUI_URLLIST); |
305 file = fopen(fname, "rt"); | |
23077 | 306 |
34578 | 307 if (file) { |
34581 | 308 while (fgetstr(line, sizeof(line), file)) { |
33555 | 309 urlItem *item; |
33179 | 310 |
34583 | 311 item = calloc(1, sizeof(urlItem)); |
34582 | 312 |
313 if (!item) { | |
314 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_MemAllocFailed); | |
315 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0); | |
316 } | |
317 | |
34580 | 318 item->url = strdup(line); |
33742
e1539e14d60f
Move purely list related parts of gtkSet() from interface.c to list.c.
ib
parents:
33737
diff
changeset
|
319 listSet(gtkAddURLItem, item); |
33179 | 320 } |
321 | |
34578 | 322 fclose(file); |
23077 | 323 } |
33179 | 324 |
34578 | 325 free(fname); |
33179 | 326 |
327 // directory history | |
328 | |
34578 | 329 fname = get_path(GUI_HISTORY); |
34579 | 330 file = fopen(fname, "rt"); |
33179 | 331 |
34578 | 332 if (file) { |
33179 | 333 int i = 0; |
23077 | 334 |
34581 | 335 while (fgetstr(line, sizeof(line), file)) |
34580 | 336 fsHistory[i++] = gstrdup(line); |
33179 | 337 |
34578 | 338 fclose(file); |
23077 | 339 } |
340 | |
34578 | 341 free(fname); |
23077 | 342 } |
343 | |
34561 | 344 void cfg_write(void) |
23077 | 345 { |
34578 | 346 char *fname; |
347 FILE *file; | |
33179 | 348 int i; |
349 | |
350 // configuration | |
351 | |
34578 | 352 fname = get_path(GUI_CONFIGURATION); |
353 file = fopen(fname, "wt+"); | |
33179 | 354 |
34578 | 355 if (file) { |
33179 | 356 for (i = 0; gui_opts[i].name; i++) { |
34578 | 357 char *val = m_option_print(&gui_opts[i], gui_opts[i].p); |
33179 | 358 |
34578 | 359 if (val == (char *)-1) { |
33179 | 360 mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_UnableToSaveOption, gui_opts[i].name); |
34578 | 361 val = NULL; |
33179 | 362 } |
23077 | 363 |
34578 | 364 if (val) { |
365 fprintf(file, "%s = \"%s\"\n", gui_opts[i].name, val); | |
366 free(val); | |
33179 | 367 } |
368 } | |
369 | |
34578 | 370 fclose(file); |
23077 | 371 } |
33179 | 372 |
34578 | 373 free(fname); |
33179 | 374 |
375 // playlist | |
376 | |
34578 | 377 fname = get_path(GUI_PLAYLIST); |
378 file = fopen(fname, "wt+"); | |
33179 | 379 |
34578 | 380 if (file) { |
33179 | 381 plCurrent = plList; |
382 | |
383 while (plCurrent) { | |
384 if (plCurrent->path && plCurrent->name) { | |
34578 | 385 fprintf(file, "%s\n", plCurrent->path); |
386 fprintf(file, "%s\n", plCurrent->name); | |
33179 | 387 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28051
diff
changeset
|
388 |
33179 | 389 plCurrent = plCurrent->next; |
390 } | |
391 | |
34578 | 392 fclose(file); |
23077 | 393 } |
33179 | 394 |
34578 | 395 free(fname); |
33179 | 396 |
397 // URL list | |
398 | |
34578 | 399 fname = get_path(GUI_URLLIST); |
400 file = fopen(fname, "wt+"); | |
33179 | 401 |
34578 | 402 if (file) { |
33748 | 403 while (urlList) { |
404 if (urlList->url) | |
34578 | 405 fprintf(file, "%s\n", urlList->url); |
33179 | 406 |
33748 | 407 urlList = urlList->next; |
33179 | 408 } |
23077 | 409 |
34578 | 410 fclose(file); |
23077 | 411 } |
33179 | 412 |
34578 | 413 free(fname); |
33179 | 414 |
415 // directory history | |
416 | |
34578 | 417 fname = get_path(GUI_HISTORY); |
418 file = fopen(fname, "wt+"); | |
33179 | 419 |
34578 | 420 if (file) { |
33179 | 421 int i = 0; |
23077 | 422 |
33179 | 423 // while (fsHistory[i] != NULL) |
424 for (i = 0; i < 5; i++) | |
425 if (fsHistory[i]) | |
34578 | 426 fprintf(file, "%s\n", fsHistory[i]); |
23077 | 427 |
34578 | 428 fclose(file); |
33179 | 429 } |
430 | |
34578 | 431 free(fname); |
23077 | 432 } |