Merge pull request #1404 from b4n/search/gtk-3-20-history
[geany-mirror.git] / src / about.c
blob9e7b02b46b03d9f7017378a01e1580bb34f977e7
1 /*
2 * about.c - this file is part of Geany, a fast and lightweight IDE
4 * Copyright 2005-2012 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
5 * Copyright 2006-2012 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
6 * Copyright 2006-2012 Frank Lanitz <frank@frank.uvena.de>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * About dialog and credits.
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
31 #include "about.h"
33 #include "app.h"
34 #include "gb.c"
35 #include "geany.h"
36 #include "geanywraplabel.h"
37 #include "main.h"
38 #include "support.h"
39 #include "ui_utils.h"
40 #include "utils.h"
42 #include "gtkcompat.h"
44 #define HEADER "<span size=\"larger\" weight=\"bold\">Geany %s</span>"
45 #define INFO "<span size=\"larger\" weight=\"bold\">%s</span>"
46 #define CODENAME "<span weight=\"bold\">\"" GEANY_CODENAME "\"</span>"
47 #define BUILDDATE "<span size=\"smaller\">%s</span>"
48 #define COPYRIGHT _("Copyright (c) 2005-2016\nColomban Wendling\nNick Treleaven\nMatthew Brush\nEnrico Tröger\nFrank Lanitz\nAll rights reserved.")
50 static const gchar *translators[][2] = {
51 { "ar", "Fayssal Chamekh &lt;chamfay@gmail.com&gt;"},
52 { "ast", "Marcos Costales &lt;marcoscostales@gmail.com&gt;"},
53 { "be_BY", "Yura Siamashka &lt;yurand2@gmail.com&gt;" },
54 { "bg", "Dilyan Rusev &lt;dilyanrusev@gmail.com&gt;" },
55 { "ca_ES", "Toni Garcia-Navarro &lt;topi@elpiset.net&gt;" },
56 { "cs_CZ", "Petr Messner &lt;messa@messa.cz&gt;\nAnna Talianova &lt;anickat1@gmail.com&gt;" },
57 { "de_DE", "Frank Lanitz &lt;frank@frank.uvena.de&gt;\nDominic Hopf &lt;dmaphy@googlemail.com&gt;" },
58 { "el", "Stavros Temertzidis &lt;bullgr@gmail.com&gt;" },
59 { "en_GB", "Jeff Bailes &lt;thepizzaking@gmail.com&gt;" },
60 { "es", "Antonio Jiménez González &lt;tonificante@hotmail.com&gt;\nLucas Vieites &lt;lucasvieites@gmail.com&gt;" },
61 { "eu", "Asier Iturralde Sarasola &lt;asier.iturralde@gmail.com&gt;"},
62 { "fa", "Moein Owhadi Kareshk &lt;moein.owhadi@gmail.com&gt;"},
63 { "fi", "Harri Koskinen &lt;harri@fastmonkey.org&gt;\nJari Rahkonen &lt;jari.rahkonen@pp1.inet.fi&gt;" },
64 { "fr", "Jean-Philippe Moal &lt;skateinmars@skateinmars.net&gt;" },
65 { "gl", "José Manuel Castroagudín Silva &lt;chavescesures@gmail.com&gt;"},
66 { "hi", "Asheesh Ranjan &lt;asheeshranjan1@gmail.com&gt;"},
67 { "he", "Yosef Or Boczko &lt;yoseforb@gmail.com&gt;"},
68 { "hu", "Gabor Kmetyko &lt;kg_kilo@freemail.hu&gt;" },
69 { "it", "Max Baldinelli &lt;m.baldinelli@agora.it&gt;,\nDario Santomarco &lt;dariello@yahoo.it&gt;" },
70 { "ja", "Tarot Osuji &lt;tarot@sdf.lonestar.org&gt;\nChikahiro Masami &lt;cmasa.z321@gmail.com&gt;" },
71 { "ko", "Park Jang-heon &lt;dotkabi@gmail.com&gt;" },
72 { "kk", "Baurzhan Muftakhidinov &lt;baurthefirst@gmail.com&gt;"},
73 { "lt", "Algimantas Margevičius &lt;margevicius.algimantas@gmail.com&gt;"},
74 { "lb", "Laurent Hoeltgen &lt;hoeltgman@gmail.com&gt;" },
75 { "mn", "tsetsee &lt;tsetsee.yugi@gmail.com&gt;"},
76 { "nl", "Benno Schulenberg &lt;benno@vertaalt.nl&gt;\nPeter Scholtens &lt;peter.scholtens@xs4all.nl&gt;\nAyke van Laethem &lt;aykevanlaethem@gmail.com&gt;" },
77 { "pl", "Wojciech Świderski &lt;woj.swiderski@gmail.com&gt;"},
78 { "pt_BR", "Alexandra Moreire &lt;alexandream@gmail.com&gt;\n"
79 "Adrovane Marques Kade &lt;adrovane@gmail.com&gt;\n"
80 "Rafael Peregrino da Silva &lt;rperegrino@linuxnewmedia.com.br&gt;"},
81 { "ro", "Alex Eftimie &lt;alex@rosedu.org&gt;" },
82 { "ru", "brahmann_ &lt;brahmann@lifec0re.net&gt;,\nNikita E. Shalaev &lt;nshalaev@eu.spb.ru&gt;" },
83 { "sk", "Tomáš Vadina &lt;kyberdev@gmail.com&gt;" },
84 { "sl", "Jože Klepec &lt;joze.klepec@siol.net&gt;"},
85 { "sv", "Tony Mattsson &lt;superxorn@gmail.com&gt;" },
86 { "sr", "Nikola Radovanovic &lt;cobisimo@gmail.com&gt;"},
87 { "tr", "Gürkan Gür &lt;seqizz@gmail.com&gt;"},
88 { "uk", "Boris Dibrov &lt;dibrov.bor@gmail.com&gt;" },
89 { "vi_VN", "Clytie Siddall &lt;clytie@riverland.net.au&gt;" },
90 { "zh_CN", "Dormouse Young &lt;mouselinux@163.com&gt;,\nXhacker Liu &lt;liu.dongyuan@gmail.com&gt;" },
91 { "zh_TW", "KoViCH &lt;kovich.ian@gmail.com&gt;\nWei-Lun Chao &lt;chaoweilun@gmail.com&gt;" }
93 static const guint translators_len = G_N_ELEMENTS(translators);
95 static const gchar *prev_translators[][2] = {
96 { "es", "Damián Viano &lt;debian@damianv.com.ar&gt;\nNacho Cabanes &lt;ncabanes@gmail.com&gt;" },
97 { "pl", "Jacek Wolszczak &lt;shutdownrunner@o2.pl&gt;\nJarosław Foksa &lt;jfoksa@gmail.com&gt;" },
98 { "nl", "Kurt De Bree &lt;kdebree@telenet.be&gt;" }
100 static const guint prev_translators_len = G_N_ELEMENTS(prev_translators);
102 static const gchar *contributors =
103 "Adam Ples, "
104 "Alexander Rodin, Alexey Antipov, Andrew Rowland, Anh Phạm, blackdog, Bo Lorentsen, Bob Doan, "
105 "Bronisław Białek, Can Koy, Catalin Marinas, "
106 "Chris Macksey, Christoph Berg, Colomban Wendling, Conrad Steenberg, Daniel Richard G., "
107 "Daniel Marjamaki, Dave Moore, "
108 "Dimitar Zhekov, Dirk Weber, Elias Pschernig, Eric Forgeot, "
109 "Erik de Castro Lopo, Eugene Arshinov, Felipe Pena, François Cami, "
110 "Giuseppe Torelli, Guillaume de Rorthais, Guillaume Hoffmann, Herbert Voss, Jason Oster, "
111 "Jean-François Wauthy, Jeff Pohlmeyer, Jesse Mayes, Jiří Techet, "
112 "John Gabriele, Jon Senior, Jon Strait, Josef Whiter, "
113 "Jörn Reder, Kelvin Gardiner, Kevin Ellwood, Kristoffer A. Tjernås, Lex Trotman, "
114 "Manuel Bua, Mário Silva, Marko Peric, Matthew Brush, Matti Mårds, "
115 "Moritz Barsnick, Nicolas Sierro, Ondrej Donek, Peter Strand, Philipp Gildein, "
116 "Pierre Joye, Rob van der Linde, "
117 "Robert McGinley, Roland Baudin, Ross McKay, S Jagannathan, Saleem Abdulrasool, "
118 "Sebastian Kraft, Shiv, Slava Semushin, Stefan Oltmanns, Tamim, Taylor Venable, "
119 "Thomas Huth, Thomas Martitz, Tomás Vírseda, "
120 "Tyler Mulligan, Walery Studennikov, Yura Siamashka";
123 static void header_eventbox_style_set(GtkWidget *widget);
124 static void header_label_style_set(GtkWidget *widget);
125 static void homepage_clicked(GtkButton *button, gpointer data);
128 #define ROW(text, row, col, x_align, y_padding, col_span) \
129 label = gtk_label_new((text)); \
130 gtk_table_attach(GTK_TABLE(table), label, (col), (col) + (col_span) + 1, (row), (row) + 1, \
131 (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, (y_padding)); \
132 gtk_label_set_use_markup(GTK_LABEL(label), TRUE); \
133 gtk_misc_set_alignment(GTK_MISC(label), (x_align), 0);
136 static GtkWidget *create_dialog(void)
138 GtkWidget *dialog;
139 GtkWidget *header_image;
140 GtkWidget *header_label;
141 GtkWidget *label_info;
142 GtkWidget *codename_label;
143 GtkWidget *builddate_label;
144 GtkWidget *url_button;
145 GtkWidget *cop_label;
146 GtkWidget *label;
147 GtkWidget *license_textview;
148 GtkWidget *notebook;
149 GtkWidget *box;
150 GtkWidget *credits_scrollwin;
151 GtkWidget *table;
152 GtkWidget *license_scrollwin;
153 GtkWidget *info_box;
154 GtkWidget *header_hbox;
155 GtkWidget *header_eventbox;
156 GtkTextBuffer* tb;
157 gchar *license_text = NULL;
158 gchar buffer[512];
159 gchar buffer2[128];
160 guint i, row = 0;
161 gchar *build_date;
163 dialog = gtk_dialog_new();
165 /* configure dialog */
166 gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(main_widgets.window));
167 gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT);
168 gtk_window_set_title(GTK_WINDOW(dialog), _("About Geany"));
169 gtk_window_set_icon_name(GTK_WINDOW(dialog), "geany");
170 gtk_widget_set_name(dialog, "GeanyDialog");
171 gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
172 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_CLOSE);
173 g_signal_connect(dialog, "key-press-event", G_CALLBACK(gb_on_key_pressed), NULL);
175 /* create header */
176 header_eventbox = gtk_event_box_new();
177 gtk_widget_show(header_eventbox);
178 header_hbox = gtk_hbox_new(FALSE, 12);
179 gtk_container_set_border_width(GTK_CONTAINER(header_hbox), 4);
180 gtk_widget_show(header_hbox);
181 gtk_container_add(GTK_CONTAINER(header_eventbox), header_hbox);
182 header_image = gtk_image_new_from_icon_name("geany", GTK_ICON_SIZE_DIALOG);
183 gtk_box_pack_start(GTK_BOX(header_hbox), header_image, FALSE, FALSE, 0);
184 header_label = gtk_label_new(NULL);
185 gtk_label_set_use_markup(GTK_LABEL(header_label), TRUE);
186 /* print the subversion revision generated by ./configure if it is available */
187 g_snprintf(buffer, sizeof(buffer), HEADER, main_get_version_string());
188 gtk_label_set_markup(GTK_LABEL(header_label), buffer);
189 gtk_widget_show(header_label);
190 gtk_box_pack_start(GTK_BOX(header_hbox), header_label, FALSE, FALSE, 0);
191 header_eventbox_style_set(header_eventbox);
192 header_label_style_set(header_label);
193 g_signal_connect_after(header_eventbox, "style-set", G_CALLBACK(header_eventbox_style_set), NULL);
194 g_signal_connect_after(header_label, "style-set", G_CALLBACK(header_label_style_set), NULL);
195 gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), header_eventbox, FALSE, FALSE, 0);
197 /* create notebook */
198 notebook = gtk_notebook_new();
199 gtk_widget_show(notebook);
200 gtk_container_set_border_width(GTK_CONTAINER(notebook), 2);
201 gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), notebook, TRUE, TRUE, 0);
203 /* create "Info" tab */
204 info_box = gtk_vbox_new(FALSE, 0);
205 gtk_container_set_border_width(GTK_CONTAINER(info_box), 6);
206 gtk_widget_show(info_box);
208 label_info = gtk_label_new(NULL);
209 gtk_label_set_justify(GTK_LABEL(label_info), GTK_JUSTIFY_CENTER);
210 gtk_label_set_selectable(GTK_LABEL(label_info), TRUE);
211 gtk_label_set_use_markup(GTK_LABEL(label_info), TRUE);
212 g_snprintf(buffer, sizeof(buffer), INFO, _("A fast and lightweight IDE"));
213 gtk_label_set_markup(GTK_LABEL(label_info), buffer);
214 gtk_misc_set_padding(GTK_MISC(label_info), 2, 11);
215 gtk_widget_show(label_info);
216 gtk_box_pack_start(GTK_BOX(info_box), label_info, FALSE, FALSE, 0);
218 /* Codename label */
219 codename_label = gtk_label_new(NULL);
220 gtk_label_set_justify(GTK_LABEL(codename_label), GTK_JUSTIFY_CENTER);
221 gtk_label_set_selectable(GTK_LABEL(codename_label), TRUE);
222 gtk_label_set_use_markup(GTK_LABEL(codename_label), TRUE);
223 gtk_label_set_markup(GTK_LABEL(codename_label), CODENAME);
224 gtk_misc_set_padding(GTK_MISC(codename_label), 2, 8);
225 gtk_widget_show(codename_label);
226 gtk_box_pack_start(GTK_BOX(info_box), codename_label, FALSE, FALSE, 0);
228 /* build date label */
229 builddate_label = gtk_label_new(NULL);
230 gtk_label_set_justify(GTK_LABEL(builddate_label), GTK_JUSTIFY_CENTER);
231 gtk_label_set_selectable(GTK_LABEL(builddate_label), TRUE);
232 gtk_label_set_use_markup(GTK_LABEL(builddate_label), TRUE);
233 build_date = utils_parse_and_format_build_date(__DATE__);
234 g_snprintf(buffer2, sizeof(buffer2), _("(built on or after %s)"), build_date);
235 g_free(build_date);
236 g_snprintf(buffer, sizeof(buffer), BUILDDATE, buffer2);
237 gtk_label_set_markup(GTK_LABEL(builddate_label), buffer);
238 gtk_misc_set_padding(GTK_MISC(builddate_label), 2, 2);
239 gtk_widget_show(builddate_label);
240 gtk_box_pack_start(GTK_BOX(info_box), builddate_label, FALSE, FALSE, 0);
242 box = gtk_hbutton_box_new();
243 url_button = gtk_button_new();
244 gtk_button_set_relief(GTK_BUTTON(url_button), GTK_RELIEF_NONE);
245 g_signal_connect(url_button, "clicked", G_CALLBACK(homepage_clicked), (gpointer)GEANY_HOMEPAGE);
246 label = gtk_label_new(NULL);
247 gtk_label_set_text(GTK_LABEL(label), GEANY_HOMEPAGE);
248 gtk_widget_show(label);
249 gtk_container_add(GTK_CONTAINER(url_button), label);
250 gtk_widget_show(url_button);
251 gtk_box_pack_start(GTK_BOX(box), url_button, FALSE, FALSE, 0);
252 gtk_widget_show(box);
253 gtk_box_pack_start(GTK_BOX(info_box), box, FALSE, FALSE, 10);
255 /* copyright label */
256 cop_label = gtk_label_new(NULL);
257 gtk_label_set_justify(GTK_LABEL(cop_label), GTK_JUSTIFY_CENTER);
258 gtk_label_set_selectable(GTK_LABEL(cop_label), FALSE);
259 gtk_label_set_use_markup(GTK_LABEL(cop_label), TRUE);
260 gtk_label_set_markup(GTK_LABEL(cop_label), COPYRIGHT);
261 gtk_misc_set_padding(GTK_MISC(cop_label), 2, 10);
262 gtk_widget_show(cop_label);
263 gtk_box_pack_start(GTK_BOX(info_box), cop_label, FALSE, FALSE, 0);
264 /*gtk_container_add(GTK_CONTAINER(info_box), cop_label); */
266 label = gtk_label_new(_("Info"));
267 gtk_widget_show(label);
268 gtk_widget_show_all(info_box);
269 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), info_box, label);
271 /* create "Credits" tab */
272 credits_scrollwin = gtk_scrolled_window_new(NULL, NULL);
273 gtk_container_set_border_width(GTK_CONTAINER(credits_scrollwin), 6);
274 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(credits_scrollwin),
275 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
277 table = gtk_table_new(23 + translators_len + prev_translators_len, 3, FALSE);
278 gtk_table_set_col_spacings(GTK_TABLE(table), 10);
280 row = 0;
281 g_snprintf(buffer, sizeof(buffer),
282 "<span size=\"larger\" weight=\"bold\">%s</span>", _("Developers"));
283 label = gtk_label_new(buffer);
284 gtk_table_attach(GTK_TABLE(table), label, 0, 2, row, row + 1, GTK_FILL, 0, 0, 5);
285 gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
286 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
287 row++;
289 g_snprintf(buffer, sizeof(buffer), "Colomban Wendling - %s", _("maintainer"));
290 ROW(buffer, row, 0, 0, 0, 1);
291 row++;
292 ROW("&lt;lists.ban@herbesfolles.org&gt;", row, 0, 0, 0, 1);
293 row++;
294 ROW("", row, 0, 0, 0, 0);
295 row++;
297 g_snprintf(buffer, sizeof(buffer), "Nick Treleaven - %s", _("developer"));
298 ROW(buffer, row, 0, 0, 0, 1);
299 row++;
300 ROW("&lt;nick.treleaven@btinternet.com&gt;", row, 0, 0, 0, 1);
301 row++;
302 ROW("", row, 0, 0, 0, 0);
303 row++;
305 g_snprintf(buffer, sizeof(buffer), "Enrico Tröger - %s", _("developer"));
306 ROW(buffer, row, 0, 0, 0, 1);
307 row++;
308 ROW("&lt;enrico.troeger@uvena.de&gt;", row, 0, 0, 0, 1);
309 row++;
310 ROW("", row, 0, 0, 0, 0);
311 row++;
313 g_snprintf(buffer, sizeof(buffer), "Matthew Brush - %s", _("developer"));
314 ROW(buffer, row, 0, 0, 0, 1);
315 row++;
316 ROW("&lt;mbrush@codebrainz.ca&gt;", row, 0, 0, 0, 1);
317 row++;
318 ROW("", row, 0, 0, 0, 0);
319 row++;
321 g_snprintf(buffer, sizeof(buffer), "Frank Lanitz - %s", _("translation maintainer"));
322 ROW(buffer, row, 0, 0, 0, 1);
323 row++;
324 ROW("&lt;frank@frank.uvena.de&gt;", row, 0, 0, 0, 1);
325 row++;
326 ROW("", row, 0, 0, 0, 0);
327 row++;
329 g_snprintf(buffer, sizeof(buffer),
330 "<span size=\"larger\" weight=\"bold\">%s</span>", _("Translators"));
331 label = gtk_label_new(buffer);
332 gtk_table_attach(GTK_TABLE(table), label, 0, 2, row, row + 1,
333 (GtkAttachOptions) (GTK_FILL),
334 (GtkAttachOptions) (0), 0, 5);
335 gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
336 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
337 row++;
339 for (i = 0; i < translators_len; i++)
341 ROW(translators[i][0], row, 0, 1, 4, 0);
342 ROW(translators[i][1], row, 1, 0, 4, 0);
343 row++;
346 ROW("", row, 0, 0, 0, 0);
347 row++;
349 g_snprintf(buffer, sizeof(buffer),
350 "<span size=\"larger\" weight=\"bold\">%s</span>", _("Previous Translators"));
351 label = gtk_label_new(buffer);
352 gtk_table_attach(GTK_TABLE(table), label, 0, 2, row, row + 1,
353 (GtkAttachOptions) (GTK_FILL),
354 (GtkAttachOptions) (0), 0, 5);
355 gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
356 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
357 row++;
359 for (i = 0; i < prev_translators_len; i++)
361 ROW(prev_translators[i][0], row, 0, 1, 4, 0);
362 ROW(prev_translators[i][1], row, 1, 0, 4, 0);
363 row++;
367 ROW("", row, 0, 0, 0, 0);
368 row++;
370 g_snprintf(buffer, sizeof(buffer),
371 "<span size=\"larger\" weight=\"bold\">%s</span>", _("Contributors"));
372 label = gtk_label_new(buffer);
373 gtk_table_attach(GTK_TABLE(table), label, 0, 2, row, row + 1,
374 (GtkAttachOptions) (GTK_FILL),
375 (GtkAttachOptions) (0), 0, 5);
376 gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
377 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
378 row++;
380 g_snprintf(buffer, sizeof(buffer),
381 _("Some of the many contributors (for a more detailed list, see the file %s):"),
382 #ifdef G_OS_WIN32
383 "Thanks.txt"
384 #else
385 "THANKS"
386 #endif
388 label = geany_wrap_label_new(buffer);
389 gtk_table_attach(GTK_TABLE(table), label, 0, 2, row, row + 1,
390 (GtkAttachOptions) (GTK_FILL),
391 (GtkAttachOptions) (0), 0, 5);
392 gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
393 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
394 row++;
396 label = geany_wrap_label_new(contributors);
397 gtk_table_attach(GTK_TABLE(table), label, 0, 2, row, row + 1,
398 (GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
399 (GtkAttachOptions) (0), 0, 5);
400 gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
401 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
402 row++;
404 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(credits_scrollwin), table);
405 gtk_viewport_set_shadow_type(GTK_VIEWPORT(gtk_widget_get_parent(table)), GTK_SHADOW_NONE);
406 gtk_widget_show_all(table);
407 label = gtk_label_new(_("Credits"));
408 gtk_widget_show(label);
409 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), credits_scrollwin, label);
411 /* create "License" tab */
412 license_scrollwin = gtk_scrolled_window_new(NULL, NULL);
413 gtk_container_set_border_width(GTK_CONTAINER(license_scrollwin), 6);
414 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(license_scrollwin),
415 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
416 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(license_scrollwin), GTK_SHADOW_IN);
417 license_textview = gtk_text_view_new();
418 gtk_text_view_set_left_margin(GTK_TEXT_VIEW(license_textview), 2);
419 gtk_text_view_set_right_margin(GTK_TEXT_VIEW(license_textview), 2);
420 gtk_text_view_set_editable(GTK_TEXT_VIEW(license_textview), FALSE);
421 gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(license_textview), FALSE);
422 gtk_widget_show(license_textview);
423 gtk_container_add(GTK_CONTAINER(license_scrollwin), license_textview);
424 label = gtk_label_new(_("License"));
425 gtk_widget_show(label);
427 g_snprintf(buffer, sizeof(buffer), "%s" G_DIR_SEPARATOR_S "GPL-2", app->datadir);
429 g_file_get_contents(buffer, &license_text, NULL, NULL);
430 if (license_text == NULL)
432 license_text = g_strdup(
433 _("License text could not be found, please visit http://www.gnu.org/licenses/gpl-2.0.txt to view it online."));
435 tb = gtk_text_view_get_buffer(GTK_TEXT_VIEW(license_textview));
436 gtk_text_buffer_set_text(tb, license_text, -1);
438 g_free(license_text);
440 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), license_scrollwin, label);
442 gtk_widget_show_all(dialog);
443 return dialog;
447 void about_dialog_show(void)
449 GtkWidget *dialog;
451 dialog = create_dialog();
453 gtk_dialog_run(GTK_DIALOG(dialog));
454 gtk_widget_destroy(dialog);
458 static void header_eventbox_style_set(GtkWidget *widget)
460 GtkStyle *style = gtk_widget_get_style(widget);
461 if (! gdk_color_equal(&style->bg[GTK_STATE_NORMAL], &style->bg[GTK_STATE_SELECTED]))
462 gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &style->bg[GTK_STATE_SELECTED]);
466 static void header_label_style_set(GtkWidget *widget)
468 GtkStyle *style = gtk_widget_get_style(widget);
469 if (! gdk_color_equal(&style->fg[GTK_STATE_NORMAL], &style->fg[GTK_STATE_SELECTED]))
470 gtk_widget_modify_fg(widget, GTK_STATE_NORMAL, &style->fg[GTK_STATE_SELECTED]);
474 static void homepage_clicked(GtkButton *button, gpointer data)
476 utils_open_browser(data);