Crossfire Client, Branch
R11627
|
00001 const char * const rcsid_gtk2_about_c = 00002 "$Id: about.c 9204 2008-06-01 18:01:36Z anmaster $"; 00003 /* 00004 Crossfire client, a client program for the crossfire program. 00005 00006 Copyright (C) 2006 Mark Wedel & Crossfire Development Team 00007 00008 This program is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2 of the License, or 00011 (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program; if not, write to the Free Software 00020 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00021 00022 The author can be reached via e-mail to crossfire@metalforge.org 00023 */ 00024 00030 #ifdef HAVE_CONFIG_H 00031 # include <config.h> 00032 #endif 00033 00034 #include <gtk/gtk.h> 00035 #include <glade/glade.h> 00036 #include <ctype.h> 00037 00038 #include "client.h" 00039 00040 #include "main.h" 00041 #include "image.h" 00042 #include "gtk2proto.h" 00043 #include "about.h" 00044 #include "../../pixmaps/crossfiretitle.xpm" 00045 00046 static GtkWidget *about_window=NULL; 00047 00054 void 00055 menu_about (GtkMenuItem *menuitem, 00056 gpointer user_data) 00057 { 00058 GladeXML *xml_tree; 00059 GtkWidget *widget; 00060 00061 if (!about_window) { 00062 GtkWidget *textview; 00063 GtkTextBuffer *textbuf; 00064 GtkTextIter end; 00065 GtkWidget *hbox; 00066 GtkWidget *aboutgtkpixmap; 00067 GdkPixmap *aboutgdkpixmap; 00068 GdkBitmap *aboutgdkmask; 00069 00070 about_window = glade_xml_get_widget(dialog_xml, "about_window"); 00071 xml_tree = glade_get_widget_tree(GTK_WIDGET(about_window)); 00072 00073 textview = glade_xml_get_widget(xml_tree, "about_textview"); 00074 00075 widget = glade_xml_get_widget(xml_tree, "about_close"); 00076 g_signal_connect ((gpointer) widget, "clicked", 00077 G_CALLBACK (on_about_close_clicked), NULL); 00078 00079 textbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); 00080 00081 gtk_text_buffer_get_end_iter(textbuf, &end); 00082 gtk_text_buffer_insert(textbuf, &end, VERSION_INFO, 00083 strlen(VERSION_INFO)); 00084 gtk_text_buffer_insert(textbuf, &end, "\n", 1); 00085 gtk_text_buffer_insert(textbuf, &end, text, strlen(text)); 00086 00087 /* The window must be realized before we can create the pixmap below */ 00088 gtk_widget_show(about_window); 00089 00090 aboutgdkpixmap = gdk_pixmap_create_from_xpm_d(about_window->window, 00091 &aboutgdkmask, 00092 NULL, 00093 (gchar **)crossfiretitle_xpm); 00094 00095 aboutgtkpixmap= gtk_image_new_from_pixmap (aboutgdkpixmap, 00096 aboutgdkmask); 00097 /* 00098 * Use of hbox is a bit of a hack - isn't any easy way to add this 00099 * image as the first entry of the box once other fields have been 00100 * filled in. So instead, we create a hbox in that first entry just to 00101 * hold this image. 00102 */ 00103 hbox = glade_xml_get_widget(xml_tree, "about_hbox_image"); 00104 00105 gtk_box_pack_start (GTK_BOX (hbox),aboutgtkpixmap, TRUE, TRUE, 0); 00106 00107 gtk_widget_show(aboutgtkpixmap); 00108 00109 } else { 00110 gtk_widget_show(about_window); 00111 } 00112 00113 } 00114 00121 void 00122 on_about_close_clicked (GtkButton *button, 00123 gpointer user_data) 00124 { 00125 gtk_widget_hide(about_window); 00126 }