Add missing header text
[ladish.git] / gui / about.c
blob0669466b092d8d05cd13b00f821955556c6ad92f
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*
3 * LADI Session Handler (ladish)
5 * Copyright (C) 2010 Nedko Arnaudov <nedko@arnaudov.name>
7 **************************************************************************
8 * This file contains the code that implements the about dialog
9 **************************************************************************
11 * LADI Session Handler is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * LADI Session Handler is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with LADI Session Handler. If not, see <http://www.gnu.org/licenses/>
23 * or write to the Free Software Foundation, Inc.,
24 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
27 #include <sys/types.h>
28 #include <sys/stat.h>
29 #include <unistd.h>
30 #include <fcntl.h>
32 #include "about.h"
33 #include "pixbuf.h"
34 #include "gtk_builder.h"
35 #include "version.h"
37 #include "../common/file.h"
38 #include "../common/catdup.h"
40 #define ABOUT_DIALOG_LOGO "ladish-logo-128x128.png"
42 void show_about(void)
44 GtkWidget * dialog;
45 GdkPixbuf * pixbuf;
46 const char * authors[] =
48 _("Nedko Arnaudov"),
49 _("Nikita Zlobin"),
50 _("Filipe Alexandre Lopes Coelho"),
51 NULL
53 const char * artists[] =
55 _("Lapo Calamandrei"),
56 _("Nadejda Pancheva-Arnaudova"),
57 NULL
59 const char * translators_array[] =
61 _("Nikita Zlobin"),
62 _("Alexandre Prokoudine"),
63 _("Olivier Humbert"),
64 _("Frank Kober"),
65 _("Maxim Kachur"),
66 _("Jof Thibaut"),
67 NULL,
69 char * translators;
70 char * license;
71 struct stat st;
72 char timestamp_str[26];
73 char built_str[200];
75 pixbuf = load_pixbuf(ABOUT_DIALOG_LOGO);
76 license = read_file_contents(DATA_DIR "/COPYING");
78 dialog = get_gtk_builder_widget("about_win");
80 st.st_mtime = 0;
81 stat("/proc/self/exe", &st);
82 ctime_r(&st.st_mtime, timestamp_str);
83 timestamp_str[24] = 0;
85 sprintf(built_str, _("gladish is built on %s from %s"), timestamp_str, GIT_VERSION);
87 gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), PACKAGE_VERSION);
88 gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(dialog), built_str);
90 if (pixbuf != NULL)
92 gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(dialog), pixbuf);
93 g_object_unref(pixbuf);
96 if (license != NULL)
98 gtk_about_dialog_set_license(GTK_ABOUT_DIALOG(dialog), license);
99 free(license);
102 gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(dialog), authors);
103 gtk_about_dialog_set_artists(GTK_ABOUT_DIALOG(dialog), artists);
105 translators = catdup_array(translators_array, "\n");
106 if (translators != NULL)
108 gtk_about_dialog_set_translator_credits(GTK_ABOUT_DIALOG(dialog), translators);
111 gtk_widget_show(dialog);
112 gtk_dialog_run(GTK_DIALOG(dialog));
113 gtk_widget_hide(dialog);