annotate src/cdaudio-ng/configure.c @ 1303:2a7c9e0b9c0f

Added configure options for cddb
author zither@litestep.network
date Fri, 20 Jul 2007 03:29:42 +0300
parents 483b8d900d5e
children 83cbc6968a0b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1189
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
1
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
2 #include <stdio.h>
1303
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
3 #include <stdlib.h>
1189
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
4 #include <string.h>
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
5 #include <gtk/gtk.h>
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
6
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
7 #include "configure.h"
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
8
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
9
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
10 static GtkWidget *configwindow;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
11 static GtkWidget *okbutton;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
12 static GtkWidget *cancelbutton;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
13 static GtkWidget *maintable;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
14 static GtkWidget *daeframe;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
15 static GtkWidget *titleinfoframe;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
16 static GtkWidget *miscframe;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
17 static GtkWidget *daetable;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
18 static GtkWidget *titleinfotable;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
19 static GtkWidget *misctable;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
20 static GtkWidget *usedaecheckbutton;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
21 static GtkWidget *limitcheckbutton;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
22 static GtkWidget *usecdtextcheckbutton;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
23 static GtkWidget *usecddbcheckbutton;
1303
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
24 static GtkWidget *cddbserverlabel;
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
25 static GtkWidget *cddbportlabel;
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
26 static GtkWidget *cddbserverentry;
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
27 static GtkWidget *cddbportentry;
1189
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
28 static GtkWidget *usedevicecheckbutton;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
29 static GtkWidget *buttonbox;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
30 static GtkWidget *limitspinbutton;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
31 static GtkWidget *deviceentry;
1193
483b8d900d5e Added enable/disable debug option
calin.crisan@ldev-006
parents: 1189
diff changeset
32 static GtkWidget *debugcheckbutton;
1189
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
33
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
34 static gboolean *usedae;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
35 static int *limitspeed;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
36 static gboolean *usecdtext;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
37 static gboolean *usecddb;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
38 static char *device;
1193
483b8d900d5e Added enable/disable debug option
calin.crisan@ldev-006
parents: 1189
diff changeset
39 static gboolean *debug;
1303
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
40 static char *cddbserver;
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
41 static int *cddbport;
1189
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
42
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
43 static gboolean delete_window(GtkWidget *widget, GdkEvent *event, gpointer data);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
44 static void button_clicked(GtkWidget *widget, gpointer data);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
45 static void checkbutton_toggled(GtkWidget *widget, gpointer data);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
46 static void values_to_gui();
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
47 static void gui_to_values();
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
48
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
49
1303
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
50 void configure_set_variables(gboolean *_usedae, int *_limitspeed, gboolean *_usecdtext, gboolean *_usecddb, char *_device, gboolean *_debug, char *_cddbserver, int *_cddbport)
1189
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
51 {
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
52 usedae = _usedae;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
53 limitspeed = _limitspeed;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
54 usecdtext = _usecdtext;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
55 usecddb = _usecddb;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
56 device = _device;
1193
483b8d900d5e Added enable/disable debug option
calin.crisan@ldev-006
parents: 1189
diff changeset
57 debug = _debug;
1303
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
58 cddbserver = _cddbserver;
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
59 cddbport = _cddbport;
1189
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
60 }
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
61
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
62 void configure_create_gui()
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
63 {
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
64 configwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
65 gtk_window_set_title(GTK_WINDOW(configwindow), "CD Audio Plugin Configuration");
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
66 gtk_window_set_resizable(GTK_WINDOW(configwindow), FALSE);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
67 gtk_window_set_position(GTK_WINDOW(configwindow), GTK_WIN_POS_CENTER_ALWAYS);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
68 gtk_container_set_border_width(GTK_CONTAINER(configwindow), 10);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
69 g_signal_connect(G_OBJECT(configwindow), "delete_event", G_CALLBACK(delete_window), NULL);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
70
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
71 maintable = gtk_table_new(4, 2, TRUE);
1303
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
72 gtk_table_set_homogeneous(GTK_TABLE(maintable), FALSE);
1189
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
73 gtk_container_add(GTK_CONTAINER(configwindow), maintable);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
74
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
75 daeframe = gtk_frame_new("Digital audio extraction");
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
76 gtk_table_attach_defaults(GTK_TABLE(maintable), daeframe, 0, 2, 0, 1);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
77 daetable = gtk_table_new(2, 2, TRUE);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
78 gtk_container_add(GTK_CONTAINER(daeframe), daetable);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
79
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
80 titleinfoframe = gtk_frame_new("Title information");
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
81 gtk_table_attach_defaults(GTK_TABLE(maintable), titleinfoframe, 0, 2, 1, 2);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
82 titleinfotable = gtk_table_new(2, 2, TRUE);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
83 gtk_container_add(GTK_CONTAINER(titleinfoframe), titleinfotable);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
84
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
85 miscframe = gtk_frame_new("Misc");
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
86 gtk_table_attach_defaults(GTK_TABLE(maintable), miscframe, 0, 2, 2, 3);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
87 misctable = gtk_table_new(2, 2, TRUE);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
88 gtk_container_add(GTK_CONTAINER(miscframe), misctable);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
89
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
90
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
91 usedaecheckbutton = gtk_check_button_new_with_label("Use digital audio extraction");
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
92 g_signal_connect(G_OBJECT(usedaecheckbutton), "toggled", G_CALLBACK(checkbutton_toggled), NULL);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
93 gtk_table_attach_defaults(GTK_TABLE(daetable), usedaecheckbutton, 0, 2, 0, 1);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
94
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
95 limitcheckbutton = gtk_check_button_new_with_label("Limit read speed to: ");
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
96 g_signal_connect(G_OBJECT(limitcheckbutton), "toggled", G_CALLBACK(checkbutton_toggled), NULL);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
97 gtk_table_attach_defaults(GTK_TABLE(daetable), limitcheckbutton, 0, 1, 1, 2);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
98
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
99 limitspinbutton = gtk_spin_button_new_with_range(1.0, 24.0, 1.0);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
100 gtk_table_attach_defaults(GTK_TABLE(daetable), limitspinbutton, 1, 2, 1, 2);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
101
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
102 usecdtextcheckbutton = gtk_check_button_new_with_label("Use cd-text if available");
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
103 g_signal_connect(G_OBJECT(usecdtextcheckbutton), "toggled", G_CALLBACK(checkbutton_toggled), NULL);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
104 gtk_table_attach_defaults(GTK_TABLE(titleinfotable), usecdtextcheckbutton, 0, 2, 0, 1);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
105
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
106 usecddbcheckbutton = gtk_check_button_new_with_label("Use CDDB if available");
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
107 g_signal_connect(G_OBJECT(usecddbcheckbutton), "toggled", G_CALLBACK(checkbutton_toggled), NULL);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
108 gtk_table_attach_defaults(GTK_TABLE(titleinfotable), usecddbcheckbutton, 0, 2, 1, 2);
1303
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
109
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
110 cddbserverlabel = gtk_label_new("Server: ");
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
111 gtk_table_attach_defaults(GTK_TABLE(titleinfotable), cddbserverlabel, 0, 1, 2, 3);
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
112
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
113 cddbportlabel = gtk_label_new("Port: ");
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
114 gtk_table_attach_defaults(GTK_TABLE(titleinfotable), cddbportlabel, 0, 1, 3, 4);
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
115
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
116 cddbserverentry = gtk_entry_new();
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
117 gtk_table_attach_defaults(GTK_TABLE(titleinfotable), cddbserverentry, 1, 2, 2, 3);
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
118
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
119 cddbportentry = gtk_entry_new();
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
120 gtk_table_attach_defaults(GTK_TABLE(titleinfotable), cddbportentry, 1, 2, 3, 4);
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
121
1189
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
122
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
123 usedevicecheckbutton = gtk_check_button_new_with_label("Override default device: ");
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
124 g_signal_connect(G_OBJECT(usedevicecheckbutton), "toggled", G_CALLBACK(checkbutton_toggled), NULL);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
125 gtk_table_attach_defaults(GTK_TABLE(misctable), usedevicecheckbutton, 0, 1, 0, 1);
1193
483b8d900d5e Added enable/disable debug option
calin.crisan@ldev-006
parents: 1189
diff changeset
126
1189
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
127 deviceentry = gtk_entry_new();
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
128 gtk_table_attach_defaults(GTK_TABLE(misctable), deviceentry, 1, 2, 0, 1);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
129
1193
483b8d900d5e Added enable/disable debug option
calin.crisan@ldev-006
parents: 1189
diff changeset
130 debugcheckbutton = gtk_check_button_new_with_label("Print debug information");
483b8d900d5e Added enable/disable debug option
calin.crisan@ldev-006
parents: 1189
diff changeset
131 g_signal_connect(G_OBJECT(debugcheckbutton), "toggled", G_CALLBACK(checkbutton_toggled), NULL);
483b8d900d5e Added enable/disable debug option
calin.crisan@ldev-006
parents: 1189
diff changeset
132 gtk_table_attach_defaults(GTK_TABLE(misctable), debugcheckbutton, 0, 1, 1, 2);
483b8d900d5e Added enable/disable debug option
calin.crisan@ldev-006
parents: 1189
diff changeset
133
1189
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
134
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
135 buttonbox = gtk_hbutton_box_new();
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
136 gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_END);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
137 gtk_hbutton_box_set_spacing_default(10);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
138 gtk_table_attach_defaults(GTK_TABLE(maintable), buttonbox, 0, 2, 3, 4);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
139
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
140 okbutton = gtk_button_new_with_label("Ok");
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
141 g_signal_connect(G_OBJECT(okbutton), "clicked", G_CALLBACK(button_clicked), NULL);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
142 gtk_container_add(GTK_CONTAINER(buttonbox), okbutton);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
143
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
144 cancelbutton = gtk_button_new_with_label("Cancel");
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
145 g_signal_connect(G_OBJECT(cancelbutton), "clicked", G_CALLBACK(button_clicked), NULL);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
146 gtk_container_add(GTK_CONTAINER(buttonbox), cancelbutton);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
147
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
148
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
149 gtk_widget_show(usedaecheckbutton);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
150 gtk_widget_show(limitcheckbutton);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
151 gtk_widget_show(limitspinbutton);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
152 gtk_widget_show(usecdtextcheckbutton);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
153 gtk_widget_show(usecddbcheckbutton);
1303
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
154 gtk_widget_show(cddbserverentry);
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
155 gtk_widget_show(cddbportentry);
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
156 gtk_widget_show(cddbserverlabel);
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
157 gtk_widget_show(cddbportlabel);
1189
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
158 gtk_widget_show(usedevicecheckbutton);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
159 gtk_widget_show(deviceentry);
1193
483b8d900d5e Added enable/disable debug option
calin.crisan@ldev-006
parents: 1189
diff changeset
160 gtk_widget_show(debugcheckbutton);
1189
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
161
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
162 gtk_widget_show(daetable);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
163 gtk_widget_show(daeframe);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
164 gtk_widget_show(titleinfotable);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
165 gtk_widget_show(titleinfoframe);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
166 gtk_widget_show(misctable);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
167 gtk_widget_show(miscframe);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
168
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
169 gtk_widget_show(buttonbox);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
170 gtk_widget_show(okbutton);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
171 gtk_widget_show(cancelbutton);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
172
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
173 gtk_widget_show(maintable);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
174 }
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
175
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
176 void configure_show_gui()
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
177 {
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
178 values_to_gui();
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
179 gtk_widget_show(configwindow);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
180 }
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
181
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
182 gboolean delete_window(GtkWidget *widget, GdkEvent *event, gpointer data)
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
183 {
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
184 gtk_widget_hide(configwindow);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
185 return TRUE;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
186 }
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
187
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
188 void button_clicked(GtkWidget *widget, gpointer data)
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
189 {
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
190 gtk_widget_hide(configwindow);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
191 if (widget == okbutton)
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
192 gui_to_values();
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
193 }
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
194
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
195
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
196 void checkbutton_toggled(GtkWidget *widget, gpointer data)
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
197 {
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
198 gtk_widget_set_sensitive(limitcheckbutton, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(usedaecheckbutton)));
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
199
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
200 gtk_widget_set_sensitive(
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
201 limitspinbutton,
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
202 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(limitcheckbutton)) &&
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
203 GTK_WIDGET_IS_SENSITIVE(limitcheckbutton));
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
204
1303
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
205 gtk_widget_set_sensitive(cddbserverentry, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(usecddbcheckbutton)));
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
206 gtk_widget_set_sensitive(cddbportentry, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(usecddbcheckbutton)));
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
207
1189
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
208 gtk_widget_set_sensitive(deviceentry, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(usedevicecheckbutton)));
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
209 }
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
210
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
211 void values_to_gui()
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
212 {
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
213 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(usedaecheckbutton), *usedae);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
214
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
215 gtk_widget_set_sensitive(limitcheckbutton, *usedae);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
216 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(limitcheckbutton), *limitspeed > 0);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
217
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
218 gtk_widget_set_sensitive(limitspinbutton, *usedae && *limitspeed > 0);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
219 gtk_spin_button_set_value(GTK_SPIN_BUTTON(limitspinbutton), *limitspeed);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
220
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
221 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(usecdtextcheckbutton), *usecdtext);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
222 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(usecddbcheckbutton), *usecddb);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
223
1303
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
224 char portstr[10];
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
225 sprintf(portstr, "%d", *cddbport);
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
226 gtk_entry_set_text(GTK_ENTRY(cddbserverentry), cddbserver);
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
227 gtk_entry_set_text(GTK_ENTRY(cddbportentry), portstr);
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
228 gtk_widget_set_sensitive(cddbserverentry, *usecddb);
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
229 gtk_widget_set_sensitive(cddbportentry, *usecddb);
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
230
1189
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
231 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(usedevicecheckbutton), strlen(device) > 0);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
232
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
233 gtk_widget_set_sensitive(deviceentry, strlen(device) > 0);
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
234 gtk_entry_set_text(GTK_ENTRY(deviceentry), device);
1193
483b8d900d5e Added enable/disable debug option
calin.crisan@ldev-006
parents: 1189
diff changeset
235
483b8d900d5e Added enable/disable debug option
calin.crisan@ldev-006
parents: 1189
diff changeset
236 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(debugcheckbutton), *debug);
1189
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
237 }
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
238
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
239 void gui_to_values()
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
240 {
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
241 *usedae = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(usedaecheckbutton));
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
242 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(limitcheckbutton)))
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
243 *limitspeed = gtk_spin_button_get_value(GTK_SPIN_BUTTON(limitspinbutton));
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
244 else
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
245 *limitspeed = 0;
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
246 *usecdtext = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(usecdtextcheckbutton));
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
247 *usecddb = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(usecddbcheckbutton));
1303
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
248 strcpy(cddbserver, gtk_entry_get_text(GTK_ENTRY(cddbserverentry)));
2a7c9e0b9c0f Added configure options for cddb
zither@litestep.network
parents: 1193
diff changeset
249 *cddbport = strtol(gtk_entry_get_text(GTK_ENTRY(cddbportentry)), NULL, 10);
1189
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
250 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(usedevicecheckbutton)))
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
251 strcpy(device, gtk_entry_get_text(GTK_ENTRY(deviceentry)));
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
252 else
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
253 strcpy(device, "");
1193
483b8d900d5e Added enable/disable debug option
calin.crisan@ldev-006
parents: 1189
diff changeset
254 *debug = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(debugcheckbutton));
1189
af5bd4592100 Added cdaudio-ng.h; added a configure dialog
zither@litestep.network
parents:
diff changeset
255 }