0
|
1 /* XMMS - ALSA output plugin
|
|
2 * Copyright (C) 2001-2003 Matthieu Sozeau <mattam@altern.org>
|
|
3 * Copyright (C) 2003-2004 Haavard Kvaalen
|
|
4 *
|
|
5 * This program is free software; you can redistribute it and/or modify
|
|
6 * it under the terms of the GNU General Public License as published by
|
|
7 * the Free Software Foundation; either version 2 of the License, or
|
|
8 * (at your option) any later version.
|
|
9 *
|
|
10 * This program is distributed in the hope that it will be useful,
|
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 * GNU General Public License for more details.
|
|
14 *
|
|
15 * You should have received a copy of the GNU General Public License
|
|
16 * along with this program; if not, write to the Free Software
|
|
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
18 */
|
|
19 #include "alsa.h"
|
|
20 #include <stdio.h>
|
|
21 #include <libaudacious/configdb.h>
|
|
22 #include <glib/gi18n.h>
|
|
23
|
|
24
|
|
25 static GtkWidget *configure_win = NULL;
|
|
26 static GtkWidget *buffer_time_spin, *period_time_spin;
|
|
27 static GtkWidget *mmap_button, *softvolume_toggle_button;
|
|
28
|
|
29 static GtkWidget *thread_buffer_time_spin;
|
|
30 static GtkWidget *mthread_button;
|
|
31
|
|
32
|
|
33 static GtkWidget *devices_combo, *mixer_devices_combo;
|
|
34
|
|
35 static int current_mixer_card;
|
|
36
|
|
37 #define GET_SPIN_INT(spin) \
|
|
38 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin))
|
|
39 #define GET_TOGGLE(tb) gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(tb))
|
|
40 #define GET_CHARS(edit) gtk_editable_get_chars(GTK_EDITABLE(edit), 0, -1)
|
|
41
|
|
42 static void
|
|
43 configure_win_ok_cb(GtkWidget * w, gpointer data)
|
|
44 {
|
|
45 g_free(alsa_cfg.pcm_device);
|
|
46 alsa_cfg.pcm_device = GET_CHARS(GTK_COMBO(devices_combo)->entry);
|
|
47 alsa_cfg.buffer_time = GET_SPIN_INT(buffer_time_spin);
|
|
48 alsa_cfg.period_time = GET_SPIN_INT(period_time_spin);
|
|
49 alsa_cfg.thread_buffer_time = GET_SPIN_INT(thread_buffer_time_spin);
|
|
50 alsa_cfg.multi_thread = GET_TOGGLE(mthread_button);
|
|
51 alsa_cfg.mmap = GET_TOGGLE(mmap_button);
|
|
52 alsa_cfg.soft_volume = GET_TOGGLE(softvolume_toggle_button);
|
|
53 alsa_cfg.mixer_card = current_mixer_card;
|
|
54 alsa_cfg.mixer_device = GET_CHARS(GTK_COMBO(mixer_devices_combo)->entry);
|
|
55
|
|
56 alsa_save_config();
|
|
57 gtk_widget_destroy(configure_win);
|
|
58 }
|
|
59
|
|
60 void
|
|
61 alsa_save_config(void)
|
|
62 {
|
|
63 //ConfigFile *cfgfile = xmms_cfg_open_default_file();
|
|
64 ConfigDb *cfgfile;
|
|
65
|
|
66 cfgfile = bmp_cfg_db_open();
|
|
67 bmp_cfg_db_set_int(cfgfile, "ALSA", "buffer_time", alsa_cfg.buffer_time);
|
|
68 bmp_cfg_db_set_int(cfgfile, "ALSA", "thread_buffer_time", alsa_cfg.thread_buffer_time);
|
|
69 bmp_cfg_db_set_int(cfgfile, "ALSA", "period_time", alsa_cfg.period_time);
|
|
70 bmp_cfg_db_set_bool(cfgfile, "ALSA", "multi_thread", alsa_cfg.multi_thread);
|
|
71 bmp_cfg_db_set_bool(cfgfile, "ALSA", "mmap", alsa_cfg.mmap);
|
|
72 bmp_cfg_db_set_string(cfgfile, "ALSA", "pcm_device", alsa_cfg.pcm_device);
|
|
73 bmp_cfg_db_set_int(cfgfile, "ALSA", "mixer_card", alsa_cfg.mixer_card);
|
|
74 bmp_cfg_db_set_string(cfgfile, "ALSA", "mixer_device",
|
|
75 alsa_cfg.mixer_device);
|
|
76 bmp_cfg_db_set_bool(cfgfile, "ALSA", "soft_volume", alsa_cfg.soft_volume);
|
|
77 bmp_cfg_db_set_int(cfgfile, "ALSA", "volume_left", alsa_cfg.vol.left);
|
|
78 bmp_cfg_db_set_int(cfgfile, "ALSA", "volume_right", alsa_cfg.vol.right);
|
|
79 // bmp_cfg_db_set_default_file(cfgfile);
|
|
80 // xmms_cfg_free(cfgfile);
|
|
81 bmp_cfg_db_close(cfgfile);
|
|
82 }
|
|
83
|
|
84 static int
|
|
85 get_cards(GtkOptionMenu * omenu, GCallback cb, int active)
|
|
86 {
|
|
87 GtkWidget *menu, *item;
|
|
88 int card = -1, err, set = 0, curr = -1;
|
|
89
|
|
90 menu = gtk_menu_new();
|
|
91 if ((err = snd_card_next(&card)) != 0)
|
|
92 g_warning("snd_next_card() failed: %s", snd_strerror(-err));
|
|
93
|
|
94 while (card > -1) {
|
|
95 char *label;
|
|
96
|
|
97 curr++;
|
|
98 if (card == active)
|
|
99 set = curr;
|
|
100 if ((err = snd_card_get_name(card, &label)) != 0) {
|
|
101 g_warning("snd_carg_get_name() failed: %s", snd_strerror(-err));
|
|
102 break;
|
|
103 }
|
|
104
|
|
105 item = gtk_menu_item_new_with_label(label);
|
|
106 g_signal_connect(item, "activate", G_CALLBACK(cb),
|
|
107 GINT_TO_POINTER(card));
|
|
108 gtk_widget_show(item);
|
|
109 gtk_menu_append(GTK_MENU(menu), item);
|
|
110 if ((err = snd_card_next(&card)) != 0) {
|
|
111 g_warning("snd_next_card() failed: %s", snd_strerror(-err));
|
|
112 break;
|
|
113 }
|
|
114 }
|
|
115
|
|
116 gtk_option_menu_set_menu(omenu, menu);
|
|
117 return set;
|
|
118 }
|
|
119
|
|
120 static int
|
|
121 get_mixer_devices(GtkCombo * combo, int card)
|
|
122 {
|
|
123 GList *items = NULL;
|
|
124 int err;
|
|
125 snd_mixer_t *mixer;
|
|
126 snd_mixer_elem_t *current;
|
|
127
|
|
128 if ((err = alsa_get_mixer(&mixer, card)) < 0)
|
|
129 return err;
|
|
130
|
|
131 current = snd_mixer_first_elem(mixer);
|
|
132
|
|
133 while (current) {
|
|
134 const char *sname = snd_mixer_selem_get_name(current);
|
|
135 if (snd_mixer_selem_is_active(current) &&
|
|
136 snd_mixer_selem_has_playback_volume(current))
|
|
137 items = g_list_append(items, g_strdup(sname));
|
|
138 current = snd_mixer_elem_next(current);
|
|
139 }
|
|
140
|
|
141 gtk_combo_set_popdown_strings(combo, items);
|
|
142
|
|
143 return 0;
|
|
144 }
|
|
145
|
|
146 static void
|
|
147 get_devices_for_card(GtkCombo * combo, int card)
|
|
148 {
|
|
149 GtkWidget *item;
|
|
150 int pcm_device = -1, err;
|
|
151 snd_pcm_info_t *pcm_info;
|
|
152 snd_ctl_t *ctl;
|
|
153 char dev[64], *card_name;
|
|
154
|
|
155 sprintf(dev, "hw:%i", card);
|
|
156
|
|
157 if ((err = snd_ctl_open(&ctl, dev, 0)) < 0) {
|
|
158 printf("snd_ctl_open() failed: %s", snd_strerror(-err));
|
|
159 return;
|
|
160 }
|
|
161
|
|
162 if ((err = snd_card_get_name(card, &card_name)) != 0) {
|
|
163 g_warning("snd_card_get_name() failed: %s", snd_strerror(-err));
|
|
164 card_name = _("Unknown soundcard");
|
|
165 }
|
|
166
|
|
167 snd_pcm_info_alloca(&pcm_info);
|
|
168
|
|
169 for (;;) {
|
|
170 char *device, *descr;
|
|
171 if ((err = snd_ctl_pcm_next_device(ctl, &pcm_device)) < 0) {
|
|
172 g_warning("snd_ctl_pcm_next_device() failed: %s",
|
|
173 snd_strerror(-err));
|
|
174 pcm_device = -1;
|
|
175 }
|
|
176 if (pcm_device < 0)
|
|
177 break;
|
|
178
|
|
179 snd_pcm_info_set_device(pcm_info, pcm_device);
|
|
180 snd_pcm_info_set_subdevice(pcm_info, 0);
|
|
181 snd_pcm_info_set_stream(pcm_info, SND_PCM_STREAM_PLAYBACK);
|
|
182
|
|
183 if ((err = snd_ctl_pcm_info(ctl, pcm_info)) < 0) {
|
|
184 if (err != -ENOENT)
|
|
185 g_warning("get_devices_for_card(): "
|
|
186 "snd_ctl_pcm_info() "
|
|
187 "failed (%d:%d): %s.", card,
|
|
188 pcm_device, snd_strerror(-err));
|
|
189 continue;
|
|
190 }
|
|
191
|
|
192 device = g_strdup_printf("hw:%d,%d", card, pcm_device);
|
|
193 descr = g_strconcat(card_name, ": ",
|
|
194 snd_pcm_info_get_name(pcm_info),
|
|
195 " (", device, ")", NULL);
|
|
196 item = gtk_list_item_new_with_label(descr);
|
|
197 gtk_widget_show(item);
|
|
198 g_free(descr);
|
|
199 gtk_combo_set_item_string(combo, GTK_ITEM(item), device);
|
|
200 g_free(device);
|
|
201 gtk_container_add(GTK_CONTAINER(combo->list), item);
|
|
202 }
|
|
203
|
|
204 snd_ctl_close(ctl);
|
|
205 }
|
|
206
|
|
207
|
|
208
|
|
209 static void
|
|
210 get_devices(GtkCombo * combo)
|
|
211 {
|
|
212 GtkWidget *item;
|
|
213 int card = -1;
|
|
214 int err = 0;
|
|
215 char *descr;
|
|
216
|
|
217 descr = g_strdup_printf(_("Default PCM device (%s)"), "default");
|
|
218 item = gtk_list_item_new_with_label(descr);
|
|
219 gtk_widget_show(item);
|
|
220 g_free(descr);
|
|
221 gtk_combo_set_item_string(combo, GTK_ITEM(item), "default");
|
|
222 gtk_container_add(GTK_CONTAINER(combo->list), item);
|
|
223
|
|
224 if ((err = snd_card_next(&card)) != 0) {
|
|
225 g_warning("snd_next_card() failed: %s", snd_strerror(-err));
|
|
226 return;
|
|
227 }
|
|
228
|
|
229 while (card > -1) {
|
|
230 get_devices_for_card(combo, card);
|
|
231 if ((err = snd_card_next(&card)) != 0) {
|
|
232 g_warning("snd_next_card() failed: %s", snd_strerror(-err));
|
|
233 break;
|
|
234 }
|
|
235 }
|
|
236 }
|
|
237
|
|
238 static void
|
|
239 mixer_card_cb(GtkWidget * widget, gpointer card)
|
|
240 {
|
|
241 if (current_mixer_card == GPOINTER_TO_INT(card))
|
|
242 return;
|
|
243 current_mixer_card = GPOINTER_TO_INT(card);
|
|
244 get_mixer_devices(GTK_COMBO(mixer_devices_combo), current_mixer_card);
|
|
245 }
|
|
246
|
|
247 static void
|
|
248 softvolume_toggle_cb(GtkToggleButton * widget, gpointer data)
|
|
249 {
|
|
250 gboolean softvolume = gtk_toggle_button_get_active(widget);
|
|
251 gtk_widget_set_sensitive(GTK_WIDGET(data), !softvolume);
|
|
252 gtk_widget_set_sensitive(mixer_devices_combo, !softvolume);
|
|
253 }
|
|
254
|
|
255 void
|
|
256 alsa_configure(void)
|
|
257 {
|
|
258 GtkWidget *vbox, *notebook;
|
|
259 GtkWidget *dev_vbox, *adevice_frame, *adevice_box;
|
|
260 GtkWidget *mixer_frame, *mixer_box, *mixer_table, *mixer_card_om;
|
|
261 GtkWidget *mixer_card_label, *mixer_device_label;
|
|
262 GtkWidget *buffer_frame, *buffer_vbox, *buffer_table;
|
|
263 GtkWidget *buffer_time_label, *period_time_label;
|
|
264 GtkObject *buffer_time_adj, *period_time_adj;
|
|
265 GtkWidget *bbox, *ok, *cancel;
|
|
266 GtkWidget *thread_buffer_time_label;
|
|
267 GtkObject *thread_buffer_time_adj;
|
|
268
|
|
269 int mset;
|
|
270
|
|
271 if (configure_win) {
|
|
272 gtk_window_present(GTK_WINDOW(configure_win));
|
|
273 return;
|
|
274 }
|
|
275
|
|
276 configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
|
277 g_signal_connect(configure_win, "destroy",
|
|
278 G_CALLBACK(gtk_widget_destroyed), &configure_win);
|
|
279 gtk_window_set_title(GTK_WINDOW(configure_win),
|
|
280 _("ALSA Driver configuration"));
|
|
281 gtk_window_set_type_hint(GTK_WINDOW(configure_win),
|
|
282 GDK_WINDOW_TYPE_HINT_DIALOG);
|
|
283 gtk_window_set_resizable(GTK_WINDOW(configure_win), FALSE);
|
|
284 gtk_container_border_width(GTK_CONTAINER(configure_win), 10);
|
|
285
|
|
286 vbox = gtk_vbox_new(FALSE, 10);
|
|
287 gtk_container_add(GTK_CONTAINER(configure_win), vbox);
|
|
288
|
|
289 notebook = gtk_notebook_new();
|
|
290 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
|
|
291
|
|
292 dev_vbox = gtk_vbox_new(FALSE, 5);
|
|
293 gtk_container_set_border_width(GTK_CONTAINER(dev_vbox), 5);
|
|
294
|
|
295 adevice_frame = gtk_frame_new(_("Audio device:"));
|
|
296 gtk_box_pack_start(GTK_BOX(dev_vbox), adevice_frame, FALSE, FALSE, 0);
|
|
297
|
|
298 adevice_box = gtk_vbox_new(FALSE, 5);
|
|
299 gtk_container_set_border_width(GTK_CONTAINER(adevice_box), 5);
|
|
300 gtk_container_add(GTK_CONTAINER(adevice_frame), adevice_box);
|
|
301
|
|
302 devices_combo = gtk_combo_new();
|
|
303 gtk_box_pack_start(GTK_BOX(adevice_box), devices_combo, FALSE, FALSE, 0);
|
|
304 get_devices(GTK_COMBO(devices_combo));
|
|
305 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(devices_combo)->entry),
|
|
306 alsa_cfg.pcm_device);
|
|
307
|
|
308 mixer_frame = gtk_frame_new(_("Mixer:"));
|
|
309 gtk_box_pack_start(GTK_BOX(dev_vbox), mixer_frame, FALSE, FALSE, 0);
|
|
310
|
|
311 mixer_box = gtk_vbox_new(FALSE, 5);
|
|
312 gtk_container_set_border_width(GTK_CONTAINER(mixer_box), 5);
|
|
313 gtk_container_add(GTK_CONTAINER(mixer_frame), mixer_box);
|
|
314
|
|
315 softvolume_toggle_button =
|
|
316 gtk_check_button_new_with_label(_("Use software volume control"));
|
|
317
|
|
318 gtk_box_pack_start(GTK_BOX(mixer_box), softvolume_toggle_button,
|
|
319 FALSE, FALSE, 0);
|
|
320
|
|
321 mixer_table = gtk_table_new(2, 2, FALSE);
|
|
322 gtk_table_set_row_spacings(GTK_TABLE(mixer_table), 5);
|
|
323 gtk_table_set_col_spacings(GTK_TABLE(mixer_table), 5);
|
|
324 gtk_box_pack_start(GTK_BOX(mixer_box), mixer_table, FALSE, FALSE, 0);
|
|
325
|
|
326 mixer_card_label = gtk_label_new(_("Mixer card:"));
|
|
327 gtk_label_set_justify(GTK_LABEL(mixer_card_label), GTK_JUSTIFY_LEFT);
|
|
328 gtk_misc_set_alignment(GTK_MISC(mixer_card_label), 0, 0.5);
|
|
329 gtk_table_attach(GTK_TABLE(mixer_table), mixer_card_label,
|
|
330 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
|
|
331
|
|
332 mixer_card_om = gtk_option_menu_new();
|
|
333 mset = get_cards(GTK_OPTION_MENU(mixer_card_om),
|
|
334 G_CALLBACK(mixer_card_cb), alsa_cfg.mixer_card);
|
|
335
|
|
336 gtk_table_attach(GTK_TABLE(mixer_table), mixer_card_om,
|
|
337 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
|
|
338
|
|
339 mixer_device_label = gtk_label_new(_("Mixer device:"));
|
|
340 gtk_label_set_justify(GTK_LABEL(mixer_device_label), GTK_JUSTIFY_LEFT);
|
|
341 gtk_misc_set_alignment(GTK_MISC(mixer_device_label), 0, 0.5);
|
|
342 gtk_table_attach(GTK_TABLE(mixer_table), mixer_device_label,
|
|
343 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
|
|
344 mixer_devices_combo = gtk_combo_new();
|
|
345 gtk_option_menu_set_history(GTK_OPTION_MENU(mixer_card_om), mset);
|
|
346 get_mixer_devices(GTK_COMBO(mixer_devices_combo), alsa_cfg.mixer_card);
|
|
347 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(mixer_devices_combo)->entry),
|
|
348 alsa_cfg.mixer_device);
|
|
349
|
|
350 gtk_table_attach(GTK_TABLE(mixer_table), mixer_devices_combo,
|
|
351 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0);
|
|
352
|
|
353 g_signal_connect(softvolume_toggle_button, "toggled",
|
|
354 G_CALLBACK(softvolume_toggle_cb), mixer_card_om);
|
|
355 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(softvolume_toggle_button),
|
|
356 alsa_cfg.soft_volume);
|
|
357
|
|
358 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), dev_vbox,
|
|
359 gtk_label_new(_("Device settings")));
|
|
360
|
|
361 buffer_frame = gtk_frame_new(_("Advanced settings:"));
|
|
362 gtk_container_set_border_width(GTK_CONTAINER(buffer_frame), 5);
|
|
363
|
|
364 buffer_vbox = gtk_vbox_new(FALSE, 0);
|
|
365 gtk_container_add(GTK_CONTAINER(buffer_frame), buffer_vbox);
|
|
366
|
|
367 gtk_container_set_border_width(GTK_CONTAINER(buffer_vbox), 5);
|
|
368
|
|
369 buffer_table = gtk_table_new(2, 3, FALSE);
|
|
370 gtk_table_set_row_spacings(GTK_TABLE(buffer_table), 5);
|
|
371 gtk_table_set_col_spacings(GTK_TABLE(buffer_table), 5);
|
|
372 gtk_box_pack_start(GTK_BOX(buffer_vbox), buffer_table, FALSE, FALSE, 0);
|
|
373
|
|
374 buffer_time_label = gtk_label_new(_("Buffer time (ms):"));
|
|
375 gtk_label_set_justify(GTK_LABEL(buffer_time_label), GTK_JUSTIFY_LEFT);
|
|
376 gtk_misc_set_alignment(GTK_MISC(buffer_time_label), 0, 0.5);
|
|
377 gtk_table_attach(GTK_TABLE(buffer_table), buffer_time_label,
|
|
378 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
|
|
379
|
|
380 buffer_time_adj = gtk_adjustment_new(alsa_cfg.buffer_time,
|
|
381 200, 1000000, 100, 100, 100);
|
|
382 buffer_time_spin = gtk_spin_button_new(GTK_ADJUSTMENT(buffer_time_adj),
|
|
383 8, 0);
|
|
384 gtk_widget_set_usize(buffer_time_spin, 60, -1);
|
|
385 gtk_table_attach(GTK_TABLE(buffer_table), buffer_time_spin,
|
|
386 1, 2, 0, 1, 0, 0, 0, 0);
|
|
387
|
|
388 period_time_label = gtk_label_new(_("Period time (ms):"));
|
|
389 gtk_label_set_justify(GTK_LABEL(period_time_label), GTK_JUSTIFY_LEFT);
|
|
390 gtk_misc_set_alignment(GTK_MISC(period_time_label), 0, 0.5);
|
|
391 gtk_table_attach(GTK_TABLE(buffer_table), period_time_label,
|
|
392 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
|
|
393 period_time_adj = gtk_adjustment_new(alsa_cfg.period_time,
|
|
394 1, 500, 1, 100, 100);
|
|
395 period_time_spin = gtk_spin_button_new(GTK_ADJUSTMENT(period_time_adj),
|
|
396 8, 0);
|
|
397
|
|
398 gtk_widget_set_usize(period_time_spin, 60, -1);
|
|
399 gtk_table_attach(GTK_TABLE(buffer_table), period_time_spin,
|
|
400 1, 2, 1, 2, 0, 0, 0, 0);
|
|
401
|
|
402 thread_buffer_time_label = gtk_label_new(_("Thread buffer time (ms):"));
|
|
403 gtk_label_set_justify(GTK_LABEL(thread_buffer_time_label), GTK_JUSTIFY_LEFT);
|
|
404 gtk_misc_set_alignment(GTK_MISC(thread_buffer_time_label), 0, 0.5);
|
|
405 gtk_table_attach(GTK_TABLE(buffer_table), thread_buffer_time_label,
|
|
406 0, 1, 2, 3, GTK_FILL, 0, 0, 0);
|
|
407 thread_buffer_time_adj = gtk_adjustment_new(alsa_cfg.thread_buffer_time,
|
|
408 1000, 1000000, 100, 100, 100);
|
|
409 thread_buffer_time_spin = gtk_spin_button_new(GTK_ADJUSTMENT(thread_buffer_time_adj),
|
|
410 8, 0);
|
|
411
|
|
412 gtk_widget_set_usize(thread_buffer_time_spin, 60, -1);
|
|
413 gtk_table_attach(GTK_TABLE(buffer_table), thread_buffer_time_spin,
|
|
414 1, 2, 2, 3, 0, 0, 0, 0);
|
|
415
|
|
416 mthread_button = gtk_check_button_new_with_label(_("Multi-thread mode"));
|
|
417 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mthread_button),
|
|
418 alsa_cfg.multi_thread);
|
|
419 gtk_box_pack_start(GTK_BOX(buffer_vbox), mthread_button, FALSE, FALSE, 0);
|
|
420
|
|
421 mmap_button = gtk_check_button_new_with_label(_("Mmap mode"));
|
|
422 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mmap_button),
|
|
423 alsa_cfg.mmap);
|
|
424 gtk_box_pack_start(GTK_BOX(buffer_vbox), mmap_button, FALSE, FALSE, 0);
|
|
425
|
|
426 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), buffer_frame,
|
|
427 gtk_label_new(_("Advanced settings")));
|
|
428
|
|
429 bbox = gtk_hbutton_box_new();
|
|
430 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
|
|
431 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
|
|
432 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
|
|
433
|
|
434 cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
|
|
435 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
|
|
436
|
|
437 ok = gtk_button_new_from_stock(GTK_STOCK_OK);
|
|
438 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0);
|
|
439
|
|
440 g_signal_connect(ok, "clicked", G_CALLBACK(configure_win_ok_cb), NULL);
|
|
441 GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
|
|
442 gtk_widget_grab_default(ok);
|
|
443
|
|
444 g_signal_connect_swapped(cancel, "clicked",
|
|
445 G_CALLBACK(gtk_widget_destroy),
|
|
446 configure_win);
|
|
447 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
|
|
448
|
|
449
|
|
450
|
|
451 gtk_widget_show_all(configure_win);
|
|
452 }
|