annotate src/filewriter/filewriter.c @ 3148:d443c917dab9

Remove stale library variable from Makefile, as pointed out by RafaŠČ MuŤ÷yŠČo on #audacious.
author Tony Vroon <chainsaw@gentoo.org>
date Mon, 11 May 2009 17:32:04 +0100
parents 0d47d41b39ec
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
1 /* FileWriter-Plugin
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
2 * (C) copyright 2007 merging of Disk Writer and Out-Lame by Michael Färber
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
3 *
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
4 * Original Out-Lame-Plugin:
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
5 * (C) copyright 2002 Lars Siebold <khandha5@gmx.net>
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
6 * (C) copyright 2006-2007 porting to audacious by Yoshiki Yazawa <yaz@cc.rim.or.jp>
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
7 *
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
11 * (at your option) any later version.
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
12 *
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
16 * GNU General Public License for more details.
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
17 *
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
2771
949d790e8e33 fixed FSF HQ address again
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2766
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
21 */
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
22
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
23 #include "filewriter.h"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
24 #include "plugins.h"
2874
11ef2164d90b re-written format conversion using libSAD;
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
25 #include "convert.h"
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
26
1569
25ea2127eefa filewriter: fix symbol collisions
William Pitcock <nenolod@atheme.org>
parents: 1525
diff changeset
27 struct format_info input;
25ea2127eefa filewriter: fix symbol collisions
William Pitcock <nenolod@atheme.org>
parents: 1525
diff changeset
28
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
29 static GtkWidget *configure_win = NULL, *configure_vbox;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
30 static GtkWidget *path_hbox, *path_label, *path_dirbrowser;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
31 static GtkWidget *configure_bbox, *configure_ok, *configure_cancel;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
32
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
33 static GtkWidget *fileext_hbox, *fileext_label, *fileext_combo, *plugin_button;
1000
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
34
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
35 enum fileext_t
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
36 {
2181
bbb631ab78e9 started initial (very humble) efforts on making FileWriter a general
mf0102 <0102@gmx.at>
parents: 2124
diff changeset
37 WAV = 0,
1000
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
38 #ifdef FILEWRITER_MP3
2181
bbb631ab78e9 started initial (very humble) efforts on making FileWriter a general
mf0102 <0102@gmx.at>
parents: 2124
diff changeset
39 MP3,
1000
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
40 #endif
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
41 #ifdef FILEWRITER_VORBIS
2181
bbb631ab78e9 started initial (very humble) efforts on making FileWriter a general
mf0102 <0102@gmx.at>
parents: 2124
diff changeset
42 VORBIS,
1000
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
43 #endif
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
44 #ifdef FILEWRITER_FLAC
2181
bbb631ab78e9 started initial (very humble) efforts on making FileWriter a general
mf0102 <0102@gmx.at>
parents: 2124
diff changeset
45 FLAC,
1000
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
46 #endif
2181
bbb631ab78e9 started initial (very humble) efforts on making FileWriter a general
mf0102 <0102@gmx.at>
parents: 2124
diff changeset
47 FILEEXT_MAX
1000
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
48 };
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
49
2970
57d499fc5056 revert default format to wav
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2969
diff changeset
50 static gint fileext = WAV;
1000
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
51 static gchar *fileext_str[] =
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
52 {
2181
bbb631ab78e9 started initial (very humble) efforts on making FileWriter a general
mf0102 <0102@gmx.at>
parents: 2124
diff changeset
53 "wav",
1000
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
54 #ifdef FILEWRITER_MP3
2181
bbb631ab78e9 started initial (very humble) efforts on making FileWriter a general
mf0102 <0102@gmx.at>
parents: 2124
diff changeset
55 "mp3",
1000
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
56 #endif
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
57 #ifdef FILEWRITER_VORBIS
2181
bbb631ab78e9 started initial (very humble) efforts on making FileWriter a general
mf0102 <0102@gmx.at>
parents: 2124
diff changeset
58 "ogg",
1000
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
59 #endif
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
60 #ifdef FILEWRITER_FLAC
2181
bbb631ab78e9 started initial (very humble) efforts on making FileWriter a general
mf0102 <0102@gmx.at>
parents: 2124
diff changeset
61 "flac"
1000
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
62 #endif
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
63 };
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
64
3041
d6fa54737096 Copying structs is not a good idea. Lets use a pointer here.
William Pitcock <nenolod@atheme.org>
parents: 3020
diff changeset
65 static FileWriter *plugin;
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
66
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
67 static GtkWidget *saveplace_hbox, *saveplace;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
68 static gboolean save_original = TRUE;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
69
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
70 static GtkWidget *filenamefrom_hbox, *filenamefrom_label, *filenamefrom_toggle;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
71 static gboolean filenamefromtags = TRUE;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
72
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
73 static GtkWidget *use_suffix_toggle = NULL;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
74 static gboolean use_suffix = FALSE;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
75
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
76 static GtkWidget *prependnumber_toggle;
2969
20ad1c7ff026 changed default values for filewriter:
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2950
diff changeset
77 static gboolean prependnumber = TRUE;
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
78
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
79 static gchar *file_path = NULL;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
80
2766
6d08e3120615 make some file filewriter backends use callbacks instead of calling VFS directly
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2227
diff changeset
81 VFSFile *output_file = NULL;
6d08e3120615 make some file filewriter backends use callbacks instead of calling VFS directly
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2227
diff changeset
82 guint64 offset = 0;
6d08e3120615 make some file filewriter backends use callbacks instead of calling VFS directly
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2227
diff changeset
83 Tuple *tuple = NULL;
6d08e3120615 make some file filewriter backends use callbacks instead of calling VFS directly
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2227
diff changeset
84
3020
fdcf79446ddf Port to new API, lowest prio and NO_DEVICES to avoid autoselect.
Tony Vroon <chainsaw@gentoo.org>
parents: 2970
diff changeset
85 static OutputPluginInitStatus file_init(void);
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
86 static void file_about(void);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
87 static gint file_open(AFormat fmt, gint rate, gint nch);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
88 static void file_write(void *ptr, gint length);
2766
6d08e3120615 make some file filewriter backends use callbacks instead of calling VFS directly
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2227
diff changeset
89 static gint file_write_output(void *ptr, gint length);
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
90 static void file_close(void);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
91 static void file_flush(gint time);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
92 static void file_pause(short p);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
93 static gint file_free(void);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
94 static gint file_playing(void);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
95 static gint file_get_written_time(void);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
96 static gint file_get_output_time(void);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
97 static void file_configure(void);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
98
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
99 OutputPlugin file_op =
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
100 {
1651
fd29cb240417 updated FileWriter plugin
mf0102 <0102@gmx.at>
parents: 1569
diff changeset
101 .description = "FileWriter Plugin",
3020
fdcf79446ddf Port to new API, lowest prio and NO_DEVICES to avoid autoselect.
Tony Vroon <chainsaw@gentoo.org>
parents: 2970
diff changeset
102 .probe_priority = 0,
1651
fd29cb240417 updated FileWriter plugin
mf0102 <0102@gmx.at>
parents: 1569
diff changeset
103 .init = file_init,
fd29cb240417 updated FileWriter plugin
mf0102 <0102@gmx.at>
parents: 1569
diff changeset
104 .about = file_about,
fd29cb240417 updated FileWriter plugin
mf0102 <0102@gmx.at>
parents: 1569
diff changeset
105 .configure = file_configure,
fd29cb240417 updated FileWriter plugin
mf0102 <0102@gmx.at>
parents: 1569
diff changeset
106 .open_audio = file_open,
fd29cb240417 updated FileWriter plugin
mf0102 <0102@gmx.at>
parents: 1569
diff changeset
107 .write_audio = file_write,
fd29cb240417 updated FileWriter plugin
mf0102 <0102@gmx.at>
parents: 1569
diff changeset
108 .close_audio = file_close,
fd29cb240417 updated FileWriter plugin
mf0102 <0102@gmx.at>
parents: 1569
diff changeset
109 .flush = file_flush,
fd29cb240417 updated FileWriter plugin
mf0102 <0102@gmx.at>
parents: 1569
diff changeset
110 .pause = file_pause,
fd29cb240417 updated FileWriter plugin
mf0102 <0102@gmx.at>
parents: 1569
diff changeset
111 .buffer_free = file_free,
fd29cb240417 updated FileWriter plugin
mf0102 <0102@gmx.at>
parents: 1569
diff changeset
112 .buffer_playing = file_playing,
fd29cb240417 updated FileWriter plugin
mf0102 <0102@gmx.at>
parents: 1569
diff changeset
113 .output_time = file_get_output_time,
fd29cb240417 updated FileWriter plugin
mf0102 <0102@gmx.at>
parents: 1569
diff changeset
114 .written_time = file_get_written_time
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
115 };
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
116
1076
91f6c4647bae [svn] - filewriter: transition to plugin API v2
nenolod
parents: 1011
diff changeset
117 OutputPlugin *file_oplist[] = { &file_op, NULL };
91f6c4647bae [svn] - filewriter: transition to plugin API v2
nenolod
parents: 1011
diff changeset
118
1651
fd29cb240417 updated FileWriter plugin
mf0102 <0102@gmx.at>
parents: 1569
diff changeset
119 SIMPLE_OUTPUT_PLUGIN(filewriter, file_oplist);
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
120
3042
fbfdd7946be9 More cleanups.
William Pitcock <nenolod@atheme.org>
parents: 3041
diff changeset
121 FileWriter *plugins[FILEEXT_MAX] = {
fbfdd7946be9 More cleanups.
William Pitcock <nenolod@atheme.org>
parents: 3041
diff changeset
122 &wav_plugin,
fbfdd7946be9 More cleanups.
William Pitcock <nenolod@atheme.org>
parents: 3041
diff changeset
123 #ifdef FILEWRITER_MP3
fbfdd7946be9 More cleanups.
William Pitcock <nenolod@atheme.org>
parents: 3041
diff changeset
124 &mp3_plugin,
fbfdd7946be9 More cleanups.
William Pitcock <nenolod@atheme.org>
parents: 3041
diff changeset
125 #endif
fbfdd7946be9 More cleanups.
William Pitcock <nenolod@atheme.org>
parents: 3041
diff changeset
126 #ifdef FILEWRITER_VORBIS
fbfdd7946be9 More cleanups.
William Pitcock <nenolod@atheme.org>
parents: 3041
diff changeset
127 &vorbis_plugin,
fbfdd7946be9 More cleanups.
William Pitcock <nenolod@atheme.org>
parents: 3041
diff changeset
128 #endif
fbfdd7946be9 More cleanups.
William Pitcock <nenolod@atheme.org>
parents: 3041
diff changeset
129 #ifdef FILEWRITER_FLAC
fbfdd7946be9 More cleanups.
William Pitcock <nenolod@atheme.org>
parents: 3041
diff changeset
130 &flac_plugin,
fbfdd7946be9 More cleanups.
William Pitcock <nenolod@atheme.org>
parents: 3041
diff changeset
131 #endif
fbfdd7946be9 More cleanups.
William Pitcock <nenolod@atheme.org>
parents: 3041
diff changeset
132 };
fbfdd7946be9 More cleanups.
William Pitcock <nenolod@atheme.org>
parents: 3041
diff changeset
133
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
134 static void set_plugin(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
135 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
136 if (fileext < 0 || fileext >= FILEEXT_MAX)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
137 fileext = 0;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
138
3042
fbfdd7946be9 More cleanups.
William Pitcock <nenolod@atheme.org>
parents: 3041
diff changeset
139 plugin = plugins[fileext];
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
140 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
141
3020
fdcf79446ddf Port to new API, lowest prio and NO_DEVICES to avoid autoselect.
Tony Vroon <chainsaw@gentoo.org>
parents: 2970
diff changeset
142 static OutputPluginInitStatus file_init(void)
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
143 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
144 ConfigDb *db;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
145
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 2057
diff changeset
146 db = aud_cfg_db_open();
2807
f06ec6936b7e migrated some plugins to auto_CFGID
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2775
diff changeset
147 aud_cfg_db_get_int(db, FILEWRITER_CFGID, "fileext", &fileext);
f06ec6936b7e migrated some plugins to auto_CFGID
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2775
diff changeset
148 aud_cfg_db_get_string(db, FILEWRITER_CFGID, "file_path", &file_path);
f06ec6936b7e migrated some plugins to auto_CFGID
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2775
diff changeset
149 aud_cfg_db_get_bool(db, FILEWRITER_CFGID, "save_original", &save_original);
f06ec6936b7e migrated some plugins to auto_CFGID
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2775
diff changeset
150 aud_cfg_db_get_bool(db, FILEWRITER_CFGID, "use_suffix", &use_suffix);
f06ec6936b7e migrated some plugins to auto_CFGID
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2775
diff changeset
151 aud_cfg_db_get_bool(db, FILEWRITER_CFGID, "filenamefromtags", &filenamefromtags);
f06ec6936b7e migrated some plugins to auto_CFGID
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2775
diff changeset
152 aud_cfg_db_get_bool(db, FILEWRITER_CFGID, "prependnumber", &prependnumber);
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 2057
diff changeset
153 aud_cfg_db_close(db);
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
154
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
155 if (!file_path)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
156 file_path = g_strdup(g_get_home_dir());
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
157
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
158 set_plugin();
3041
d6fa54737096 Copying structs is not a good idea. Lets use a pointer here.
William Pitcock <nenolod@atheme.org>
parents: 3020
diff changeset
159 if (plugin->init)
d6fa54737096 Copying structs is not a good idea. Lets use a pointer here.
William Pitcock <nenolod@atheme.org>
parents: 3020
diff changeset
160 plugin->init(&file_write_output);
3020
fdcf79446ddf Port to new API, lowest prio and NO_DEVICES to avoid autoselect.
Tony Vroon <chainsaw@gentoo.org>
parents: 2970
diff changeset
161
fdcf79446ddf Port to new API, lowest prio and NO_DEVICES to avoid autoselect.
Tony Vroon <chainsaw@gentoo.org>
parents: 2970
diff changeset
162 return OUTPUT_PLUGIN_INIT_NO_DEVICES;
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
163 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
164
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
165 void file_about(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
166 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
167 static GtkWidget *dialog;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
168
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
169 if (dialog != NULL)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
170 return;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
171
1677
f6f5603a0954 xmms_show_message() changed to audacious_info_dialog()
Matti Hamalainen <ccr@tnsp.org>
parents: 1651
diff changeset
172 dialog = audacious_info_dialog(_("About FileWriter-Plugin"),
1298
94eee8a16189 The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents: 1269
diff changeset
173 _("FileWriter-Plugin\n\n"
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
174 "This program is free software; you can redistribute it and/or modify\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
175 "it under the terms of the GNU General Public License as published by\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
176 "the Free Software Foundation; either version 2 of the License, or\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
177 "(at your option) any later version.\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
178 "\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
179 "This program is distributed in the hope that it will be useful,\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
180 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
181 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
182 "GNU General Public License for more details.\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
183 "\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
184 "You should have received a copy of the GNU General Public License\n"
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
185 "along with this program; if not, write to the Free Software\n"
2771
949d790e8e33 fixed FSF HQ address again
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2766
diff changeset
186 "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n"
1298
94eee8a16189 The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents: 1269
diff changeset
187 "USA."), _("Ok"), FALSE, NULL, NULL);
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
188 gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
189 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &dialog);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
190 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
191
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
192 static gint file_open(AFormat fmt, gint rate, gint nch)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
193 {
1011
4a693f5b7054 [svn] - replace xmms_remote_*() with playlist functions.
yaz
parents: 1004
diff changeset
194 gchar *filename = NULL, *temp = NULL;
1687
d158ce84fda7 Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1569
diff changeset
195 const gchar *directory;
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
196 gint pos;
1004
be2d04b2bd28 [svn] - move bmp_title_input_free() into file_open() to avoid memory leak.
yaz
parents: 1000
diff changeset
197 gint rv;
1011
4a693f5b7054 [svn] - replace xmms_remote_*() with playlist functions.
yaz
parents: 1004
diff changeset
198 Playlist *playlist;
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
199
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
200 input.format = fmt;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
201 input.frequency = rate;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
202 input.channels = nch;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
203
2057
cf4fa45ffd80 playlist API vtabling
William Pitcock <nenolod@atheme.org>
parents: 2055
diff changeset
204 playlist = aud_playlist_get_active();
1011
4a693f5b7054 [svn] - replace xmms_remote_*() with playlist functions.
yaz
parents: 1004
diff changeset
205 if(!playlist)
4a693f5b7054 [svn] - replace xmms_remote_*() with playlist functions.
yaz
parents: 1004
diff changeset
206 return 0;
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
207
2057
cf4fa45ffd80 playlist API vtabling
William Pitcock <nenolod@atheme.org>
parents: 2055
diff changeset
208 pos = aud_playlist_get_position(playlist);
cf4fa45ffd80 playlist API vtabling
William Pitcock <nenolod@atheme.org>
parents: 2055
diff changeset
209 tuple = aud_playlist_get_tuple(playlist, pos);
1011
4a693f5b7054 [svn] - replace xmms_remote_*() with playlist functions.
yaz
parents: 1004
diff changeset
210 if(!tuple)
4a693f5b7054 [svn] - replace xmms_remote_*() with playlist functions.
yaz
parents: 1004
diff changeset
211 return 0;
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
212
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
213 if (filenamefromtags)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
214 {
2055
2f2ffbc2d04d gentitle changes
William Pitcock <nenolod@atheme.org>
parents: 1978
diff changeset
215 gchar *utf8 = aud_tuple_formatter_make_title_string(tuple, aud_get_gentitle_format());
1011
4a693f5b7054 [svn] - replace xmms_remote_*() with playlist functions.
yaz
parents: 1004
diff changeset
216
2950
dcd8d93ba781 - mp3: adapted to lame-3.98. now filewriter writes valid TLEN.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2874
diff changeset
217 g_strchomp(utf8); /* chop trailing ^J --yaz */
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
218
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
219 filename = g_locale_from_utf8(utf8, -1, NULL, NULL, NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
220 g_free(utf8);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
221 while (filename != NULL && (temp = strchr(filename, '/')) != NULL)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
222 *temp = '-';
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
223 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
224 if (filename == NULL)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
225 {
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1712
diff changeset
226 filename = g_strdup(aud_tuple_get_string(tuple, FIELD_FILE_NAME, NULL));
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
227 if (!use_suffix)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
228 if ((temp = strrchr(filename, '.')) != NULL)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
229 *temp = '\0';
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
230 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
231 if (filename == NULL)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
232 filename = g_strdup_printf("aud-%d", pos);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
233
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
234
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
235 if (prependnumber)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
236 {
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1712
diff changeset
237 gint number = aud_tuple_get_int(tuple, FIELD_TRACK_NUMBER, NULL);
1687
d158ce84fda7 Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1569
diff changeset
238 if (!tuple || !number)
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
239 number = pos + 1;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
240
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
241 temp = g_strdup_printf("%.02d %s", number, filename);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
242 g_free(filename);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
243 filename = temp;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
244 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
245
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
246 if (save_original)
1976
5fa26178eaef s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents: 1712
diff changeset
247 directory = aud_tuple_get_string(tuple, FIELD_FILE_PATH, NULL);
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
248 else
1687
d158ce84fda7 Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1569
diff changeset
249 directory = file_path;
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
250
1269
0e160bafce1c - adapt filewriter for file:// scheme.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 1113
diff changeset
251 temp = g_strdup_printf("file://%s/%s.%s",
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
252 directory, filename, fileext_str[fileext]);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
253 g_free(filename);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
254 filename = temp;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
255
1978
fa9f85cebade s/vfs_/aud_vfs_/g
William Pitcock <nenolod@atheme.org>
parents: 1976
diff changeset
256 output_file = aud_vfs_fopen(filename, "w");
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
257 g_free(filename);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
258
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
259 if (!output_file)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
260 return 0;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
261
3041
d6fa54737096 Copying structs is not a good idea. Lets use a pointer here.
William Pitcock <nenolod@atheme.org>
parents: 3020
diff changeset
262 convert_init(fmt, plugin->format_required, nch);
2874
11ef2164d90b re-written format conversion using libSAD;
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
263
3041
d6fa54737096 Copying structs is not a good idea. Lets use a pointer here.
William Pitcock <nenolod@atheme.org>
parents: 3020
diff changeset
264 rv = (plugin->open)();
1004
be2d04b2bd28 [svn] - move bmp_title_input_free() into file_open() to avoid memory leak.
yaz
parents: 1000
diff changeset
265
be2d04b2bd28 [svn] - move bmp_title_input_free() into file_open() to avoid memory leak.
yaz
parents: 1000
diff changeset
266 return rv;
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
267 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
268
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
269 static void file_write(void *ptr, gint length)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
270 {
2874
11ef2164d90b re-written format conversion using libSAD;
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
271 int len;
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
272
2874
11ef2164d90b re-written format conversion using libSAD;
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
273 len = convert_process(ptr, length);
11ef2164d90b re-written format conversion using libSAD;
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
274
3041
d6fa54737096 Copying structs is not a good idea. Lets use a pointer here.
William Pitcock <nenolod@atheme.org>
parents: 3020
diff changeset
275 plugin->write(convert_output, len);
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
276 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
277
2766
6d08e3120615 make some file filewriter backends use callbacks instead of calling VFS directly
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2227
diff changeset
278 static gint file_write_output(void *ptr, gint length)
6d08e3120615 make some file filewriter backends use callbacks instead of calling VFS directly
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2227
diff changeset
279 {
6d08e3120615 make some file filewriter backends use callbacks instead of calling VFS directly
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2227
diff changeset
280 return aud_vfs_fwrite(ptr, 1, length, output_file);
6d08e3120615 make some file filewriter backends use callbacks instead of calling VFS directly
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2227
diff changeset
281 }
6d08e3120615 make some file filewriter backends use callbacks instead of calling VFS directly
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2227
diff changeset
282
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
283 static void file_close(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
284 {
3041
d6fa54737096 Copying structs is not a good idea. Lets use a pointer here.
William Pitcock <nenolod@atheme.org>
parents: 3020
diff changeset
285 plugin->close();
2874
11ef2164d90b re-written format conversion using libSAD;
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2873
diff changeset
286 convert_free();
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
287
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
288 if (output_file)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
289 {
1978
fa9f85cebade s/vfs_/aud_vfs_/g
William Pitcock <nenolod@atheme.org>
parents: 1976
diff changeset
290 aud_vfs_fclose(output_file);
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
291 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
292 output_file = NULL;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
293 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
294
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
295 static void file_flush(gint time)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
296 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
297 if (time < 0)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
298 return;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
299
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
300 file_close();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
301 file_open(input.format, input.frequency, input.channels);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
302
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
303 offset = time;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
304 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
305
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
306 static void file_pause(short p)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
307 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
308 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
309
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
310 static gint file_free(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
311 {
3041
d6fa54737096 Copying structs is not a good idea. Lets use a pointer here.
William Pitcock <nenolod@atheme.org>
parents: 3020
diff changeset
312 return plugin->free();
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
313 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
314
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
315 static gint file_playing(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
316 {
3041
d6fa54737096 Copying structs is not a good idea. Lets use a pointer here.
William Pitcock <nenolod@atheme.org>
parents: 3020
diff changeset
317 return plugin->playing();
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
318 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
319
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
320 static gint file_get_written_time(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
321 {
3041
d6fa54737096 Copying structs is not a good idea. Lets use a pointer here.
William Pitcock <nenolod@atheme.org>
parents: 3020
diff changeset
322 return plugin->get_written_time();
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
323 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
324
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
325 static gint file_get_output_time(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
326 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
327 return file_get_written_time();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
328 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
329
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
330 static void configure_ok_cb(gpointer data)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
331 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
332 ConfigDb *db;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
333
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
334 fileext = gtk_combo_box_get_active(GTK_COMBO_BOX(fileext_combo));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
335
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
336 g_free(file_path);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
337 file_path = g_strdup(gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(path_dirbrowser)));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
338
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
339 use_suffix =
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
340 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(use_suffix_toggle));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
341
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
342 prependnumber =
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
343 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(prependnumber_toggle));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
344
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 2057
diff changeset
345 db = aud_cfg_db_open();
2807
f06ec6936b7e migrated some plugins to auto_CFGID
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2775
diff changeset
346 aud_cfg_db_set_int(db, FILEWRITER_CFGID, "fileext", fileext);
f06ec6936b7e migrated some plugins to auto_CFGID
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2775
diff changeset
347 aud_cfg_db_set_string(db, FILEWRITER_CFGID, "file_path", file_path);
f06ec6936b7e migrated some plugins to auto_CFGID
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2775
diff changeset
348 aud_cfg_db_set_bool(db, FILEWRITER_CFGID, "save_original", save_original);
f06ec6936b7e migrated some plugins to auto_CFGID
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2775
diff changeset
349 aud_cfg_db_set_bool(db, FILEWRITER_CFGID, "filenamefromtags", filenamefromtags);
f06ec6936b7e migrated some plugins to auto_CFGID
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2775
diff changeset
350 aud_cfg_db_set_bool(db, FILEWRITER_CFGID, "use_suffix", use_suffix);
f06ec6936b7e migrated some plugins to auto_CFGID
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2775
diff changeset
351 aud_cfg_db_set_bool(db, FILEWRITER_CFGID, "prependnumber", prependnumber);
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
352
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 2057
diff changeset
353 aud_cfg_db_close(db);
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
354
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
355 gtk_widget_destroy(configure_win);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
356 if (path_dirbrowser)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
357 gtk_widget_destroy(path_dirbrowser);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
358 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
359
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
360 static void fileext_cb(GtkWidget *combo, gpointer data)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
361 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
362 fileext = gtk_combo_box_get_active(GTK_COMBO_BOX(fileext_combo));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
363 set_plugin();
3041
d6fa54737096 Copying structs is not a good idea. Lets use a pointer here.
William Pitcock <nenolod@atheme.org>
parents: 3020
diff changeset
364 if (plugin->init)
d6fa54737096 Copying structs is not a good idea. Lets use a pointer here.
William Pitcock <nenolod@atheme.org>
parents: 3020
diff changeset
365 plugin->init(&file_write_output);
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
366
3041
d6fa54737096 Copying structs is not a good idea. Lets use a pointer here.
William Pitcock <nenolod@atheme.org>
parents: 3020
diff changeset
367 gtk_widget_set_sensitive(plugin_button, plugin->configure != NULL);
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
368 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
369
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
370 static void plugin_configure_cb(GtkWidget *button, gpointer data)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
371 {
3041
d6fa54737096 Copying structs is not a good idea. Lets use a pointer here.
William Pitcock <nenolod@atheme.org>
parents: 3020
diff changeset
372 if (plugin->configure)
d6fa54737096 Copying structs is not a good idea. Lets use a pointer here.
William Pitcock <nenolod@atheme.org>
parents: 3020
diff changeset
373 plugin->configure();
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
374 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
375
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
376
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
377 static void saveplace_original_cb(GtkWidget *button, gpointer data)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
378 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
379 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
380 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
381 gtk_widget_set_sensitive(path_hbox, FALSE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
382 save_original = TRUE;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
383 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
384 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
385
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
386 static void saveplace_custom_cb(GtkWidget *button, gpointer data)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
387 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
388 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
389 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
390 gtk_widget_set_sensitive(path_hbox, TRUE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
391 save_original = FALSE;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
392 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
393 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
394
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
395 static void filenamefromtags_cb(GtkWidget *button, gpointer data)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
396 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
397 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
398 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
399 gtk_widget_set_sensitive(use_suffix_toggle, FALSE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
400 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(use_suffix_toggle), FALSE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
401 use_suffix = FALSE;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
402 filenamefromtags = TRUE;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
403 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
404 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
405
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
406 static void filenamefromfilename_cb(GtkWidget *button, gpointer data)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
407 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
408 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
409 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
410 gtk_widget_set_sensitive(use_suffix_toggle, TRUE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
411 filenamefromtags = FALSE;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
412 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
413 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
414
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
415
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
416 static void configure_destroy(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
417 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
418 if (path_dirbrowser)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
419 gtk_widget_destroy(path_dirbrowser);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
420 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
421
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
422 static void file_configure(void)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
423 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
424 GtkTooltips *use_suffix_tooltips;
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
425
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
426 if (!configure_win)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
427 {
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
428 configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
429
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
430 gtk_signal_connect(GTK_OBJECT(configure_win), "destroy",
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
431 GTK_SIGNAL_FUNC(configure_destroy), NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
432 gtk_signal_connect(GTK_OBJECT(configure_win), "destroy",
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
433 GTK_SIGNAL_FUNC(gtk_widget_destroyed),
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
434 &configure_win);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
435
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
436 gtk_window_set_title(GTK_WINDOW(configure_win),
985
029056fb9f9d [svn] - rename titles of configure windows.
yaz
parents: 984
diff changeset
437 _("File Writer Configuration"));
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
438 gtk_window_set_position(GTK_WINDOW(configure_win), GTK_WIN_POS_MOUSE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
439
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
440 gtk_container_set_border_width(GTK_CONTAINER(configure_win), 10);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
441
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
442 configure_vbox = gtk_vbox_new(FALSE, 10);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
443 gtk_container_add(GTK_CONTAINER(configure_win), configure_vbox);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
444
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
445
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
446 fileext_hbox = gtk_hbox_new(FALSE, 5);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
447 gtk_box_pack_start(GTK_BOX(configure_vbox), fileext_hbox, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
448
986
5523559a1eac [svn] - add Vorbis output mode
nenolod
parents: 985
diff changeset
449 fileext_label = gtk_label_new(_("Output file format:"));
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
450 gtk_box_pack_start(GTK_BOX(fileext_hbox), fileext_label, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
451
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
452 fileext_combo = gtk_combo_box_new_text();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
453 gtk_combo_box_append_text(GTK_COMBO_BOX(fileext_combo), "WAV");
1000
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
454 #ifdef FILEWRITER_MP3
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
455 gtk_combo_box_append_text(GTK_COMBO_BOX(fileext_combo), "MP3");
1000
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
456 #endif
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
457 #ifdef FILEWRITER_VORBIS
986
5523559a1eac [svn] - add Vorbis output mode
nenolod
parents: 985
diff changeset
458 gtk_combo_box_append_text(GTK_COMBO_BOX(fileext_combo), "Vorbis");
1000
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
459 #endif
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
460 #ifdef FILEWRITER_FLAC
991
67cf9a1e3dc5 [svn] - commit what i have, presently broken
nenolod
parents: 986
diff changeset
461 gtk_combo_box_append_text(GTK_COMBO_BOX(fileext_combo), "FLAC");
1000
d980b7e5bf1d [svn] - Prepared FileWriter for partial compilation
mf0102
parents: 991
diff changeset
462 #endif
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
463 gtk_box_pack_start(GTK_BOX(fileext_hbox), fileext_combo, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
464 gtk_combo_box_set_active(GTK_COMBO_BOX(fileext_combo), fileext);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
465 g_signal_connect(G_OBJECT(fileext_combo), "changed", G_CALLBACK(fileext_cb), NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
466
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
467 plugin_button = gtk_button_new_with_label(_("Configure"));
3041
d6fa54737096 Copying structs is not a good idea. Lets use a pointer here.
William Pitcock <nenolod@atheme.org>
parents: 3020
diff changeset
468 gtk_widget_set_sensitive(plugin_button, plugin->configure != NULL);
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
469 g_signal_connect(G_OBJECT(plugin_button), "clicked", G_CALLBACK(plugin_configure_cb), NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
470 gtk_box_pack_end(GTK_BOX(fileext_hbox), plugin_button, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
471
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
472
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
473
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
474
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
475 gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
476
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
477
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
478
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
479 saveplace_hbox = gtk_hbox_new(FALSE, 5);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
480 gtk_container_add(GTK_CONTAINER(configure_vbox), saveplace_hbox);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
481
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
482 saveplace = gtk_radio_button_new_with_label(NULL, _("Save into original directory"));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
483 g_signal_connect(G_OBJECT(saveplace), "toggled", G_CALLBACK(saveplace_original_cb), NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
484 gtk_box_pack_start(GTK_BOX(saveplace_hbox), saveplace, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
485
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
486 saveplace = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(saveplace),
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
487 _("Save into custom directory"));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
488 g_signal_connect(G_OBJECT(saveplace), "toggled", G_CALLBACK(saveplace_custom_cb), NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
489 gtk_box_pack_start(GTK_BOX(saveplace_hbox), saveplace, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
490
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
491 if (!save_original)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
492 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(saveplace), TRUE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
493
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
494
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
495
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
496 path_hbox = gtk_hbox_new(FALSE, 5);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
497 gtk_box_pack_start(GTK_BOX(configure_vbox), path_hbox, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
498
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
499 path_label = gtk_label_new(_("Output file folder:"));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
500 gtk_box_pack_start(GTK_BOX(path_hbox), path_label, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
501
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
502 path_dirbrowser =
1298
94eee8a16189 The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents: 1269
diff changeset
503 gtk_file_chooser_button_new (_("Pick a folder"),
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
504 GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
505 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(path_dirbrowser),
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
506 file_path);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
507 gtk_box_pack_start(GTK_BOX(path_hbox), path_dirbrowser, TRUE, TRUE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
508
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
509 if (save_original)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
510 gtk_widget_set_sensitive(path_hbox, FALSE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
511
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
512
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
513
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
514
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
515 gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
516
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
517
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
518
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
519
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
520 filenamefrom_hbox = gtk_hbox_new(FALSE, 5);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
521 gtk_container_add(GTK_CONTAINER(configure_vbox), filenamefrom_hbox);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
522
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
523 filenamefrom_label = gtk_label_new(_("Get filename from:"));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
524 gtk_box_pack_start(GTK_BOX(filenamefrom_hbox), filenamefrom_label, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
525
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
526 filenamefrom_toggle = gtk_radio_button_new_with_label(NULL, _("original file tags"));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
527 g_signal_connect(G_OBJECT(filenamefrom_toggle), "toggled", G_CALLBACK(filenamefromtags_cb), NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
528 gtk_box_pack_start(GTK_BOX(filenamefrom_hbox), filenamefrom_toggle, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
529
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
530 filenamefrom_toggle =
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
531 gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(filenamefrom_toggle),
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
532 _("original filename"));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
533 g_signal_connect(G_OBJECT(filenamefrom_toggle), "toggled", G_CALLBACK(filenamefromfilename_cb), NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
534 gtk_box_pack_start(GTK_BOX(filenamefrom_hbox), filenamefrom_toggle, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
535
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
536 if (!filenamefromtags)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
537 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(filenamefrom_toggle), TRUE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
538
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
539
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
540
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
541
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
542 use_suffix_toggle = gtk_check_button_new_with_label(_("Don't strip file name extension"));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
543 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(use_suffix_toggle), use_suffix);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
544 gtk_box_pack_start(GTK_BOX(configure_vbox), use_suffix_toggle, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
545 use_suffix_tooltips = gtk_tooltips_new();
1525
bee9eaedefa5 - made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents: 1510
diff changeset
546 gtk_tooltips_set_tip(use_suffix_tooltips, use_suffix_toggle, _("If enabled, the extension from the original filename will not be stripped before adding the new file extension to the end."), NULL);
984
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
547 gtk_tooltips_enable(use_suffix_tooltips);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
548
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
549 if (filenamefromtags)
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
550 gtk_widget_set_sensitive(use_suffix_toggle, FALSE);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
551
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
552
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
553
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
554
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
555 gtk_box_pack_start(GTK_BOX(configure_vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
556
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
557
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
558
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
559
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
560 prependnumber_toggle = gtk_check_button_new_with_label(_("Prepend track number to filename"));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
561 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prependnumber_toggle), prependnumber);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
562 gtk_box_pack_start(GTK_BOX(configure_vbox), prependnumber_toggle, FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
563
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
564
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
565
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
566 configure_bbox = gtk_hbutton_box_new();
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
567 gtk_button_box_set_layout(GTK_BUTTON_BOX(configure_bbox),
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
568 GTK_BUTTONBOX_END);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
569 gtk_button_box_set_spacing(GTK_BUTTON_BOX(configure_bbox), 5);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
570 gtk_box_pack_start(GTK_BOX(configure_vbox), configure_bbox,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
571 FALSE, FALSE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
572
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
573 configure_cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
574 gtk_signal_connect_object(GTK_OBJECT(configure_cancel), "clicked",
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
575 GTK_SIGNAL_FUNC(gtk_widget_destroy),
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
576 GTK_OBJECT(configure_win));
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
577 gtk_box_pack_start(GTK_BOX(configure_bbox), configure_cancel,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
578 TRUE, TRUE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
579
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
580 configure_ok = gtk_button_new_from_stock(GTK_STOCK_OK);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
581 gtk_signal_connect(GTK_OBJECT(configure_ok), "clicked",
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
582 GTK_SIGNAL_FUNC(configure_ok_cb), NULL);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
583 gtk_box_pack_start(GTK_BOX(configure_bbox), configure_ok,
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
584 TRUE, TRUE, 0);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
585
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
586 gtk_widget_show_all(configure_win);
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
587 }
df7b09989aee [svn] - We got a new plugin, captain!
mf0102
parents:
diff changeset
588 }