2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2001 Hiroyuki Yamamoto
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 #include <gdk/gdkkeysyms.h>
28 #include <gtk/gtkwidget.h>
29 #include <gtk/gtkwindow.h>
30 #include <gtk/gtksignal.h>
31 #include <gtk/gtkvbox.h>
32 #include <gtk/gtkhbox.h>
33 #include <gtk/gtkpixmap.h>
34 #include <gtk/gtklabel.h>
35 #include <gtk/gtkhseparator.h>
36 #include <gtk/gtkscrolledwindow.h>
37 #include <gtk/gtktext.h>
38 #include <gtk/gtkbutton.h>
39 #if HAVE_SYS_UTSNAME_H
40 # include <sys/utsname.h>
46 #include "prefs_common.h"
49 #include "pixmaps/sylpheed-logo.xpm"
51 static GtkWidget *window;
53 static void about_create(void);
54 static void key_pressed(GtkWidget *widget, GdkEventKey *event);
55 static void about_uri_clicked(GtkButton *button, gpointer data);
62 gtk_widget_show(window);
65 static void about_create(void)
68 GdkPixmap *logoxpm = NULL;
69 GdkBitmap *logoxpmmask;
74 GtkWidget *scrolledwin;
76 GtkWidget *confirm_area;
80 GdkColor uri_color[2] = {{0, 0, 0, 0xffff}, {0, 0xffff, 0, 0}};
83 #if HAVE_SYS_UTSNAME_H
84 struct utsname utsbuf;
89 window = gtk_window_new(GTK_WINDOW_DIALOG);
90 gtk_window_set_title(GTK_WINDOW(window), _("About"));
91 gtk_container_set_border_width(GTK_CONTAINER(window), 8);
92 gtk_widget_set_usize(window, 518, 358);
93 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
94 /* gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); */
95 gtk_signal_connect(GTK_OBJECT(window), "delete_event",
96 GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete), NULL);
97 gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
98 GTK_SIGNAL_FUNC(key_pressed), NULL);
99 gtk_widget_realize(window);
101 vbox = gtk_vbox_new(FALSE, 6);
102 gtk_container_add(GTK_CONTAINER(window), vbox);
104 PIXMAP_CREATE(window, logoxpm, logoxpmmask, sylpheed_logo_xpm);
105 pixmap = gtk_pixmap_new(logoxpm, logoxpmmask);
106 gtk_box_pack_start(GTK_BOX(vbox), pixmap, FALSE, FALSE, 0);
108 label = gtk_label_new("version "VERSION);
109 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
111 #if HAVE_SYS_UTSNAME_H
113 g_snprintf(buf, sizeof(buf),
114 "GTK+ version %d.%d.%d\n"
115 "Operating System: %s %s (%s)",
116 gtk_major_version, gtk_minor_version, gtk_micro_version,
117 utsbuf.sysname, utsbuf.release, utsbuf.machine);
119 g_snprintf(buf, sizeof(buf),
120 "GTK+ version %d.%d.%d\n"
121 "Operating System: Windoze",
122 gtk_major_version, gtk_minor_version, gtk_micro_version);
125 label = gtk_label_new(buf);
126 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
128 g_snprintf(buf, sizeof(buf),
129 "Compiled-in features:%s",
153 label = gtk_label_new(buf);
154 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
156 label = gtk_label_new
157 ("Copyright (C) 1999-2001 Hiroyuki Yamamoto <hiro-y@kcn.ne.jp>");
158 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
160 hbox = gtk_hbox_new(FALSE, 0);
161 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
163 button = gtk_button_new_with_label(" "HOMEPAGE_URI" ");
164 gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, FALSE, 0);
165 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
166 gtk_signal_connect(GTK_OBJECT(button), "clicked",
167 GTK_SIGNAL_FUNC(about_uri_clicked), NULL);
169 for (i = 1; i <= strlen(HOMEPAGE_URI); i++) buf[i] = '_';
170 strcpy(buf + i, " ");
171 gtk_label_set_pattern(GTK_LABEL(GTK_BIN(button)->child), buf);
172 cmap = gdk_window_get_colormap(window->window);
173 gdk_colormap_alloc_colors(cmap, uri_color, 2, FALSE, TRUE, success);
174 if (success[0] == TRUE && success[1] == TRUE) {
175 gtk_widget_ensure_style(GTK_BIN(button)->child);
176 style = gtk_style_copy
177 (gtk_widget_get_style(GTK_BIN(button)->child));
178 style->fg[GTK_STATE_NORMAL] = uri_color[0];
179 style->fg[GTK_STATE_ACTIVE] = uri_color[1];
180 style->fg[GTK_STATE_PRELIGHT] = uri_color[0];
181 gtk_widget_set_style(GTK_BIN(button)->child, style);
183 g_warning("about_create(): color allocation failed.\n");
185 scrolledwin = gtk_scrolled_window_new(NULL, NULL);
186 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin),
187 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
188 gtk_box_pack_start(GTK_BOX(vbox), scrolledwin, TRUE, TRUE, 0);
190 text = gtk_text_new(gtk_scrolled_window_get_hadjustment
191 (GTK_SCROLLED_WINDOW(scrolledwin)),
192 gtk_scrolled_window_get_vadjustment
193 (GTK_SCROLLED_WINDOW(scrolledwin)));
194 gtk_text_set_word_wrap(GTK_TEXT(text), TRUE);
195 gtk_container_add(GTK_CONTAINER(scrolledwin), text);
197 gtk_text_freeze(GTK_TEXT(text));
199 gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL,
200 _("The portions applied from fetchmail is Copyright 1997 by Eric S. "
201 "Raymond. Portions of those are also copyrighted by Carl Harris, "
202 "1993 and 1995. Copyright retained for the purpose of protecting free "
203 "redistribution of source.\n\n"), -1);
205 gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL,
206 _("Kcc is copyright by Yasuhiro Tonooka <tonooka@msi.co.jp>, "
207 "and libkcc is copyright by takeshi@SoftAgency.co.jp.\n\n"), -1);
210 gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL,
211 _("GPGME is copyright 2001 by Werner Koch <dd9jn@gnu.org>\n\n"), -1);
212 #endif /* USE_GPGME */
214 gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL,
215 _("This program is free software; you can redistribute it and/or modify "
216 "it under the terms of the GNU General Public License as published by "
217 "the Free Software Foundation; either version 2, or (at your option) "
218 "any later version.\n\n"), -1);
220 gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL,
221 _("This program is distributed in the hope that it will be useful, "
222 "but WITHOUT ANY WARRANTY; without even the implied warranty of "
223 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. "
224 "See the GNU General Public License for more details.\n\n"), -1);
226 gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL,
227 _("You should have received a copy of the GNU General Public License "
228 "along with this program; if not, write to the Free Software "
229 "Foundation, Inc., 59 Temple Place - Suite 330, Boston, "
230 "MA 02111-1307, USA."), -1);
232 gtk_text_thaw(GTK_TEXT(text));
234 gtkut_button_set_create(&confirm_area, &ok_button, _("OK"),
235 NULL, NULL, NULL, NULL);
236 gtk_box_pack_end(GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0);
237 gtk_widget_grab_default(ok_button);
238 gtk_signal_connect_object(GTK_OBJECT(ok_button), "clicked",
239 GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete),
242 gtk_widget_show_all(window);
245 static void key_pressed(GtkWidget *widget, GdkEventKey *event)
247 if (event && event->keyval == GDK_Escape)
248 gtk_widget_hide(window);
251 static void about_uri_clicked(GtkButton *button, gpointer data)
253 open_uri(HOMEPAGE_URI, prefs_common.uri_cmd);