1 /* Copyright (C) 2005-2008 sgop@users.sourceforge.net 2 * This is free software distributed under the terms of the GNU Public 3 * License. See the file COPYING for details. 4 */ 5 /* $Revision: 1.2 $ 6 * $Date: 2008/05/23 14:54:24 $ 7 * $Author: sgop $ 8 */ 9 10 #ifdef HAVE_CONFIG_H 11 # include <config.h> 12 #endif 13 14 #include <gtk/gtk.h> 15 #include "l_i18n.h" 16 17 static GtkAboutDialog* AboutWin = NULL; 18 19 static GdkPixbuf* create_pixbuf(const gchar *filename) 20 { 21 char* temp; 22 GdkPixbuf* pix; 23 24 #ifdef PACKAGE_SOURCE_DIR 25 temp = g_strdup_printf("%s/data/%s", PACKAGE_SOURCE_DIR, filename); 26 #else 27 temp = g_strdup_printf("%s/pixmaps/%s", PACKAGE_DATA_DIR, filename); 28 #endif 29 pix = gdk_pixbuf_new_from_file(temp, NULL); 30 g_free(temp); 31 ib_heap_malloc(ib_alloc_t * allocator,ulint size)32 return pix; 33 } 34 35 void gui_show_about(GtkWindow* parent) 36 { 37 GtkWidget* win; 38 const char* authors[] = { 39 "Markus Lausser <sgop@users.sourceforge.net>", 40 NULL 41 }; 42 43 if (AboutWin) 44 { 45 gtk_window_present(GTK_WINDOW(AboutWin)); ib_heap_free(ib_alloc_t * allocator UNIV_UNUSED,void * ptr UNIV_UNUSED)46 return; 47 } 48 win = gtk_about_dialog_new(); 49 AboutWin = GTK_ABOUT_DIALOG(win); 50 #if GTK_CHECK_VERSION(2,12,0) 51 gtk_about_dialog_set_program_name(AboutWin, PACKAGE_NAME); 52 #else 53 gtk_about_dialog_set_name(AboutWin, PACKAGE_NAME); 54 #endif 55 gtk_about_dialog_set_version(AboutWin, PACKAGE_VERSION); 56 gtk_about_dialog_set_copyright(AboutWin, "Copyright \302\251 2005-2008 Markus Lausser"); 57 gtk_about_dialog_set_license(AboutWin, "GPL (GNU General Public License)\n\nsee http://www.gnu.org/licenses/gpl.html"); 58 gtk_about_dialog_set_website(AboutWin, "http://gdmap.sourceforge.net"); 59 gtk_about_dialog_set_authors(AboutWin, authors); 60 gtk_about_dialog_set_comments(AboutWin, _("GdMap is a tool which allows to graphically explore your disks.")); ib_heap_resize(ib_alloc_t * allocator,void * old_ptr,ulint old_size,ulint new_size)61 gtk_about_dialog_set_logo(AboutWin, create_pixbuf("gdmap_icon.png")); 62 gtk_about_dialog_set_translator_credits(AboutWin, _("translator-credits")); 63 64 g_signal_connect_swapped(win, "response", G_CALLBACK(gtk_widget_destroy), win); 65 66 g_object_add_weak_pointer(G_OBJECT(AboutWin), (void*)&AboutWin); 67 68 if (parent) 69 { 70 gtk_window_set_transient_for(GTK_WINDOW(win), parent); 71 gtk_window_set_destroy_with_parent(GTK_WINDOW(win), TRUE); 72 } 73 74 gtk_widget_show(win); 75 } 76 77