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