Crossfire Client, Branches  R11627
about.c
Go to the documentation of this file.
1 const char * const rcsid_gtk2_about_c =
2  "$Id: about.c 9204 2008-06-01 18:01:36Z anmaster $";
3 /*
4  Crossfire client, a client program for the crossfire program.
5 
6  Copyright (C) 2006 Mark Wedel & Crossfire Development Team
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 
22  The author can be reached via e-mail to crossfire@metalforge.org
23 */
24 
30 #ifdef HAVE_CONFIG_H
31 # include <config.h>
32 #endif
33 
34 #include <gtk/gtk.h>
35 #include <glade/glade.h>
36 #include <ctype.h>
37 
38 #include "client.h"
39 
40 #include "main.h"
41 #include "image.h"
42 #include "gtk2proto.h"
43 #include "about.h"
44 #include "../../pixmaps/crossfiretitle.xpm"
45 
46 static GtkWidget *about_window=NULL;
47 
54 void
55 menu_about (GtkMenuItem *menuitem,
56  gpointer user_data)
57 {
58  GladeXML *xml_tree;
59  GtkWidget *widget;
60 
61  if (!about_window) {
62  GtkWidget *textview;
63  GtkTextBuffer *textbuf;
64  GtkTextIter end;
65  GtkWidget *hbox;
66  GtkWidget *aboutgtkpixmap;
67  GdkPixmap *aboutgdkpixmap;
68  GdkBitmap *aboutgdkmask;
69 
70  about_window = glade_xml_get_widget(dialog_xml, "about_window");
71  xml_tree = glade_get_widget_tree(GTK_WIDGET(about_window));
72 
73  textview = glade_xml_get_widget(xml_tree, "about_textview");
74 
75  widget = glade_xml_get_widget(xml_tree, "about_close");
76  g_signal_connect ((gpointer) widget, "clicked",
77  G_CALLBACK (on_about_close_clicked), NULL);
78 
79  textbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
80 
81  gtk_text_buffer_get_end_iter(textbuf, &end);
82  gtk_text_buffer_insert(textbuf, &end, VERSION_INFO,
83  strlen(VERSION_INFO));
84  gtk_text_buffer_insert(textbuf, &end, "\n", 1);
85  gtk_text_buffer_insert(textbuf, &end, text, strlen(text));
86 
87  /* The window must be realized before we can create the pixmap below */
88  gtk_widget_show(about_window);
89 
90  aboutgdkpixmap = gdk_pixmap_create_from_xpm_d(about_window->window,
91  &aboutgdkmask,
92  NULL,
93  (gchar **)crossfiretitle_xpm);
94 
95  aboutgtkpixmap= gtk_image_new_from_pixmap (aboutgdkpixmap,
96  aboutgdkmask);
97  /*
98  * Use of hbox is a bit of a hack - isn't any easy way to add this
99  * image as the first entry of the box once other fields have been
100  * filled in. So instead, we create a hbox in that first entry just to
101  * hold this image.
102  */
103  hbox = glade_xml_get_widget(xml_tree, "about_hbox_image");
104 
105  gtk_box_pack_start (GTK_BOX (hbox),aboutgtkpixmap, TRUE, TRUE, 0);
106 
107  gtk_widget_show(aboutgtkpixmap);
108 
109  } else {
110  gtk_widget_show(about_window);
111  }
112 
113 }
114 
121 void
122 on_about_close_clicked (GtkButton *button,
123  gpointer user_data)
124 {
125  gtk_widget_hide(about_window);
126 }
void menu_about(GtkMenuItem *menuitem, gpointer user_data)
Definition: about.c:55
GladeXML * dialog_xml
Definition: main.c:57
#define TRUE
Definition: client-types.h:71
const char *const rcsid_gtk2_about_c
Definition: about.c:1
gchar * text
Definition: about.h:2
void on_about_close_clicked(GtkButton *button, gpointer user_data)
Definition: about.c:122
char VERSION_INFO[256]
Definition: client.c:59
static GtkWidget * about_window
Definition: about.c:46