File: interface.c

package info (click to toggle)
audacious-dumb 0.57-1.1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 172 kB
  • ctags: 105
  • sloc: ansic: 539; makefile: 108
file content (263 lines) | stat: -rw-r--r-- 14,239 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
/*
 * DO NOT EDIT THIS FILE - it is generated by Glade.
 */

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>

#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>

#include "callbacks.h"
#include "interface.h"
#include "support.h"

#define GLADE_HOOKUP_OBJECT(component,widget,name) \
  g_object_set_data_full (G_OBJECT (component), name, \
    gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)

#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
  g_object_set_data (G_OBJECT (component), name, widget)

GtkWidget*
create_songinfo (void)
{
  GtkWidget *songinfo;
  GtkWidget *songinfo_vbox;
  GtkWidget *songinfo_notebook;
  GtkWidget *songinfo_message_scrolledwindow;
  GtkWidget *songinfo_message_text;
  GtkWidget *songinfo_notebook_label_message;
  GtkWidget *songinfo_samples_scrolledwindow;
  GtkWidget *songinfo_samples_clist;
  GtkWidget *songinfo_samples_clist_label_number;
  GtkWidget *songinfo_samples_clist_label_sample_name;
  GtkWidget *songinfo_samples_clist_label_file_name;
  GtkWidget *songinfo_notebook_label_samples;
  GtkWidget *songinfo_instruments_scrolledwindow;
  GtkWidget *songinfo_instruments_clist;
  GtkWidget *songinfo_instruments_clist_label_number;
  GtkWidget *songinfo_instruments_clist_label_instrument_name;
  GtkWidget *songinfo_instruments_clist_label_file_name;
  GtkWidget *songinfo_notebook_label_instruments;
  GtkWidget *songinfo_button_box;
  GtkWidget *songinfo_button_close;

  songinfo = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (songinfo), _("Song Information"));
  gtk_window_set_default_size (GTK_WINDOW (songinfo), 640, 480);
  gtk_window_set_type_hint (GTK_WINDOW (songinfo), GDK_WINDOW_TYPE_HINT_DIALOG);

  songinfo_vbox = GTK_DIALOG (songinfo)->vbox;
  gtk_widget_show (songinfo_vbox);

  songinfo_notebook = gtk_notebook_new ();
  gtk_widget_show (songinfo_notebook);
  gtk_box_pack_start (GTK_BOX (songinfo_vbox), songinfo_notebook, TRUE, TRUE, 0);

  songinfo_message_scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_show (songinfo_message_scrolledwindow);
  gtk_container_add (GTK_CONTAINER (songinfo_notebook), songinfo_message_scrolledwindow);
  GTK_WIDGET_UNSET_FLAGS (songinfo_message_scrolledwindow, GTK_CAN_FOCUS);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (songinfo_message_scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (songinfo_message_scrolledwindow), GTK_SHADOW_IN);

  songinfo_message_text = gtk_text_view_new ();
  gtk_widget_show (songinfo_message_text);
  gtk_container_add (GTK_CONTAINER (songinfo_message_scrolledwindow), songinfo_message_text);
  gtk_text_view_set_editable (GTK_TEXT_VIEW (songinfo_message_text), FALSE);
  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (songinfo_message_text), GTK_WRAP_WORD);
  gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (songinfo_message_text), FALSE);

  songinfo_notebook_label_message = gtk_label_new (_("Message"));
  gtk_widget_show (songinfo_notebook_label_message);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (songinfo_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (songinfo_notebook), 0), songinfo_notebook_label_message);
  gtk_label_set_justify (GTK_LABEL (songinfo_notebook_label_message), GTK_JUSTIFY_CENTER);

  songinfo_samples_scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_show (songinfo_samples_scrolledwindow);
  gtk_container_add (GTK_CONTAINER (songinfo_notebook), songinfo_samples_scrolledwindow);
  GTK_WIDGET_UNSET_FLAGS (songinfo_samples_scrolledwindow, GTK_CAN_FOCUS);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (songinfo_samples_scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (songinfo_samples_scrolledwindow), GTK_SHADOW_IN);

  songinfo_samples_clist = gtk_clist_new (3);
  gtk_widget_show (songinfo_samples_clist);
  gtk_container_add (GTK_CONTAINER (songinfo_samples_scrolledwindow), songinfo_samples_clist);
  gtk_clist_set_column_width (GTK_CLIST (songinfo_samples_clist), 0, 23);
  gtk_clist_set_column_width (GTK_CLIST (songinfo_samples_clist), 1, 290);
  gtk_clist_set_column_width (GTK_CLIST (songinfo_samples_clist), 2, 80);
  gtk_clist_column_titles_show (GTK_CLIST (songinfo_samples_clist));

  songinfo_samples_clist_label_number = gtk_label_new (_("#"));
  gtk_widget_show (songinfo_samples_clist_label_number);
  gtk_clist_set_column_widget (GTK_CLIST (songinfo_samples_clist), 0, songinfo_samples_clist_label_number);
  gtk_label_set_justify (GTK_LABEL (songinfo_samples_clist_label_number), GTK_JUSTIFY_CENTER);

  songinfo_samples_clist_label_sample_name = gtk_label_new (_("Sample Name"));
  gtk_widget_show (songinfo_samples_clist_label_sample_name);
  gtk_clist_set_column_widget (GTK_CLIST (songinfo_samples_clist), 1, songinfo_samples_clist_label_sample_name);
  gtk_label_set_justify (GTK_LABEL (songinfo_samples_clist_label_sample_name), GTK_JUSTIFY_CENTER);

  songinfo_samples_clist_label_file_name = gtk_label_new (_("File Name"));
  gtk_widget_show (songinfo_samples_clist_label_file_name);
  gtk_clist_set_column_widget (GTK_CLIST (songinfo_samples_clist), 2, songinfo_samples_clist_label_file_name);
  gtk_label_set_justify (GTK_LABEL (songinfo_samples_clist_label_file_name), GTK_JUSTIFY_CENTER);

  songinfo_notebook_label_samples = gtk_label_new (_("Samples"));
  gtk_widget_show (songinfo_notebook_label_samples);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (songinfo_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (songinfo_notebook), 1), songinfo_notebook_label_samples);
  gtk_label_set_justify (GTK_LABEL (songinfo_notebook_label_samples), GTK_JUSTIFY_CENTER);

  songinfo_instruments_scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_show (songinfo_instruments_scrolledwindow);
  gtk_container_add (GTK_CONTAINER (songinfo_notebook), songinfo_instruments_scrolledwindow);
  GTK_WIDGET_UNSET_FLAGS (songinfo_instruments_scrolledwindow, GTK_CAN_FOCUS);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (songinfo_instruments_scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (songinfo_instruments_scrolledwindow), GTK_SHADOW_IN);

  songinfo_instruments_clist = gtk_clist_new (3);
  gtk_widget_show (songinfo_instruments_clist);
  gtk_container_add (GTK_CONTAINER (songinfo_instruments_scrolledwindow), songinfo_instruments_clist);
  gtk_clist_set_column_width (GTK_CLIST (songinfo_instruments_clist), 0, 23);
  gtk_clist_set_column_width (GTK_CLIST (songinfo_instruments_clist), 1, 290);
  gtk_clist_set_column_width (GTK_CLIST (songinfo_instruments_clist), 2, 80);
  gtk_clist_column_titles_show (GTK_CLIST (songinfo_instruments_clist));

  songinfo_instruments_clist_label_number = gtk_label_new (_("#"));
  gtk_widget_show (songinfo_instruments_clist_label_number);
  gtk_clist_set_column_widget (GTK_CLIST (songinfo_instruments_clist), 0, songinfo_instruments_clist_label_number);
  gtk_label_set_justify (GTK_LABEL (songinfo_instruments_clist_label_number), GTK_JUSTIFY_CENTER);

  songinfo_instruments_clist_label_instrument_name = gtk_label_new (_("Instrument Name"));
  gtk_widget_show (songinfo_instruments_clist_label_instrument_name);
  gtk_clist_set_column_widget (GTK_CLIST (songinfo_instruments_clist), 1, songinfo_instruments_clist_label_instrument_name);
  gtk_label_set_justify (GTK_LABEL (songinfo_instruments_clist_label_instrument_name), GTK_JUSTIFY_CENTER);

  songinfo_instruments_clist_label_file_name = gtk_label_new (_("File Name"));
  gtk_widget_show (songinfo_instruments_clist_label_file_name);
  gtk_clist_set_column_widget (GTK_CLIST (songinfo_instruments_clist), 2, songinfo_instruments_clist_label_file_name);
  gtk_label_set_justify (GTK_LABEL (songinfo_instruments_clist_label_file_name), GTK_JUSTIFY_CENTER);

  songinfo_notebook_label_instruments = gtk_label_new (_("Instruments"));
  gtk_widget_show (songinfo_notebook_label_instruments);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (songinfo_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (songinfo_notebook), 2), songinfo_notebook_label_instruments);
  gtk_label_set_justify (GTK_LABEL (songinfo_notebook_label_instruments), GTK_JUSTIFY_CENTER);

  songinfo_button_box = GTK_DIALOG (songinfo)->action_area;
  gtk_widget_show (songinfo_button_box);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (songinfo_button_box), GTK_BUTTONBOX_END);

  songinfo_button_close = gtk_button_new_from_stock ("gtk-close");
  gtk_widget_show (songinfo_button_close);
  gtk_dialog_add_action_widget (GTK_DIALOG (songinfo), songinfo_button_close, GTK_RESPONSE_CLOSE);

  g_signal_connect_swapped ((gpointer) songinfo_button_close, "clicked",
                            G_CALLBACK (gtk_widget_destroy),
                            GTK_OBJECT (songinfo));

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (songinfo, songinfo, "songinfo");
  GLADE_HOOKUP_OBJECT_NO_REF (songinfo, songinfo_vbox, "songinfo_vbox");
  GLADE_HOOKUP_OBJECT (songinfo, songinfo_notebook, "songinfo_notebook");
  GLADE_HOOKUP_OBJECT (songinfo, songinfo_message_scrolledwindow, "songinfo_message_scrolledwindow");
  GLADE_HOOKUP_OBJECT (songinfo, songinfo_message_text, "songinfo_message_text");
  GLADE_HOOKUP_OBJECT (songinfo, songinfo_notebook_label_message, "songinfo_notebook_label_message");
  GLADE_HOOKUP_OBJECT (songinfo, songinfo_samples_scrolledwindow, "songinfo_samples_scrolledwindow");
  GLADE_HOOKUP_OBJECT (songinfo, songinfo_samples_clist, "songinfo_samples_clist");
  GLADE_HOOKUP_OBJECT (songinfo, songinfo_samples_clist_label_number, "songinfo_samples_clist_label_number");
  GLADE_HOOKUP_OBJECT (songinfo, songinfo_samples_clist_label_sample_name, "songinfo_samples_clist_label_sample_name");
  GLADE_HOOKUP_OBJECT (songinfo, songinfo_samples_clist_label_file_name, "songinfo_samples_clist_label_file_name");
  GLADE_HOOKUP_OBJECT (songinfo, songinfo_notebook_label_samples, "songinfo_notebook_label_samples");
  GLADE_HOOKUP_OBJECT (songinfo, songinfo_instruments_scrolledwindow, "songinfo_instruments_scrolledwindow");
  GLADE_HOOKUP_OBJECT (songinfo, songinfo_instruments_clist, "songinfo_instruments_clist");
  GLADE_HOOKUP_OBJECT (songinfo, songinfo_instruments_clist_label_number, "songinfo_instruments_clist_label_number");
  GLADE_HOOKUP_OBJECT (songinfo, songinfo_instruments_clist_label_instrument_name, "songinfo_instruments_clist_label_instrument_name");
  GLADE_HOOKUP_OBJECT (songinfo, songinfo_instruments_clist_label_file_name, "songinfo_instruments_clist_label_file_name");
  GLADE_HOOKUP_OBJECT (songinfo, songinfo_notebook_label_instruments, "songinfo_notebook_label_instruments");
  GLADE_HOOKUP_OBJECT_NO_REF (songinfo, songinfo_button_box, "songinfo_button_box");
  GLADE_HOOKUP_OBJECT (songinfo, songinfo_button_close, "songinfo_button_close");

  return songinfo;
}

