Mercurial > audlegacy
annotate src/audacious/ui_credits.c @ 2606:7c19bb5516db trunk
[svn] - Removed some of the horrible code duplication in the file popup code
author | mf0102 |
---|---|
date | Sun, 04 Mar 2007 10:43:38 -0800 |
parents | f6e7400a5c1f |
children | 70a76fd7a28f |
rev | line source |
---|---|
2313 | 1 /* Audacious - Cross-platform multimedia player |
2 * Copyright (C) 2005-2007 Audacious Team | |
3 * | |
4 * Based on BMP: | |
5 * Copyright (C) 2003-2004 BMP development team | |
6 * | |
7 * Based on XMMS: | |
8 * Copyright (C) 1998-2003 XMMS development team | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
12 * the Free Software Foundation; under version 2 of the License. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 # include "config.h" | |
26 #endif | |
27 | |
28 #include "ui_credits.h" | |
29 | |
30 #include <glib.h> | |
31 #include <glib/gi18n.h> | |
32 #include <gtk/gtk.h> | |
33 | |
34 #include "audacious_logo.xpm" | |
35 | |
36 | |
37 enum { | |
38 COL_LEFT, | |
39 COL_RIGHT, | |
40 N_COLS | |
41 }; | |
42 | |
43 | |
44 static const gchar *bmp_brief = | |
45 N_("<big><b>Audacious %s</b></big>\n" | |
46 "The future of UNIX multimedia.\n" | |
47 "\n" | |
48 "Copyright (C) 2005-2007 Audacious Development Team\n"); | |
49 | |
50 static const gchar *credit_text[] = { | |
51 N_("Audacious core developers:"), | |
52 "George Averill", | |
2376
e1513290ee3c
[svn] Add a VFSFile method for getting metadata associated with the file.
iabervon
parents:
2330
diff
changeset
|
53 "Daniel Barkalow", |
2313 | 54 "Daniel Bradshaw", |
55 "Adam Cecile", | |
2330 | 56 "Michael Färber", |
2313 | 57 "Troels Bang Jensen", |
58 "Giacomo Lozito", | |
59 "William Pitcock", | |
60 "Derek Pomery", | |
61 "Jonathan Schleifer", | |
62 "Tony Vroon", | |
63 "Yoshiki Yazawa", | |
64 NULL, | |
65 | |
66 N_("Graphics:"), | |
67 "George Averill", | |
68 "Stephan Sokolow", | |
69 NULL, | |
70 | |
71 N_("Default skin:"), | |
72 "George Averill", | |
73 "William Pitcock", | |
74 NULL, | |
75 | |
76 N_("Plugin development:"), | |
77 "Kiyoshi Aman", | |
78 "Luca Barbato", | |
2376
e1513290ee3c
[svn] Add a VFSFile method for getting metadata associated with the file.
iabervon
parents:
2330
diff
changeset
|
79 "Daniel Barkalow", |
2313 | 80 "Shay Green", |
81 "Giacomo Lozito", | |
82 "William Pitcock", | |
83 "Derek Pomery", | |
84 "Jonathan Schleifer", | |
85 "Tony Vroon", | |
2594 | 86 "Yoshiki Yazawa", |
2313 | 87 NULL, |
88 | |
89 N_("Patch authors:"), | |
2565 | 90 "Christian Birchinger", |
2313 | 91 "Laszlo Dvornik", |
92 "Ralf Ertzinger", | |
93 "Mike Frysinger", | |
2493
b7f48f00a342
[svn] - patch from Mark Glines to ad https:// URI support to playlists.
nenolod
parents:
2470
diff
changeset
|
94 "Mark Glines", |
2594 | 95 "Teru KAMOGASHIRA", |
2313 | 96 "Chris Kehler", |
2591
f14a639354b3
[svn] - there was a missing delimeter in the patch credits
nenolod
parents:
2582
diff
changeset
|
97 "Alex Maclean", |
2313 | 98 "Michael Hanselmann", |
2434
1102fb4280d7
[svn] Add Joseph Jezak to the list of patch submitters.
chainsaw
parents:
2376
diff
changeset
|
99 "Joseph Jezak", |
2313 | 100 "Henrik Johansson", |
101 "Rodrigo Martins de Matos Ventura", | |
102 "Diego Pettenò", | |
103 "Kazuki Shimura", | |
104 "Valentine Sinitsyn", | |
105 "Johan Tavelin", | |
106 "Tim Yamin", | |
107 NULL, | |
108 | |
109 N_("0.1.x developers:"), | |
110 "William Pitcock", | |
111 "Mohammed Sameer", | |
112 "Tony Vroon", | |
113 NULL, | |
114 | |
115 N_("BMP Developers:"), | |
116 "Artem Baguinski", | |
117 "Edward Brocklesby", | |
118 "Chong Kai Xiong", | |
119 "Milosz Derezynski", | |
120 "David Lau", | |
121 "Ole Andre Vadla Ravnaas", | |
122 "Michiel Sikkes", | |
123 "Andrei Badea", | |
124 "Peter Behroozi", | |
125 "Bernard Blackham", | |
126 "Oliver Blin", | |
127 "Tomas Bzatek", | |
128 "Liviu Danicel", | |
129 "Jon Dowland", | |
130 "Artur Frysiak", | |
131 "Sebastian Kapfer", | |
132 "Lukas Koberstein", | |
133 "Dan Korostelev", | |
134 "Jolan Luff", | |
135 "Michael Marineau", | |
136 "Tim-Philipp Muller", | |
137 "Julien Portalier", | |
138 "Andrew Ruder", | |
139 "Olivier Samyn", | |
140 "Martijn Vernooij", | |
141 NULL, | |
142 | |
143 NULL | |
144 }; | |
145 | |
146 static const gchar *translators[] = { | |
147 N_("Brazilian Portuguese:"), | |
148 "Philipi Pinto", | |
149 NULL, | |
150 N_("Breton:"), | |
151 "Thierry Vignaud", | |
152 NULL, | |
153 N_("Bulgarian:"), | |
154 "Andrew Ivanov", | |
155 NULL, | |
2511
0197fb284f79
[svn] - add Catalan translation file. Closes #786.
nenolod
parents:
2493
diff
changeset
|
156 N_("Catalan:"), |
0197fb284f79
[svn] - add Catalan translation file. Closes #786.
nenolod
parents:
2493
diff
changeset
|
157 "Ernest Adrogu", |
0197fb284f79
[svn] - add Catalan translation file. Closes #786.
nenolod
parents:
2493
diff
changeset
|
158 NULL, |
2435
5b23e9b07317
[svn] - new croatian translation from Marin Glibic
nenolod
parents:
2434
diff
changeset
|
159 N_("Croatian:"), |
5b23e9b07317
[svn] - new croatian translation from Marin Glibic
nenolod
parents:
2434
diff
changeset
|
160 "Marin Glibic", |
5b23e9b07317
[svn] - new croatian translation from Marin Glibic
nenolod
parents:
2434
diff
changeset
|
161 NULL, |
2313 | 162 N_("Czech:"), |
2582 | 163 "Petr Pisar", |
2313 | 164 NULL, |
165 N_("Dutch:"), | |
166 "Laurens Buhler", | |
167 "Tony Vroon", | |
168 NULL, | |
169 N_("Finnish:"), | |
170 "Pauli Virtanen", | |
171 NULL, | |
172 N_("French:"), | |
173 "Adam Cecile", | |
174 NULL, | |
175 N_("German:"), | |
176 "Michael Hanselmann", | |
177 "Matthias Debus", | |
178 NULL, | |
179 N_("Georgian:"), | |
180 "George Machitidze", | |
181 NULL, | |
182 N_("Greek:"), | |
183 "Kouzinopoulos Haris", | |
184 "Stavros Giannouris", | |
185 "Stathis Kamperis", | |
186 NULL, | |
187 N_("Hindi:"), | |
188 "Dhananjaya Sharma", | |
189 NULL, | |
190 N_("Hungarian:"), | |
191 "Laszlo Dvornik", | |
192 NULL, | |
193 N_("Italian:"), | |
194 "Alessio D'Ascanio", | |
195 "Diego Pettenò", | |
196 NULL, | |
197 N_("Japanese:"), | |
198 "Dai", | |
199 NULL, | |
200 N_("Korean:"), | |
201 "DongCheon Park", | |
202 NULL, | |
203 N_("Lithuanian:"), | |
204 "Rimas Kudelis", | |
205 NULL, | |
206 N_("Macedonian:"), | |
207 "Arangel Angov", | |
208 NULL, | |
209 N_("Polish:"), | |
210 "Wojciech Myrda", | |
211 NULL, | |
212 N_("Romanian:"), | |
213 "Daniel Patriche", | |
214 NULL, | |
215 N_("Russian:"), | |
216 "Alexandr Orlov", | |
217 NULL, | |
218 N_("Serbian (Latin):"), | |
219 "Strahinja Kustudić", | |
220 NULL, | |
221 N_("Serbian (Cyrillic):"), | |
222 "Strahinja Kustudić", | |
223 NULL, | |
224 N_("Simplified Chinese:"), | |
225 "Yang Zhang", | |
226 NULL, | |
227 N_("Slovak:"), | |
228 "Pavel Kanzelsberger", | |
229 NULL, | |
230 N_("Spanish:"), | |
231 "Gustavo D. Vranjes", | |
232 NULL, | |
233 N_("Swedish:"), | |
234 "Martin Persenius", | |
235 NULL, | |
236 N_("Traditional Chinese:"), | |
237 "Cheng-Wei Chien", | |
238 NULL, | |
2470 | 239 N_("Turkish:"), |
240 "Murat Senel", | |
241 "Eren Turkay", | |
242 NULL, | |
2313 | 243 N_("Ukrainian:"), |
244 "Mykola Lynnyk", | |
245 NULL, | |
246 N_("Welsh:"), | |
247 "Edward Brocklesby", | |
248 "William Pitcock", | |
249 NULL, | |
250 | |
251 NULL | |
252 }; | |
253 | |
254 | |
255 static GtkWidget * | |
256 generate_credit_list(const gchar * text[], gboolean sec_space) | |
257 { | |
258 GtkWidget *scrollwin; | |
259 GtkWidget *treeview; | |
260 GtkListStore *list_store; | |
261 GtkTreeIter iter; | |
262 GtkTreeViewColumn *column; | |
263 GtkCellRenderer *renderer; | |
264 const gchar *const *item; | |
265 | |
266 list_store = gtk_list_store_new(N_COLS, G_TYPE_STRING, G_TYPE_STRING); | |
267 | |
268 item = text; | |
269 | |
270 while (*item) { | |
271 gtk_list_store_append(list_store, &iter); | |
272 gtk_list_store_set(list_store, &iter, | |
273 COL_LEFT, _(item[0]), COL_RIGHT, _(item[1]), -1); | |
274 item += 2; | |
275 | |
276 while (*item) { | |
277 gtk_list_store_append(list_store, &iter); | |
278 gtk_list_store_set(list_store, &iter, | |
279 COL_LEFT, "", COL_RIGHT, _(*item++), -1); | |
280 } | |
281 | |
282 ++item; | |
283 | |
284 if (*item && sec_space) { | |
285 gtk_list_store_append(list_store, &iter); | |
286 gtk_list_store_set(list_store, &iter, | |
287 COL_LEFT, "", COL_RIGHT, "", -1); | |
288 } | |
289 } | |
290 | |
291 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(list_store)); | |
292 gtk_tree_view_set_headers_clickable(GTK_TREE_VIEW(treeview), FALSE); | |
293 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE); | |
294 gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), | |
295 GTK_SELECTION_NONE); | |
296 | |
297 renderer = gtk_cell_renderer_text_new(); | |
298 g_object_set(renderer, "xalign", 1.0, NULL); | |
299 column = gtk_tree_view_column_new_with_attributes("Left", renderer, | |
300 "text", COL_LEFT, NULL); | |
301 gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); | |
302 | |
303 renderer = gtk_cell_renderer_text_new(); | |
304 g_object_set(renderer, "xalign", 0.0, NULL); | |
305 column = gtk_tree_view_column_new_with_attributes("Right", renderer, | |
306 "text", COL_RIGHT, | |
307 NULL); | |
308 gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); | |
309 | |
310 scrollwin = gtk_scrolled_window_new(NULL, NULL); | |
311 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin), | |
312 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
313 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrollwin), GTK_SHADOW_IN); | |
314 gtk_container_add(GTK_CONTAINER(scrollwin), treeview); | |
315 gtk_container_set_border_width(GTK_CONTAINER(scrollwin), 10); | |
316 | |
317 gtk_widget_show_all(scrollwin); | |
318 | |
319 return scrollwin; | |
320 } | |
321 | |
322 void | |
323 show_credits_window(void) | |
324 { | |
325 static GtkWidget *about_window = NULL; | |
326 | |
327 GdkPixmap *beep_logo_pmap = NULL, *beep_logo_mask = NULL; | |
328 GtkWidget *about_vbox; | |
329 GtkWidget *about_credits_logo_box, *about_credits_logo_frame; | |
330 GtkWidget *about_credits_logo; | |
331 GtkWidget *about_notebook; | |
332 GtkWidget *list; | |
333 GtkWidget *bbox, *close_btn; | |
334 GtkWidget *label; | |
335 gchar *text; | |
336 | |
337 if (about_window) | |
338 return; | |
339 | |
340 about_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
341 gtk_window_set_type_hint(GTK_WINDOW(about_window), | |
342 GDK_WINDOW_TYPE_HINT_DIALOG); | |
343 | |
344 gtk_window_set_default_size(GTK_WINDOW(about_window), -1, 512); | |
345 gtk_window_set_title(GTK_WINDOW(about_window), _("About Audacious")); | |
346 gtk_window_set_position(GTK_WINDOW(about_window), GTK_WIN_POS_CENTER); | |
347 gtk_window_set_resizable(GTK_WINDOW(about_window), TRUE); | |
348 gtk_container_set_border_width(GTK_CONTAINER(about_window), 10); | |
349 | |
350 g_signal_connect(about_window, "destroy", | |
351 G_CALLBACK(gtk_widget_destroyed), &about_window); | |
352 | |
353 gtk_widget_realize(about_window); | |
354 | |
355 about_vbox = gtk_vbox_new(FALSE, 5); | |
356 gtk_container_add(GTK_CONTAINER(about_window), about_vbox); | |
357 | |
358 if (!beep_logo_pmap) | |
359 beep_logo_pmap = | |
360 gdk_pixmap_create_from_xpm_d(about_window->window, | |
361 &beep_logo_mask, NULL, audacious_logo_xpm); | |
362 | |
363 about_credits_logo_box = gtk_hbox_new(TRUE, 0); | |
364 gtk_box_pack_start(GTK_BOX(about_vbox), about_credits_logo_box, | |
365 FALSE, FALSE, 0); | |
366 | |
367 about_credits_logo_frame = gtk_frame_new(NULL); | |
368 gtk_frame_set_shadow_type(GTK_FRAME(about_credits_logo_frame), | |
369 GTK_SHADOW_ETCHED_OUT); | |
370 gtk_box_pack_start(GTK_BOX(about_credits_logo_box), | |
371 about_credits_logo_frame, FALSE, FALSE, 0); | |
372 | |
373 about_credits_logo = gtk_pixmap_new(beep_logo_pmap, beep_logo_mask); | |
374 gtk_container_add(GTK_CONTAINER(about_credits_logo_frame), | |
375 about_credits_logo); | |
376 | |
377 label = gtk_label_new(NULL); | |
378 text = g_strdup_printf(_(bmp_brief), VERSION); | |
379 gtk_label_set_markup(GTK_LABEL(label), text); | |
380 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER); | |
381 g_free(text); | |
382 | |
383 gtk_box_pack_start(GTK_BOX(about_vbox), label, FALSE, FALSE, 0); | |
384 | |
385 about_notebook = gtk_notebook_new(); | |
386 gtk_box_pack_start(GTK_BOX(about_vbox), about_notebook, TRUE, TRUE, 0); | |
387 | |
388 list = generate_credit_list(credit_text, TRUE); | |
389 gtk_notebook_append_page(GTK_NOTEBOOK(about_notebook), list, | |
390 gtk_label_new(_("Credits"))); | |
391 | |
392 list = generate_credit_list(translators, FALSE); | |
393 gtk_notebook_append_page(GTK_NOTEBOOK(about_notebook), list, | |
394 gtk_label_new(_("Translators"))); | |
395 | |
396 bbox = gtk_hbutton_box_new(); | |
397 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
398 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); | |
399 gtk_box_pack_start(GTK_BOX(about_vbox), bbox, FALSE, FALSE, 0); | |
400 | |
401 close_btn = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
402 g_signal_connect_swapped(close_btn, "clicked", | |
403 G_CALLBACK(gtk_widget_destroy), about_window); | |
404 GTK_WIDGET_SET_FLAGS(close_btn, GTK_CAN_DEFAULT); | |
405 gtk_box_pack_start(GTK_BOX(bbox), close_btn, TRUE, TRUE, 0); | |
406 gtk_widget_grab_default(close_btn); | |
407 | |
408 gtk_widget_show_all(about_window); | |
409 } |