annotate src/audlegacy/ui_fileopener.c @ 4848:b2ee645f3e59

Hook up the equalizer (bug #24)
author John Lindgren <john.lindgren@tds.net>
date Sun, 12 Apr 2009 23:03:39 -0400
parents 7bf7f83a217e
children a3cf163c772b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
1 /* Audacious - Cross-platform multimedia player
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
2 * Copyright (C) 2005-2007 Audacious development team
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
3 *
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
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
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
7 *
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
8 * This program is distributed in the hope that it will be useful,
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
11 * GNU General Public License for more details.
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
12 *
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
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
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
18 */
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
19
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
20 #include "ui_fileopener.h"
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
21
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
22 #include <glib/gi18n.h>
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
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
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
25
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
26 #include "input.h"
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
27 #include "main.h"
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
28 #include "playback.h"
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
29 #include "strings.h"
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
30
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
31 static void
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
32 filebrowser_add_files(GtkFileChooser * browser,
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
33 GSList * files)
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
34 {
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
35 GSList *cur;
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
36 gchar *ptr;
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
37 Playlist *playlist = playlist_get_active();
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
38
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
39 for (cur = files; cur; cur = g_slist_next(cur)) {
3235
c48ce3f67130 gtk_file_chooser_get_uris() results in unpredictable behaviour when GNOME is not installed. Build URIs ourselves.
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
40 gchar *filename = g_filename_to_uri((const gchar *) cur->data, NULL, NULL);
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
41
2984
df71b1cef70a Use vfs_file_test() instead of g_file_test() where appropriate.
William Pitcock <nenolod@atheme-project.org>
parents: 2658
diff changeset
42 if (vfs_file_test(cur->data, G_FILE_TEST_IS_DIR)) {
3235
c48ce3f67130 gtk_file_chooser_get_uris() results in unpredictable behaviour when GNOME is not installed. Build URIs ourselves.
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
43 playlist_add_dir(playlist, filename ? filename : (const gchar *) cur->data);
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
44 } else {
3235
c48ce3f67130 gtk_file_chooser_get_uris() results in unpredictable behaviour when GNOME is not installed. Build URIs ourselves.
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
45 playlist_add(playlist, filename ? filename : (const gchar *) cur->data);
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
46 }
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
47
3235
c48ce3f67130 gtk_file_chooser_get_uris() results in unpredictable behaviour when GNOME is not installed. Build URIs ourselves.
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
48 g_free(filename);
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
49 }
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
50
4716
8e62ba58ea6e made fileopener legacy-free
mf0102 <0102@gmx.at>
parents: 4700
diff changeset
51 hook_call("playlist update", playlist);
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
52
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
53 ptr = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(browser));
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
54
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
55 g_free(cfg.filesel_path);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
56 cfg.filesel_path = ptr;
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
57 }
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
58
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
59 static void
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
60 action_button_cb(GtkWidget *widget, gpointer data)
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
61 {
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
62 GtkWidget *window = g_object_get_data(data, "window");
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
63 GtkWidget *chooser = g_object_get_data(data, "chooser");
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
64 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
65 gboolean play_button;
4b8db8c0521d [svn] - fixed c++ish declaration in a c file (part 5)
giacomo
parents: 2500
diff changeset
66 GSList *files;
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
67 cfg.close_dialog_open =
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
68 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle));
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
69
2658
4b8db8c0521d [svn] - fixed c++ish declaration in a c file (part 5)
giacomo
parents: 2500
diff changeset
70 play_button =
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
71 GPOINTER_TO_INT(g_object_get_data(data, "play-button"));
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
72
3235
c48ce3f67130 gtk_file_chooser_get_uris() results in unpredictable behaviour when GNOME is not installed. Build URIs ourselves.
William Pitcock <nenolod@atheme-project.org>
parents: 3123
diff changeset
73 files = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(chooser));
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
74 if (!files) return;
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
75
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
76 if (play_button)
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
77 playlist_clear(playlist_get_active());
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
78
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
79 filebrowser_add_files(GTK_FILE_CHOOSER(chooser), files);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
80 g_slist_foreach(files, (GFunc) g_free, NULL);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
81 g_slist_free(files);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
82
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
83 if (play_button)
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
84 playback_initiate();
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
85
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
86 if (cfg.close_dialog_open)
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
87 gtk_widget_destroy(window);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
88 }
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
89
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
90
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
91 static void
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
92 close_button_cb(GtkWidget *widget, gpointer data)
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
93 {
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
94 gtk_widget_destroy(GTK_WIDGET(data));
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
95 }
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
96
2432
4a1d1c324685 [svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents: 2422
diff changeset
97 static gboolean
4a1d1c324685 [svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents: 2422
diff changeset
98 filebrowser_on_keypress(GtkWidget * browser,
4a1d1c324685 [svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents: 2422
diff changeset
99 GdkEventKey * event,
4a1d1c324685 [svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents: 2422
diff changeset
100 gpointer data)
4a1d1c324685 [svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents: 2422
diff changeset
101 {
4a1d1c324685 [svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents: 2422
diff changeset
102 if (event->keyval == GDK_Escape) {
2449
48c352f89a4e [svn] - avoid multiple open of filebrowser
yaz
parents: 2440
diff changeset
103 gtk_widget_destroy(browser);
2432
4a1d1c324685 [svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents: 2422
diff changeset
104 return TRUE;
4a1d1c324685 [svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents: 2422
diff changeset
105 }
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 return FALSE;
4a1d1c324685 [svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents: 2422
diff changeset
108 }
4a1d1c324685 [svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents: 2422
diff changeset
109
3917
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3647
diff changeset
110 static void
4786
a28b97667415 renaming
mf0102 <0102@gmx.at>
parents: 4785
diff changeset
111 run_filebrowser_gtk2style(gboolean play_button, gboolean show)
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
112 {
2449
48c352f89a4e [svn] - avoid multiple open of filebrowser
yaz
parents: 2440
diff changeset
113 static GtkWidget *window = NULL;
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
114 GtkWidget *vbox, *hbox, *bbox;
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
115 GtkWidget *chooser;
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
116 GtkWidget *action_button, *close_button;
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
117 GtkWidget *toggle;
2658
4b8db8c0521d [svn] - fixed c++ish declaration in a c file (part 5)
giacomo
parents: 2500
diff changeset
118 gchar *window_title, *toggle_text;
4b8db8c0521d [svn] - fixed c++ish declaration in a c file (part 5)
giacomo
parents: 2500
diff changeset
119 gpointer action_stock, storage;
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
120
4784
68f38592d757 pre-codechange indentation
mf0102 <0102@gmx.at>
parents: 4716
diff changeset
121 if (!show) {
68f38592d757 pre-codechange indentation
mf0102 <0102@gmx.at>
parents: 4716
diff changeset
122 if (window){
3917
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3647
diff changeset
123 gtk_widget_hide(window);
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3647
diff changeset
124 return;
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3647
diff changeset
125 }
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3647
diff changeset
126 else
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3647
diff changeset
127 return;
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3647
diff changeset
128 }
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3647
diff changeset
129 else {
4784
68f38592d757 pre-codechange indentation
mf0102 <0102@gmx.at>
parents: 4716
diff changeset
130 if (window) {
3917
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3647
diff changeset
131 gtk_window_present(GTK_WINDOW(window)); /* raise filebrowser */
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3647
diff changeset
132 return;
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3647
diff changeset
133 }
2490
49e27e4d8426 [svn] - trying to open filebrowser when it is already open will raise the filebrowser.
yaz
parents: 2449
diff changeset
134 }
4784
68f38592d757 pre-codechange indentation
mf0102 <0102@gmx.at>
parents: 4716
diff changeset
135
2658
4b8db8c0521d [svn] - fixed c++ish declaration in a c file (part 5)
giacomo
parents: 2500
diff changeset
136 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
137 toggle_text = play_button ?
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
138 _("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
139 action_stock = play_button ? GTK_STOCK_OPEN : GTK_STOCK_ADD;
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
140
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
141 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
142 gtk_window_set_title(GTK_WINDOW(window), window_title);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
143 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
144 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
145 gtk_container_set_border_width(GTK_CONTAINER(window), 10);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
146
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
147 vbox = gtk_vbox_new(FALSE, 0);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
148 gtk_container_add(GTK_CONTAINER(window), vbox);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
149
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
150 chooser = gtk_file_chooser_widget_new(GTK_FILE_CHOOSER_ACTION_OPEN);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
151 gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(chooser), TRUE);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
152 if (cfg.filesel_path)
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
153 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(chooser),
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
154 cfg.filesel_path);
2422
b31111934cd3 [svn] - break out the URL opener UI code
nenolod
parents: 2420
diff changeset
155 gtk_box_pack_start(GTK_BOX(vbox), chooser, TRUE, TRUE, 3);
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
156
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
157 hbox = gtk_hbox_new(TRUE, 0);
2422
b31111934cd3 [svn] - break out the URL opener UI code
nenolod
parents: 2420
diff changeset
158 gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 3);
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
159
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
160 toggle = gtk_check_button_new_with_label(toggle_text);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
161 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
162 cfg.close_dialog_open ? TRUE : FALSE);
2422
b31111934cd3 [svn] - break out the URL opener UI code
nenolod
parents: 2420
diff changeset
163 gtk_box_pack_start(GTK_BOX(hbox), toggle, TRUE, TRUE, 3);
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
164
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
165 bbox = gtk_hbutton_box_new();
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
166 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
2422
b31111934cd3 [svn] - break out the URL opener UI code
nenolod
parents: 2420
diff changeset
167 gtk_box_set_spacing(GTK_BOX(bbox), 6);
b31111934cd3 [svn] - break out the URL opener UI code
nenolod
parents: 2420
diff changeset
168 gtk_box_pack_end(GTK_BOX(hbox), bbox, TRUE, TRUE, 3);
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
169
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
170 close_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
171 action_button = gtk_button_new_from_stock(action_stock);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
172 gtk_container_add(GTK_CONTAINER(bbox), close_button);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
173 gtk_container_add(GTK_CONTAINER(bbox), action_button);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
174
2420
b23f52fe132f [svn] Removed util.* from libaudacious
mf0102
parents: 2417
diff changeset
175 /* this storage object holds several other objects which are used in the
b23f52fe132f [svn] Removed util.* from libaudacious
mf0102
parents: 2417
diff changeset
176 * callback functions
b23f52fe132f [svn] Removed util.* from libaudacious
mf0102
parents: 2417
diff changeset
177 */
2658
4b8db8c0521d [svn] - fixed c++ish declaration in a c file (part 5)
giacomo
parents: 2500
diff changeset
178 storage = g_object_new(G_TYPE_OBJECT, NULL);
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
179 g_object_set_data(storage, "window", window);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
180 g_object_set_data(storage, "chooser", chooser);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
181 g_object_set_data(storage, "toggle-button", toggle);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
182 g_object_set_data(storage, "play-button", GINT_TO_POINTER(play_button));
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
183
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
184 g_signal_connect(chooser, "file-activated",
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
185 G_CALLBACK(action_button_cb), storage);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
186 g_signal_connect(action_button, "clicked",
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
187 G_CALLBACK(action_button_cb), storage);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
188 g_signal_connect(close_button, "clicked",
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
189 G_CALLBACK(close_button_cb), window);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
190 g_signal_connect(window, "destroy",
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
191 G_CALLBACK(gtk_widget_destroyed), &window);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
192
2432
4a1d1c324685 [svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents: 2422
diff changeset
193 g_signal_connect(window, "key_press_event",
4784
68f38592d757 pre-codechange indentation
mf0102 <0102@gmx.at>
parents: 4716
diff changeset
194 G_CALLBACK(filebrowser_on_keypress),
68f38592d757 pre-codechange indentation
mf0102 <0102@gmx.at>
parents: 4716
diff changeset
195 NULL);
2432
4a1d1c324685 [svn] - restore shortcut key (esc) to close gtk2 fileopener.
yaz
parents: 2422
diff changeset
196
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
197 gtk_widget_show_all(window);
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
198 }
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
199
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
200 /*
4785
427c607c1568 more cleanup
mf0102 <0102@gmx.at>
parents: 4784
diff changeset
201 * run_filebrowser(gboolean play_button)
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
202 *
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
203 * Inputs:
4595
d69b2bcea170 NO_PLAY_BUTTON and PLAY_BUTTON defines don't quite make sense
Tomasz Mon <desowin@gmail.com>
parents: 3917
diff changeset
204 * - gboolean play_button
d69b2bcea170 NO_PLAY_BUTTON and PLAY_BUTTON defines don't quite make sense
Tomasz Mon <desowin@gmail.com>
parents: 3917
diff changeset
205 * TRUE - open files
d69b2bcea170 NO_PLAY_BUTTON and PLAY_BUTTON defines don't quite make sense
Tomasz Mon <desowin@gmail.com>
parents: 3917
diff changeset
206 * FALSE - add files
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
207 *
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
208 * Outputs:
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
209 * - none
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
210 */
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
211 void
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
212 run_filebrowser(gboolean play_button)
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
213 {
4787
f04094af8d57 remove XMMS-style fileopener
mf0102 <0102@gmx.at>
parents: 4786
diff changeset
214 run_filebrowser_gtk2style(play_button, TRUE);
2417
ea17b8ee57d8 [svn] oops, forgot to add the fileopener files
mf0102
parents:
diff changeset
215 }
3917
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3647
diff changeset
216
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3647
diff changeset
217 void
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3647
diff changeset
218 hide_filebrowser(void)
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3647
diff changeset
219 {
4787
f04094af8d57 remove XMMS-style fileopener
mf0102 <0102@gmx.at>
parents: 4786
diff changeset
220 run_filebrowser_gtk2style(FALSE, FALSE);
3917
b5ee3a4a8e3b libaudclient:
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 3647
diff changeset
221 }