comparison src/arts/configure.c @ 12:3da1b8942b8b trunk

[svn] - remove src/Input src/Output src/Effect src/General src/Visualization src/Container
author nenolod
date Mon, 18 Sep 2006 03:14:20 -0700
parents src/Output/arts/configure.c@13389e613d67
children a9a97179a1f9
comparison
equal deleted inserted replaced
11:cff1d04026ae 12:3da1b8942b8b
1 /*
2 * aRts ouput plugin for xmms
3 *
4 * Copyright (C) 2000,2003 Haavard Kvaalen <havardk@xmms.org>
5 *
6 * Licenced under GNU GPL version 2.
7 *
8 * Audacious port by Giacomo Lozito from develia.org
9 *
10 */
11
12 #include "arts.h"
13 #define _(string) (string)
14
15 #include <gtk/gtk.h>
16
17 static GtkWidget *configure_win = NULL;
18 static GtkWidget *buffer_size_spin;
19
20 static void configure_win_ok_cb(GtkWidget * w, gpointer data)
21 {
22 ConfigDb *db;
23
24 artsxmms_cfg.buffer_size =
25 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(buffer_size_spin));
26
27 db = bmp_cfg_db_open();
28 bmp_cfg_db_set_int(db, "arts", "buffer_size", artsxmms_cfg.buffer_size);
29 bmp_cfg_db_close(db);
30
31 gtk_widget_destroy(configure_win);
32 }
33
34
35 void artsxmms_configure(void)
36 {
37 GtkWidget *vbox, *notebook;
38 GtkWidget *buffer_frame, *buffer_vbox, *buffer_table;
39 GtkWidget *buffer_size_box, *buffer_size_label;
40 GtkWidget *bbox, *ok, *cancel;
41
42 GtkObject *buffer_size_adj;
43
44 if (configure_win)
45 return;
46
47 configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
48 gtk_window_set_type_hint( GTK_WINDOW(configure_win), GDK_WINDOW_TYPE_HINT_DIALOG );
49 gtk_signal_connect(GTK_OBJECT(configure_win), "destroy",
50 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &configure_win);
51 gtk_window_set_title(GTK_WINDOW(configure_win), _("aRts Driver configuration"));
52 gtk_window_set_policy(GTK_WINDOW(configure_win), FALSE, FALSE, FALSE);
53 gtk_window_set_position(GTK_WINDOW(configure_win), GTK_WIN_POS_MOUSE);
54 gtk_container_border_width(GTK_CONTAINER(configure_win), 10);
55
56 vbox = gtk_vbox_new(FALSE, 10);
57 gtk_container_add(GTK_CONTAINER(configure_win), vbox);
58
59 notebook = gtk_notebook_new();
60 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
61
62 buffer_frame = gtk_frame_new(_("Buffering:"));
63 gtk_container_set_border_width(GTK_CONTAINER(buffer_frame), 5);
64
65 buffer_vbox = gtk_vbox_new(FALSE, 0);
66 gtk_container_add(GTK_CONTAINER(buffer_frame), buffer_vbox);
67
68 buffer_table = gtk_table_new(2, 1, TRUE);
69 gtk_container_set_border_width(GTK_CONTAINER(buffer_table), 5);
70 gtk_box_pack_start(GTK_BOX(buffer_vbox), buffer_table, FALSE, FALSE, 0);
71
72 buffer_size_box = gtk_hbox_new(FALSE, 5);
73 gtk_table_attach_defaults(GTK_TABLE(buffer_table), buffer_size_box, 0, 1, 0, 1);
74 buffer_size_label = gtk_label_new(_("Buffer size (ms):"));
75 gtk_box_pack_start(GTK_BOX(buffer_size_box), buffer_size_label, FALSE, FALSE, 0);
76 gtk_widget_show(buffer_size_label);
77 buffer_size_adj = gtk_adjustment_new(artsxmms_cfg.buffer_size,
78 200, 10000, 100, 100, 100);
79 buffer_size_spin = gtk_spin_button_new(GTK_ADJUSTMENT(buffer_size_adj), 8, 0);
80 gtk_widget_set_usize(buffer_size_spin, 60, -1);
81 gtk_box_pack_start(GTK_BOX(buffer_size_box), buffer_size_spin, FALSE, FALSE, 0);
82
83 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), buffer_frame,
84 gtk_label_new(_("Buffering")));
85
86 bbox = gtk_hbutton_box_new();
87 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
88 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
89 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
90
91 ok = gtk_button_new_with_label(_("Ok"));
92 cancel = gtk_button_new_with_label(_("Cancel"));
93 GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
94 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
95 gtk_signal_connect(GTK_OBJECT(ok), "clicked",
96 GTK_SIGNAL_FUNC(configure_win_ok_cb), NULL);
97 gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked",
98 GTK_SIGNAL_FUNC(gtk_widget_destroy),
99 GTK_OBJECT(configure_win));
100 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0);
101 gtk_widget_grab_default(ok);
102 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
103
104 gtk_widget_show_all(configure_win);
105 }