~ubuntu-branches/ubuntu/maverick/crossfire-client/maverick

« back to all changes in this revision

Viewing changes to gtk-v2/src/about.c

  • Committer: Bazaar Package Importer
  • Author(s): Kari Pahula
  • Date: 2007-04-13 21:15:44 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070413211544-vjo6zesj6g0wgmwf
Tags: 1.10.0-1
* New upstream release
* Install the README, README-dev and TODO files specific to the GTK2
  client to the corresponding package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
char *rcsid_gtk2_about_c =
 
2
    "$Id: about.c 4664 2006-07-05 05:21:08Z mwedel $";
 
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
 
 
25
 
 
26
/* This file is here to cover configuration issues.
 
27
 */
 
28
#ifdef HAVE_CONFIG_H
 
29
#  include <config.h>
 
30
#endif
 
31
 
 
32
#include <gtk/gtk.h>
 
33
#include <ctype.h>
 
34
 
 
35
#include "client.h"
 
36
 
 
37
#include "interface.h"
 
38
#include "support.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
 
 
47
static GtkWidget   *about_window=NULL;
 
48
 
 
49
void
 
50
menu_about                       (GtkMenuItem     *menuitem,
 
51
                                        gpointer         user_data)
 
52
{
 
53
    if (!about_window) {
 
54
        GtkWidget   *textview;
 
55
        GtkTextBuffer   *textbuf;
 
56
        GtkTextIter end;
 
57
        GtkWidget *hbox;
 
58
        GtkWidget *aboutgtkpixmap;
 
59
        GdkPixmap *aboutgdkpixmap;
 
60
        GdkBitmap *aboutgdkmask;
 
61
 
 
62
        
 
63
        about_window=create_about_window();
 
64
 
 
65
        textview = lookup_widget(about_window, "about_textview");
 
66
        textbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
 
67
 
 
68
        gtk_text_buffer_get_end_iter(textbuf, &end);
 
69
        gtk_text_buffer_insert(textbuf, &end, VERSION_INFO, strlen(VERSION_INFO));
 
70
        gtk_text_buffer_insert(textbuf, &end, "\n", 1);
 
71
        gtk_text_buffer_insert(textbuf, &end, text, strlen(text));
 
72
 
 
73
        /* The window must be realized before we can create the pixmap below */
 
74
        gtk_widget_show(about_window);
 
75
 
 
76
        aboutgdkpixmap = gdk_pixmap_create_from_xpm_d(about_window->window,
 
77
                                                  &aboutgdkmask,
 
78
                                                  NULL,
 
79
                                                  (gchar **)crossfiretitle);
 
80
        aboutgtkpixmap= gtk_image_new_from_pixmap (aboutgdkpixmap, aboutgdkmask);
 
81
 
 
82
        /* Use of hbox is a bit of a hack - isn't any easy way to add
 
83
         * this image as the first entry of the box once other fields have been
 
84
         * filled in.  So instead, we create a hbox in that first entry just
 
85
         * to hold this image.
 
86
         */
 
87
        hbox = lookup_widget(about_window, "about_hbox_image");
 
88
        gtk_box_pack_start (GTK_BOX (hbox),aboutgtkpixmap, TRUE, TRUE, 0);
 
89
 
 
90
        gtk_widget_show(aboutgtkpixmap);
 
91
 
 
92
    } else {
 
93
        gtk_widget_show(about_window);
 
94
    }
 
95
 
 
96
}
 
97
 
 
98
 
 
99
void
 
100
on_about_close_clicked                 (GtkButton       *button,
 
101
                                        gpointer         user_data)
 
102
{
 
103
    gtk_widget_hide(about_window);
 
104
}
 
105