[gaim-migrate @ 2952]
[pidgin-git.git] / src / about.c
blobb1ce1d0932eccf0be6ac40bfc1a240725809d0fd
1 /*
2 * gaim
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25 #include <string.h>
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <time.h>
30 #include <gtk/gtk.h>
31 #include "gaim.h"
32 #include "pixmaps/logo.xpm"
33 #include "pixmaps/cancel.xpm"
34 #include "pixmaps/about_small.xpm"
36 static GtkWidget *about = NULL;
38 static void destroy_about()
40 if (about)
41 gtk_widget_destroy(about);
42 about = NULL;
46 static void version_exit()
48 gtk_main_quit();
52 static void about_click(GtkWidget *w, gpointer m)
54 open_url(NULL, WEBSITE);
57 char *name()
59 return PACKAGE;
62 char *description()
64 return WEBSITE;
67 char *version()
69 return VERSION;
72 void show_about(GtkWidget *w, void *null)
74 GtkWidget *vbox;
75 GtkWidget *frame;
76 GtkWidget *fbox;
77 GtkWidget *label;
78 GtkWidget *pixmap;
79 GtkStyle *style;
80 GdkPixmap *pm;
81 GdkBitmap *bm;
82 GtkWidget *hbox;
83 GtkWidget *button;
84 GtkWidget *text;
86 char abouttitle[45];
88 if (!about) {
90 GAIM_DIALOG(about);
91 gtk_window_set_default_size(GTK_WINDOW(about), 450, -1);
92 g_snprintf(abouttitle, sizeof(abouttitle), _("About Gaim v%s"), VERSION);
93 gtk_window_set_title(GTK_WINDOW(about), abouttitle);
94 gtk_window_set_wmclass(GTK_WINDOW(about), "about", "Gaim");
95 gtk_window_set_policy(GTK_WINDOW(about), FALSE, TRUE, TRUE);
96 gtk_widget_realize(about);
97 aol_icon(about->window);
99 vbox = gtk_vbox_new(FALSE, 5);
100 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
101 gtk_container_add(GTK_CONTAINER(about), vbox);
102 gtk_widget_show(vbox);
104 frame = gtk_frame_new("Gaim v" VERSION);
105 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
106 gtk_widget_show(frame);
108 fbox = gtk_vbox_new(FALSE, 5);
109 gtk_container_set_border_width(GTK_CONTAINER(fbox), 5);
110 gtk_container_add(GTK_CONTAINER(frame), fbox);
111 gtk_widget_show(fbox);
113 /* Left side, TOP */
114 style = gtk_widget_get_style(about);
115 pm = gdk_pixmap_create_from_xpm_d(about->window, &bm,
116 &style->bg[GTK_STATE_NORMAL], (gchar **)gaim_logo_xpm);
117 pixmap = gtk_pixmap_new(pm, bm);
118 gdk_pixmap_unref(pm);
119 gdk_bitmap_unref(bm);
120 gtk_box_pack_start(GTK_BOX(fbox), pixmap, FALSE, FALSE, 0);
121 gtk_widget_show(pixmap);
123 label =
124 gtk_label_new(
125 _("Gaim is a client that supports AOL's Instant Messenger protocol. It is written\n"
126 "using Gtk+ and is licensed under the GPL.\n\n" "URL: " WEBSITE "\n\n"
127 "IRC: #gaim on irc.openprojects.net"));
129 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
130 gtk_box_pack_start(GTK_BOX(fbox), label, TRUE, TRUE, 0);
131 gtk_widget_show(label);
133 text = gtk_text_new(NULL, NULL);
134 gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL,
135 _("Rob Flynn (maintainer) rob@marko.net\nEric Warmenhoven warmenhoven@yahoo.com\n\nBenjamin Miller\nDecklin Foster\nSean Egan\nJim Duchek\nMark Spencer (original author) markster@marko.net"),
136 194);
137 gtk_box_pack_start(GTK_BOX(fbox), text, TRUE, TRUE, 0);
138 gtk_widget_show(text);
140 /* Close Button */
142 hbox = gtk_hbox_new(FALSE, 5);
143 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
144 gtk_widget_show(hbox);
146 button = picture_button(about, _("Close"), cancel_xpm);
147 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
149 if (null != (void *)2) {
150 /* 2 can be as sad as 1, it's the loneliest number since the number 1 */
151 gtk_signal_connect_object(GTK_OBJECT(button), "clicked",
152 GTK_SIGNAL_FUNC(destroy_about), GTK_OBJECT(about));
153 gtk_signal_connect(GTK_OBJECT(about), "destroy",
154 GTK_SIGNAL_FUNC(destroy_about), GTK_OBJECT(about));
155 } else {
156 gtk_signal_connect(GTK_OBJECT(button), "clicked",
157 GTK_SIGNAL_FUNC(version_exit), NULL);
158 gtk_signal_connect(GTK_OBJECT(about), "destroy",
159 GTK_SIGNAL_FUNC(version_exit), NULL);
162 /* this makes the sizes not work. */
163 /* GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); */
164 /* gtk_widget_grab_default(button); */
166 button = picture_button(about, _("Web Site"), about_small_xpm);
167 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
168 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(about_click), NULL);
171 /* Let's give'em something to talk about -- woah woah woah */
172 gtk_widget_show(about);
174 gdk_window_raise(about->window);