Mercurial > audlegacy
annotate src/audacious/ui_fileopener.c @ 3205:97d992b5db2b trunk
Automated merge with ssh://kustodian@hg.atheme.org//hg/audacious
author | Strahinja Kustudic <kustodian@gmail.com> |
---|---|
date | Wed, 01 Aug 2007 14:50:23 +0200 |
parents | f1c756f39e6c |
children | c48ce3f67130 |
rev | line source |
---|---|
2417 | 1 /* Audacious - Cross-platform multimedia player |
2 * Copyright (C) 2005-2007 Audacious development team | |
3 * | |
4 * This program is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2986
diff
changeset
|
6 * the Free Software Foundation; under version 3 of the License. |
2417 | 7 * |
8 * This program is distributed in the hope that it will be useful, | |
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 * GNU General Public License for more details. | |
12 * | |
13 * You should have received a copy of the GNU General Public License | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2986
diff
changeset
|
14 * along with this program. If not, see <http://www.gnu.org/licenses>. |
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
15 * |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
16 * The Audacious team does not consider modular code linking to |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
17 * Audacious or using our public API to be a derived work. |
2417 | 18 */ |
19 | |
20 #include "ui_fileopener.h" | |
21 | |
22 #include <glib/gi18n.h> | |
23 #include <string.h> | |
2432
4a1d1c324685
[svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents:
2422
diff
changeset
|
24 #include <gdk/gdkkeysyms.h> |
2417 | 25 |
26 #include "input.h" | |
27 #include "main.h" | |
28 #include "playback.h" | |
29 #include "strings.h" | |
30 #include "ui_playlist.h" | |
31 | |
32 static void | |
33 filebrowser_add_files(GtkFileChooser * browser, | |
34 GSList * files) | |
35 { | |
36 GSList *cur; | |
37 gchar *ptr; | |
38 guint ctr = 0; | |
39 Playlist *playlist = playlist_get_active(); | |
40 | |
41 for (cur = files; cur; cur = g_slist_next(cur)) { | |
42 | |
2984
df71b1cef70a
Use vfs_file_test() instead of g_file_test() where appropriate.
William Pitcock <nenolod@atheme-project.org>
parents:
2658
diff
changeset
|
43 if (vfs_file_test(cur->data, G_FILE_TEST_IS_DIR)) { |
2417 | 44 playlist_add_dir(playlist, (const gchar *) cur->data); |
45 } else { | |
46 playlist_add(playlist, (const gchar *) cur->data); | |
47 } | |
48 | |
49 if (++ctr == 20) { | |
50 playlistwin_update_list(playlist); | |
51 ctr = 0; | |
52 while (gtk_events_pending() ) gtk_main_iteration(); | |
53 } | |
54 } | |
55 | |
56 playlistwin_update_list(playlist); | |
57 | |
58 ptr = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(browser)); | |
59 | |
60 g_free(cfg.filesel_path); | |
61 cfg.filesel_path = ptr; | |
62 } | |
63 | |
64 static void | |
65 action_button_cb(GtkWidget *widget, gpointer data) | |
66 { | |
67 GtkWidget *window = g_object_get_data(data, "window"); | |
68 GtkWidget *chooser = g_object_get_data(data, "chooser"); | |
69 GtkWidget *toggle = g_object_get_data(data, "toggle-button"); | |
2658
4b8db8c0521d
[svn] - fixed c++ish declaration in a c file (part 5)
giacomo
parents:
2500
diff
changeset
|
70 gboolean play_button; |
4b8db8c0521d
[svn] - fixed c++ish declaration in a c file (part 5)
giacomo
parents:
2500
diff
changeset
|
71 GSList *files; |
2417 | 72 cfg.close_dialog_open = |
73 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle)); | |
74 | |
2658
4b8db8c0521d
[svn] - fixed c++ish declaration in a c file (part 5)
giacomo
parents:
2500
diff
changeset
|
75 play_button = |
2417 | 76 GPOINTER_TO_INT(g_object_get_data(data, "play-button")); |
77 | |
2986
4fb16b502a06
Use gtk_file_chooser_get_uris() to enforce proper VFS URIs being passed around.
William Pitcock <nenolod@atheme-project.org>
parents:
2984
diff
changeset
|
78 files = gtk_file_chooser_get_uris(GTK_FILE_CHOOSER(chooser)); |
2417 | 79 if (!files) return; |
80 | |
81 if (play_button) | |
82 playlist_clear(playlist_get_active()); | |
83 | |
84 filebrowser_add_files(GTK_FILE_CHOOSER(chooser), files); | |
85 g_slist_foreach(files, (GFunc) g_free, NULL); | |
86 g_slist_free(files); | |
87 | |
88 if (play_button) | |
89 playback_initiate(); | |
90 | |
91 if (cfg.close_dialog_open) | |
92 gtk_widget_destroy(window); | |
93 } | |
94 | |
95 | |
96 static void | |
97 close_button_cb(GtkWidget *widget, gpointer data) | |
98 { | |
99 gtk_widget_destroy(GTK_WIDGET(data)); | |
100 } | |
101 | |
2432
4a1d1c324685
[svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents:
2422
diff
changeset
|
102 static gboolean |
4a1d1c324685
[svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents:
2422
diff
changeset
|
103 filebrowser_on_keypress(GtkWidget * browser, |
4a1d1c324685
[svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents:
2422
diff
changeset
|
104 GdkEventKey * event, |
4a1d1c324685
[svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents:
2422
diff
changeset
|
105 gpointer data) |
4a1d1c324685
[svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents:
2422
diff
changeset
|
106 { |
4a1d1c324685
[svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents:
2422
diff
changeset
|
107 if (event->keyval == GDK_Escape) { |
2449 | 108 gtk_widget_destroy(browser); |
2432
4a1d1c324685
[svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents:
2422
diff
changeset
|
109 return TRUE; |
4a1d1c324685
[svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents:
2422
diff
changeset
|
110 } |
4a1d1c324685
[svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents:
2422
diff
changeset
|
111 |
4a1d1c324685
[svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents:
2422
diff
changeset
|
112 return FALSE; |
4a1d1c324685
[svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents:
2422
diff
changeset
|
113 } |
4a1d1c324685
[svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents:
2422
diff
changeset
|
114 |
2417 | 115 void |
116 util_run_filebrowser_gtk2style(gboolean play_button) | |
117 { | |
2449 | 118 static GtkWidget *window = NULL; |
2417 | 119 GtkWidget *vbox, *hbox, *bbox; |
120 GtkWidget *chooser; | |
121 GtkWidget *action_button, *close_button; | |
122 GtkWidget *toggle; | |
2658
4b8db8c0521d
[svn] - fixed c++ish declaration in a c file (part 5)
giacomo
parents:
2500
diff
changeset
|
123 gchar *window_title, *toggle_text; |
4b8db8c0521d
[svn] - fixed c++ish declaration in a c file (part 5)
giacomo
parents:
2500
diff
changeset
|
124 gpointer action_stock, storage; |
2417 | 125 |
2490
49e27e4d8426
[svn] - trying to open filebrowser when it is already open will raise the filebrowser.
yaz
parents:
2449
diff
changeset
|
126 if(window) { |
49e27e4d8426
[svn] - trying to open filebrowser when it is already open will raise the filebrowser.
yaz
parents:
2449
diff
changeset
|
127 gtk_window_present(GTK_WINDOW(window)); /* raise filebrowser */ |
2449 | 128 return; |
2490
49e27e4d8426
[svn] - trying to open filebrowser when it is already open will raise the filebrowser.
yaz
parents:
2449
diff
changeset
|
129 } |
2449 | 130 |
2658
4b8db8c0521d
[svn] - fixed c++ish declaration in a c file (part 5)
giacomo
parents:
2500
diff
changeset
|
131 window_title = play_button ? _("Open Files") : _("Add Files"); |
4b8db8c0521d
[svn] - fixed c++ish declaration in a c file (part 5)
giacomo
parents:
2500
diff
changeset
|
132 toggle_text = play_button ? |
2417 | 133 _("Close dialog on Open") : _("Close dialog on Add"); |
2658
4b8db8c0521d
[svn] - fixed c++ish declaration in a c file (part 5)
giacomo
parents:
2500
diff
changeset
|
134 action_stock = play_button ? GTK_STOCK_OPEN : GTK_STOCK_ADD; |
2417 | 135 |
136 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
137 gtk_window_set_title(GTK_WINDOW(window), window_title); | |
138 gtk_window_set_default_size(GTK_WINDOW(window), 700, 450); | |
2440
7f0318090690
[svn] - set the gtk2 fileopener position to the center of the screen
giacomo
parents:
2432
diff
changeset
|
139 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); |
2417 | 140 gtk_container_set_border_width(GTK_CONTAINER(window), 10); |
141 | |
142 vbox = gtk_vbox_new(FALSE, 0); | |
143 gtk_container_add(GTK_CONTAINER(window), vbox); | |
144 | |
145 chooser = gtk_file_chooser_widget_new(GTK_FILE_CHOOSER_ACTION_OPEN); | |
146 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(chooser), TRUE); | |
147 if (cfg.filesel_path) | |
148 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(chooser), | |
149 cfg.filesel_path); | |
2422 | 150 gtk_box_pack_start(GTK_BOX(vbox), chooser, TRUE, TRUE, 3); |
2417 | 151 |
152 hbox = gtk_hbox_new(TRUE, 0); | |
2422 | 153 gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 3); |
2417 | 154 |
155 toggle = gtk_check_button_new_with_label(toggle_text); | |
156 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
157 cfg.close_dialog_open ? TRUE : FALSE); | |
2422 | 158 gtk_box_pack_start(GTK_BOX(hbox), toggle, TRUE, TRUE, 3); |
2417 | 159 |
160 bbox = gtk_hbutton_box_new(); | |
161 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
2422 | 162 gtk_box_set_spacing(GTK_BOX(bbox), 6); |
163 gtk_box_pack_end(GTK_BOX(hbox), bbox, TRUE, TRUE, 3); | |
2417 | 164 |
165 close_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); | |
166 action_button = gtk_button_new_from_stock(action_stock); | |
167 gtk_container_add(GTK_CONTAINER(bbox), close_button); | |
168 gtk_container_add(GTK_CONTAINER(bbox), action_button); | |
169 | |
2420 | 170 /* this storage object holds several other objects which are used in the |
171 * callback functions | |
172 */ | |
2658
4b8db8c0521d
[svn] - fixed c++ish declaration in a c file (part 5)
giacomo
parents:
2500
diff
changeset
|
173 storage = g_object_new(G_TYPE_OBJECT, NULL); |
2417 | 174 g_object_set_data(storage, "window", window); |
175 g_object_set_data(storage, "chooser", chooser); | |
176 g_object_set_data(storage, "toggle-button", toggle); | |
177 g_object_set_data(storage, "play-button", GINT_TO_POINTER(play_button)); | |
178 | |
179 g_signal_connect(chooser, "file-activated", | |
180 G_CALLBACK(action_button_cb), storage); | |
181 g_signal_connect(action_button, "clicked", | |
182 G_CALLBACK(action_button_cb), storage); | |
183 g_signal_connect(close_button, "clicked", | |
184 G_CALLBACK(close_button_cb), window); | |
185 g_signal_connect(window, "destroy", | |
186 G_CALLBACK(gtk_widget_destroyed), &window); | |
187 | |
2432
4a1d1c324685
[svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents:
2422
diff
changeset
|
188 g_signal_connect(window, "key_press_event", |
4a1d1c324685
[svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents:
2422
diff
changeset
|
189 G_CALLBACK(filebrowser_on_keypress), |
4a1d1c324685
[svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents:
2422
diff
changeset
|
190 NULL); |
4a1d1c324685
[svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents:
2422
diff
changeset
|
191 |
2417 | 192 gtk_widget_show_all(window); |
193 } | |
194 | |
195 /* | |
196 * Derived from Beep Media Player 0.9.6.1. | |
197 * Which is (C) 2003 - 2006 Milosz Derezynski &c | |
198 * | |
199 * Although I changed it quite a bit. -nenolod | |
200 */ | |
201 static void filebrowser_changed_classic(GtkFileSelection * filesel) | |
202 { | |
203 GList *list; | |
204 GList *node; | |
205 char *filename = (char *) | |
206 gtk_file_selection_get_filename(GTK_FILE_SELECTION(filesel)); | |
207 GtkListStore *store; | |
208 GtkTreeIter iter; | |
209 | |
210 if ((list = input_scan_dir(filename)) != NULL) | |
211 { | |
212 /* | |
213 * We enter a directory that has been "hijacked" by an | |
214 * input-plugin. This is used by the CDDA plugin | |
215 */ | |
216 store = | |
217 GTK_LIST_STORE(gtk_tree_view_get_model | |
218 (GTK_TREE_VIEW(filesel->file_list))); | |
219 gtk_list_store_clear(store); | |
220 | |
221 node = list; | |
222 while (node) { | |
223 gtk_list_store_append(store, &iter); | |
224 gtk_list_store_set(store, &iter, 0, node->data, -1); | |
225 g_free(node->data); | |
226 node = g_list_next(node); | |
227 } | |
228 | |
229 g_list_free(list); | |
230 } | |
231 } | |
232 | |
233 static void filebrowser_entry_changed_classic(GtkEditable * entry, gpointer data) | |
234 { | |
235 filebrowser_changed_classic(GTK_FILE_SELECTION(data)); | |
236 } | |
237 | |
238 | |
239 static gboolean | |
240 util_filebrowser_is_dir_classic(GtkFileSelection * filesel) | |
241 { | |
242 char *text; | |
243 struct stat buf; | |
244 gboolean retv = FALSE; | |
245 | |
246 text = g_strdup(gtk_file_selection_get_filename(filesel)); | |
247 | |
248 if (stat(text, &buf) == 0 && S_ISDIR(buf.st_mode)) { | |
249 /* Selected directory */ | |
250 int len = strlen(text); | |
251 if (len > 3 && !strcmp(text + len - 4, "/../")) { | |
252 if (len == 4) | |
253 /* At the root already */ | |
254 *(text + len - 3) = '\0'; | |
255 else { | |
256 char *ptr; | |
257 *(text + len - 4) = '\0'; | |
258 ptr = strrchr(text, '/'); | |
259 *(ptr + 1) = '\0'; | |
260 } | |
261 } else if (len > 2 && !strcmp(text + len - 3, "/./")) | |
262 *(text + len - 2) = '\0'; | |
263 gtk_file_selection_set_filename(filesel, text); | |
264 retv = TRUE; | |
265 } | |
266 g_free(text); | |
267 return retv; | |
268 } | |
269 | |
270 static void filebrowser_add_files_classic(gchar ** files, | |
271 GtkFileSelection * filesel) | |
272 { | |
273 int ctr = 0; | |
274 char *ptr; | |
275 Playlist *playlist = playlist_get_active(); | |
276 | |
277 | |
278 while (files[ctr] != NULL) { | |
2500 | 279 playlist_add(playlist, files[ctr++]); |
2417 | 280 } |
281 playlistwin_update_list(playlist); | |
282 | |
283 gtk_label_get(GTK_LABEL(GTK_BIN(filesel->history_pulldown)->child), | |
284 &ptr); | |
285 | |
286 /* This will give an extra slash if the current dir is the root. */ | |
287 cfg.filesel_path = g_strconcat(ptr, "/", NULL); | |
288 } | |
289 | |
290 static void filebrowser_ok_classic(GtkWidget * w, GtkWidget * filesel) | |
291 { | |
292 gchar **files; | |
293 | |
294 if (util_filebrowser_is_dir_classic(GTK_FILE_SELECTION(filesel))) | |
295 return; | |
296 files = gtk_file_selection_get_selections(GTK_FILE_SELECTION(filesel)); | |
297 filebrowser_add_files_classic(files, GTK_FILE_SELECTION(filesel)); | |
298 gtk_widget_destroy(filesel); | |
299 } | |
300 | |
301 static void filebrowser_play_classic(GtkWidget * w, GtkWidget * filesel) | |
302 { | |
303 gchar **files; | |
304 | |
305 if (util_filebrowser_is_dir_classic | |
306 (GTK_FILE_SELECTION(GTK_FILE_SELECTION(filesel)))) | |
307 return; | |
308 playlist_clear(playlist_get_active()); | |
309 files = gtk_file_selection_get_selections(GTK_FILE_SELECTION(filesel)); | |
310 filebrowser_add_files_classic(files, GTK_FILE_SELECTION(filesel)); | |
311 gtk_widget_destroy(filesel); | |
312 playback_initiate(); | |
313 } | |
314 | |
315 static void filebrowser_add_selected_files_classic(GtkWidget * w, gpointer data) | |
316 { | |
317 gchar **files; | |
318 | |
319 GtkFileSelection *filesel = GTK_FILE_SELECTION(data); | |
320 files = gtk_file_selection_get_selections(filesel); | |
321 | |
322 filebrowser_add_files_classic(files, filesel); | |
323 gtk_tree_selection_unselect_all(gtk_tree_view_get_selection | |
324 (GTK_TREE_VIEW(filesel->file_list))); | |
325 | |
326 gtk_entry_set_text(GTK_ENTRY(filesel->selection_entry), ""); | |
327 } | |
328 | |
329 static void filebrowser_add_all_files_classic(GtkWidget * w, gpointer data) | |
330 { | |
331 gchar **files; | |
332 GtkFileSelection *filesel; | |
333 | |
334 filesel = data; | |
335 gtk_tree_selection_select_all(gtk_tree_view_get_selection | |
336 (GTK_TREE_VIEW(filesel->file_list))); | |
337 files = gtk_file_selection_get_selections(filesel); | |
338 filebrowser_add_files_classic(files, filesel); | |
339 gtk_tree_selection_unselect_all(gtk_tree_view_get_selection | |
340 (GTK_TREE_VIEW(filesel->file_list))); | |
341 gtk_entry_set_text(GTK_ENTRY(filesel->selection_entry), ""); | |
342 } | |
343 | |
344 void | |
345 util_run_filebrowser_classic(gboolean play_button) | |
346 { | |
347 static GtkWidget *dialog; | |
348 GtkWidget *button_add_selected, *button_add_all, *button_close, | |
349 *button_add; | |
350 char *title; | |
351 | |
352 if (dialog != NULL) { | |
353 gtk_window_present(GTK_WINDOW(dialog)); | |
354 return; | |
355 } | |
356 | |
357 if (play_button) | |
358 title = _("Play files"); | |
359 else | |
360 title = _("Load files"); | |
361 | |
362 dialog = gtk_file_selection_new(title); | |
363 | |
364 gtk_file_selection_set_select_multiple | |
365 (GTK_FILE_SELECTION(dialog), TRUE); | |
366 | |
367 if (cfg.filesel_path) | |
368 gtk_file_selection_set_filename(GTK_FILE_SELECTION(dialog), | |
369 cfg.filesel_path); | |
370 | |
371 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(dialog)); | |
372 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); | |
373 | |
374 gtk_widget_hide(GTK_FILE_SELECTION(dialog)->ok_button); | |
375 gtk_widget_destroy(GTK_FILE_SELECTION(dialog)->cancel_button); | |
376 | |
377 /* | |
378 * The mnemonics are quite unorthodox, but that should guarantee they're unique in any locale | |
379 * plus kinda easy to use | |
380 */ | |
381 button_add_selected = | |
382 gtk_dialog_add_button(GTK_DIALOG(dialog), "Add selected", | |
383 GTK_RESPONSE_NONE); | |
384 gtk_button_set_use_underline(GTK_BUTTON(button_add_selected), TRUE); | |
385 g_signal_connect(G_OBJECT(button_add_selected), "clicked", | |
386 G_CALLBACK(filebrowser_add_selected_files_classic), dialog); | |
387 | |
388 button_add_all = | |
389 gtk_dialog_add_button(GTK_DIALOG(dialog), "Add all", | |
390 GTK_RESPONSE_NONE); | |
391 gtk_button_set_use_underline(GTK_BUTTON(button_add_all), TRUE); | |
392 g_signal_connect(G_OBJECT(button_add_all), "clicked", | |
393 G_CALLBACK(filebrowser_add_all_files_classic), dialog); | |
394 | |
395 if (play_button) { | |
396 button_add = | |
397 gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_MEDIA_PLAY, | |
398 GTK_RESPONSE_NONE); | |
399 gtk_button_set_use_stock(GTK_BUTTON(button_add), TRUE); | |
400 g_signal_connect(G_OBJECT(button_add), "clicked", | |
401 G_CALLBACK(filebrowser_play_classic), dialog); | |
402 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dialog)->ok_button), | |
403 "clicked", G_CALLBACK(filebrowser_play_classic), dialog); | |
404 } else { | |
405 button_add = | |
406 gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_ADD, | |
407 GTK_RESPONSE_NONE); | |
408 gtk_button_set_use_stock(GTK_BUTTON(button_add), TRUE); | |
409 g_signal_connect(G_OBJECT(button_add), "clicked", | |
410 G_CALLBACK(filebrowser_ok_classic), dialog); | |
411 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dialog)->ok_button), | |
412 "clicked", G_CALLBACK(filebrowser_ok_classic), dialog); | |
413 } | |
414 | |
415 button_close = | |
416 gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CLOSE, | |
417 GTK_RESPONSE_NONE); | |
418 gtk_button_set_use_stock(GTK_BUTTON(button_close), TRUE); | |
419 g_signal_connect_swapped(G_OBJECT(button_close), "clicked", | |
420 G_CALLBACK(gtk_widget_destroy), | |
421 G_OBJECT(dialog)); | |
422 | |
423 gtk_widget_set_size_request(dialog, 600, 450); | |
424 gtk_widget_realize(dialog); | |
425 | |
426 g_signal_connect(G_OBJECT | |
427 (GTK_FILE_SELECTION(dialog)->history_pulldown), | |
428 "changed", G_CALLBACK(filebrowser_entry_changed_classic), | |
429 dialog); | |
430 | |
431 g_signal_connect(G_OBJECT(dialog), "destroy", | |
432 G_CALLBACK(gtk_widget_destroyed), &dialog); | |
433 | |
434 filebrowser_changed_classic(GTK_FILE_SELECTION(dialog)); | |
435 | |
436 gtk_widget_show(dialog); | |
437 } | |
438 | |
439 /* | |
440 * util_run_filebrowser(gboolean play_button) | |
441 * | |
442 * Inputs: | |
443 * - whether or not a play button should be used | |
444 * | |
445 * Outputs: | |
446 * - none | |
447 * | |
448 * Side Effects: | |
449 * - either a GTK1 or a GTK2 fileselector is launched | |
450 */ | |
451 void | |
452 run_filebrowser(gboolean play_button) | |
453 { | |
454 if (!cfg.use_xmms_style_fileselector) | |
455 util_run_filebrowser_gtk2style(play_button); | |
456 else | |
457 util_run_filebrowser_classic(play_button); | |
458 } |