GtkWidget*
create_prefs (void)
{
  GtkWidget *prefs;
  GtkWidget *dialog_vbox1;
  GtkWidget *prefs_checkbox_disableamiga;
  GtkWidget *prefs_hbox1;
  GtkWidget *prefs_freq_label;
  GtkWidget *prefs_freq_combobox;
  GtkWidget *prefs_freq_label_hz;
  GtkWidget *dialog_action_area1;
  GtkWidget *prefs_button_cancel;
  GtkWidget *prefs_button_ok;

  prefs = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (prefs), _("DUMB Preferences"));
  gtk_window_set_type_hint (GTK_WINDOW (prefs), GDK_WINDOW_TYPE_HINT_DIALOG);

  dialog_vbox1 = GTK_DIALOG (prefs)->vbox;
  gtk_widget_show (dialog_vbox1);

  prefs_checkbox_disableamiga = gtk_check_button_new_with_mnemonic (_("Disable Amiga Support"));
  gtk_widget_show (prefs_checkbox_disableamiga);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), prefs_checkbox_disableamiga, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (prefs_checkbox_disableamiga), 10);

  prefs_hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (prefs_hbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), prefs_hbox1, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (prefs_hbox1), 4);

  prefs_freq_label = gtk_label_new (_("Frequency:"));
  gtk_widget_show (prefs_freq_label);
  gtk_box_pack_start (GTK_BOX (prefs_hbox1), prefs_freq_label, FALSE, FALSE, 0);
  gtk_misc_set_padding (GTK_MISC (prefs_freq_label), 8, 0);

  prefs_freq_combobox = gtk_combo_box_new_text ();
  gtk_widget_show (prefs_freq_combobox);
  gtk_box_pack_start (GTK_BOX (prefs_hbox1), prefs_freq_combobox, FALSE, FALSE, 3);

  prefs_freq_label_hz = gtk_label_new (_("Hz"));
  gtk_widget_show (prefs_freq_label_hz);
  gtk_box_pack_start (GTK_BOX (prefs_hbox1), prefs_freq_label_hz, FALSE, FALSE, 0);

  dialog_action_area1 = GTK_DIALOG (prefs)->action_area;
  gtk_widget_show (dialog_action_area1);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);

  prefs_button_cancel = gtk_button_new_from_stock ("gtk-cancel");
  gtk_widget_show (prefs_button_cancel);
  gtk_dialog_add_action_widget (GTK_DIALOG (prefs), prefs_button_cancel, GTK_RESPONSE_CANCEL);
  GTK_WIDGET_SET_FLAGS (prefs_button_cancel, GTK_CAN_DEFAULT);

  prefs_button_ok = gtk_button_new_from_stock ("gtk-ok");
  gtk_widget_show (prefs_button_ok);
  gtk_dialog_add_action_widget (GTK_DIALOG (prefs), prefs_button_ok, GTK_RESPONSE_OK);
  GTK_WIDGET_SET_FLAGS (prefs_button_ok, GTK_CAN_DEFAULT);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (prefs, prefs, "prefs");
  GLADE_HOOKUP_OBJECT_NO_REF (prefs, dialog_vbox1, "dialog_vbox1");
  GLADE_HOOKUP_OBJECT (prefs, prefs_checkbox_disableamiga, "prefs_checkbox_disableamiga");
  GLADE_HOOKUP_OBJECT (prefs, prefs_hbox1, "prefs_hbox1");
  GLADE_HOOKUP_OBJECT (prefs, prefs_freq_label, "prefs_freq_label");
  GLADE_HOOKUP_OBJECT (prefs, prefs_freq_combobox, "prefs_freq_combobox");
  GLADE_HOOKUP_OBJECT (prefs, prefs_freq_label_hz, "prefs_freq_label_hz");
  GLADE_HOOKUP_OBJECT_NO_REF (prefs, dialog_action_area1, "dialog_action_area1");
  GLADE_HOOKUP_OBJECT (prefs, prefs_button_cancel, "prefs_button_cancel");
  GLADE_HOOKUP_OBJECT (prefs, prefs_button_ok, "prefs_button_ok");

  return prefs;
}