1 /* -*- Mode: C ; c-basic-offset: 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>
34 #include "gtk_builder.h"
36 #define ABOUT_DIALOG_LOGO "ladish-logo-128x128.png"
38 static char * read_file_contents(const char * filename
)
44 if (stat(filename
, &st
) != 0)
49 fd
= open(filename
, O_RDONLY
);
55 buffer
= malloc(st
.st_size
+ 1);
62 if (read(fd
, buffer
, (size_t)st
.st_size
) != (ssize_t
)st
.st_size
)
69 buffer
[st
.st_size
] = 0;
81 const char * authors
[] = {"Nedko Arnaudov", "Nikita Zlobin", NULL
};
82 const char * artists
[] = {"Lapo Calamandrei", "Nadejda Pancheva-Arnaudova", NULL
};
85 pixbuf
= load_pixbuf(ABOUT_DIALOG_LOGO
);
86 license
= read_file_contents(DATA_DIR
"/COPYING");
88 dialog
= get_gtk_builder_widget("about_win");
89 gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog
), PACKAGE_VERSION
);
93 gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(dialog
), pixbuf
);
94 g_object_unref(pixbuf
);
99 gtk_about_dialog_set_license(GTK_ABOUT_DIALOG(dialog
), license
);
103 gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(dialog
), authors
);
104 gtk_about_dialog_set_artists(GTK_ABOUT_DIALOG(dialog
), artists
);
106 gtk_widget_show(dialog
);
107 gtk_dialog_run(GTK_DIALOG(dialog
));
108 gtk_widget_hide(dialog
);