2008-10-09 [colin] 3.6.0cvs21
[claws.git] / src / gtk / about.c
index 910fca831fd3d2e9dc9a64ca8595ba4a0de66795..564519a6691d1190666d7752128501bcfaa981dc 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2008 Hiroyuki Yamamoto and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -13,8 +13,8 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * 
  */
 
 #ifdef HAVE_CONFIG_H
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <gdk/gdkkeysyms.h>
-#include <gtk/gtkwidget.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkhseparator.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtktext.h>
-#include <gtk/gtkbutton.h>
+#include <gtk/gtk.h>
 #if HAVE_SYS_UTSNAME_H
 #  include <sys/utsname.h>
 #endif
+#include <errno.h>
 
 #include "about.h"
 #include "gtkutils.h"
@@ -63,8 +55,6 @@ static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event);
 static gboolean about_textview_uri_clicked(GtkTextTag *tag, GObject *obj,
                                        GdkEvent *event, GtkTextIter *iter,
                                        GtkWidget *textview);
-static void about_open_link_cb(GtkWidget *widget, guint action, void *data);
-static void about_copy_link_cb(GtkWidget *widget, guint action, void *data);
 static gboolean about_textview_motion_notify(GtkWidget *widget,
                                        GdkEventMotion *event,
                                        GtkWidget *textview);
@@ -73,12 +63,6 @@ static gboolean about_textview_leave_notify(GtkWidget *widget,
                                        GtkWidget *textview);
 static void about_textview_uri_update(GtkWidget *textview, gint x, gint y);
 
-static GtkItemFactoryEntry textview_link_popup_entries[] = 
-{
-       {N_("/_Open with Web browser"), NULL, about_open_link_cb, 0, NULL},
-       {N_("/Copy this _link"),        NULL, about_copy_link_cb, 0, NULL},
-};
-
 static GtkWidget *link_popupmenu;
 
 
@@ -86,8 +70,9 @@ void about_show(void)
 {
        if (!window)
                about_create();
-       else
+       else 
                gtk_window_present(GTK_WINDOW(window));
+       
 }
 
 static GtkWidget *about_create_child_page_info(void)
@@ -154,7 +139,11 @@ static GtkWidget *about_create_child_page_info(void)
        gtk_text_buffer_create_tag(buffer, "underlined-list-title",
                                "underline", PANGO_UNDERLINE_SINGLE,
                                NULL);
-
+#ifdef GENERIC_UMPC
+       gtk_text_buffer_insert(buffer, &iter, _(
+                               "\n\nCopyright (C) 1999-2008\nHiroyuki Yamamoto <hiro-y@kcn.ne.jp>\n"
+                               "and the Claws Mail team"), -1);
+#endif
        gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (_("\n\nSystem Information\n")), -1,
                        "underlined-list-title", NULL);
 
@@ -403,59 +392,69 @@ static GtkWidget *about_create_child_page_features(void)
        gtk_text_buffer_create_tag(buffer, "bold", "weight", PANGO_WEIGHT_BOLD,
                                   NULL);
 
-       stock_pixbuf_gdk(window, STOCK_PIXMAP_ACTIVE, &active_pixbuf);
-       stock_pixbuf_gdk(window, STOCK_PIXMAP_INACTIVE, &inactive_pixbuf);
+       stock_pixbuf_gdk(window, STOCK_PIXMAP_CHECKBOX_ON, &active_pixbuf);
+       stock_pixbuf_gdk(window, STOCK_PIXMAP_CHECKBOX_OFF, &inactive_pixbuf);
 
-#if INET6
+#if HAVE_LIBCOMPFACE
        gtk_text_buffer_insert_pixbuf(buffer, &iter, active_pixbuf);
 #else
        gtk_text_buffer_insert_pixbuf(buffer, &iter, inactive_pixbuf);
 #endif
-       gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (" IPv6 "), -1,
+       gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (" compface "), -1,
                                                 "bold", NULL);
        gtk_text_buffer_insert(buffer, &iter, 
-               (gchar *)Q_("IPv6|adds support for IPv6 addresses, the new internet "
-                           "addressing protocol\n"), -1);
+               (gchar *)Q_("compface|adds support for the X-Face header\n"), -1);
 
-#if HAVE_ICONV
+#if USE_ENCHANT
        gtk_text_buffer_insert_pixbuf(buffer, &iter, active_pixbuf);
 #else
        gtk_text_buffer_insert_pixbuf(buffer, &iter, inactive_pixbuf);
 #endif
-       gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (" iconv "), -1,
+       gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (" Enchant "), -1,
                                                 "bold", NULL);
        gtk_text_buffer_insert(buffer, &iter, 
-               (gchar *)Q_("iconv|allows converting to and from different character sets\n"), -1);
+               (gchar *)Q_("Enchant|adds support for spell checking\n"), -1);
 
-#if HAVE_LIBCOMPFACE
+#if USE_GNUTLS
        gtk_text_buffer_insert_pixbuf(buffer, &iter, active_pixbuf);
 #else
        gtk_text_buffer_insert_pixbuf(buffer, &iter, inactive_pixbuf);
 #endif
-       gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (" compface "), -1,
+       gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (" GnuTLS "), -1,
                                                 "bold", NULL);
        gtk_text_buffer_insert(buffer, &iter, 
-               (gchar *)Q_("compface|adds support for the X-Face header\n"), -1);
+               (gchar *)Q_("GnuTLS|adds support for encrypted connections to servers\n"), -1);
 
-#if USE_OPENSSL
+#if GTK_CHECK_VERSION(2,10,0) && !defined(USE_GNOMEPRINT)
        gtk_text_buffer_insert_pixbuf(buffer, &iter, active_pixbuf);
 #else
        gtk_text_buffer_insert_pixbuf(buffer, &iter, inactive_pixbuf);
 #endif
-       gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (" OpenSSL "), -1,
+       gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (" GTK+ >= 2.10.0 "), -1,
                                                 "bold", NULL);
        gtk_text_buffer_insert(buffer, &iter, 
-               (gchar *)Q_("OpenSSL|adds support for encrypted connections to servers\n"), -1);
+               (gchar *)Q_("GTK+ >= 2.10.0|adds support for a complete print dialog\n"), -1);
 
-#if USE_LDAP
+#if INET6
        gtk_text_buffer_insert_pixbuf(buffer, &iter, active_pixbuf);
 #else
        gtk_text_buffer_insert_pixbuf(buffer, &iter, inactive_pixbuf);
 #endif
-       gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (" LDAP "), -1,
+       gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (" IPv6 "), -1,
                                                 "bold", NULL);
        gtk_text_buffer_insert(buffer, &iter, 
-               (gchar *)Q_("LDAP|adds support for LDAP shared addressbooks\n"), -1);
+               (gchar *)Q_("IPv6|adds support for IPv6 addresses, the new Internet "
+                           "addressing protocol\n"), -1);
+
+#if HAVE_ICONV
+       gtk_text_buffer_insert_pixbuf(buffer, &iter, active_pixbuf);
+#else
+       gtk_text_buffer_insert_pixbuf(buffer, &iter, inactive_pixbuf);
+#endif
+       gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (" iconv "), -1,
+                                                "bold", NULL);
+       gtk_text_buffer_insert(buffer, &iter, 
+               (gchar *)Q_("iconv|allows converting to and from different character sets\n"), -1);
 
 #if USE_JPILOT
        gtk_text_buffer_insert_pixbuf(buffer, &iter, active_pixbuf);
@@ -467,15 +466,15 @@ static GtkWidget *about_create_child_page_features(void)
        gtk_text_buffer_insert(buffer, &iter, 
                (gchar *)Q_("JPilot|adds support for PalmOS addressbooks\n"), -1);
 
-#if USE_ASPELL
+#if USE_LDAP
        gtk_text_buffer_insert_pixbuf(buffer, &iter, active_pixbuf);
 #else
        gtk_text_buffer_insert_pixbuf(buffer, &iter, inactive_pixbuf);
 #endif
-       gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (" GNU/aspell "), -1,
+       gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (" LDAP "), -1,
                                                 "bold", NULL);
        gtk_text_buffer_insert(buffer, &iter, 
-               (gchar *)Q_("GNU/aspell|adds support for spell checking\n"), -1);
+               (gchar *)Q_("LDAP|adds support for LDAP shared addressbooks\n"), -1);
 
 #if HAVE_LIBETPAN
        gtk_text_buffer_insert_pixbuf(buffer, &iter, active_pixbuf);
@@ -485,7 +484,7 @@ static GtkWidget *about_create_child_page_features(void)
        gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (" libetpan "), -1,
                                                 "bold", NULL);
        gtk_text_buffer_insert(buffer, &iter, 
-               (gchar *)Q_("libetpan|adds support for IMAP servers\n"), -1);
+               (gchar *)Q_("libetpan|adds support for IMAP and NNTP servers\n"), -1);
 
 #if USE_GNOMEPRINT
        gtk_text_buffer_insert_pixbuf(buffer, &iter, active_pixbuf);
@@ -507,6 +506,16 @@ static GtkWidget *about_create_child_page_features(void)
        gtk_text_buffer_insert(buffer, &iter, 
                (gchar *)Q_("libSM|adds support for session handling\n"), -1);
 
+#if HAVE_NETWORKMANAGER_SUPPORT
+       gtk_text_buffer_insert_pixbuf(buffer, &iter, active_pixbuf);
+#else
+       gtk_text_buffer_insert_pixbuf(buffer, &iter, inactive_pixbuf);
+#endif
+       gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (" NetworkManager "), -1,
+                                                "bold", NULL);
+       gtk_text_buffer_insert(buffer, &iter,
+               (gchar *)Q_("NetworkManager|adds support for detection of network connection changes\n"), -1);
+
        return scrolledwin;
 }
 
@@ -539,7 +548,7 @@ static GtkWidget *about_create_child_page_license(void)
        gtk_text_buffer_insert(buffer, &iter,
                _("This program is free software; you can redistribute it and/or modify "
                  "it under the terms of the GNU General Public License as published by "
-                 "the Free Software Foundation; either version 2, or (at your option) "
+                 "the Free Software Foundation; either version 3, or (at your option) "
                  "any later version.\n\n"), -1);
 
        gtk_text_buffer_insert(buffer, &iter,
@@ -548,12 +557,6 @@ static GtkWidget *about_create_child_page_license(void)
                  "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. "
                  "See the GNU General Public License for more details.\n\n"), -1);
 
-       gtk_text_buffer_insert(buffer, &iter,
-               _("You should have received a copy of the GNU General Public License "
-                 "along with this program; if not, write to the Free Software "
-                 "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, "
-                 "MA 02110-1301, USA.\n\n"), -1);
-#ifdef USE_OPENSSL
        /* textview link style (based upon main prefs) */
        gtkut_convert_int_to_gdk_color(prefs_common.uri_col,
                        (GdkColor*)&uri_color);
@@ -566,12 +569,21 @@ static GtkWidget *about_create_child_page_license(void)
                "underline", PANGO_UNDERLINE_SINGLE,
                NULL);
 
+       gtk_text_buffer_insert(buffer, &iter,
+               _("You should have received a copy of the GNU General Public License "
+                 "along with this program. If not, see <"), -1);
+       gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, 
+               "http://www.gnu.org/licenses/", -1,
+               "link", NULL);
+       gtk_text_buffer_insert(buffer, &iter, _(">. \n\n"), -1);
+#ifdef USE_OPENSSL
        gtk_text_buffer_insert(buffer, &iter,
                _("This product includes software developed by the OpenSSL Project "
                  "for use in the OpenSSL Toolkit ("), -1);
        gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, OPENSSL_URI, -1,
                "link", NULL);
        gtk_text_buffer_insert(buffer, &iter, _(").\n"), -1);
+#endif
 
        g_signal_connect(G_OBJECT(tag), "event",
                                G_CALLBACK(about_textview_uri_clicked), text);
@@ -579,7 +591,6 @@ static GtkWidget *about_create_child_page_license(void)
                         G_CALLBACK(about_textview_motion_notify), text);
        g_signal_connect(G_OBJECT(text), "leave-notify-event",
                                G_CALLBACK(about_textview_leave_notify), text);
-#endif
 
        return scrolledwin;
 }
@@ -663,7 +674,8 @@ static void about_create(void)
        GtkWidget *close_button;
        static GdkGeometry geometry;
 
-       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+       window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "about");
+       gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER_ALWAYS);
        gtk_window_set_title(GTK_WINDOW(window), _("About Claws Mail"));
        gtk_container_set_border_width(GTK_CONTAINER(window), 8);
        gtk_widget_set_size_request(window, -1, -1);
@@ -713,15 +725,15 @@ static void about_create(void)
 
        button = gtkut_get_link_btn(window, HOMEPAGE_URI, " "HOMEPAGE_URI" ");
        gtk_box_pack_start(GTK_BOX(vbox2), button, FALSE, FALSE, 0);
-
+#ifndef GENERIC_UMPC
        label = gtk_label_new
-               (_("Copyright (C) 1999-2006\nHiroyuki Yamamoto <hiro-y@kcn.ne.jp>\n"
+               (_("Copyright (C) 1999-2008\nHiroyuki Yamamoto <hiro-y@kcn.ne.jp>\n"
                 "and the Claws Mail team"));
        gtk_label_set_selectable(GTK_LABEL(label), TRUE);
        gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
        gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
        gtk_box_pack_start(GTK_BOX(vbox2), label, FALSE, FALSE, 0);
-
+#endif
        notebook = gtk_notebook_new();
        gtk_widget_set_size_request(notebook, -1, 220);
        gtk_widget_show(notebook);
@@ -819,23 +831,16 @@ static gboolean about_textview_uri_clicked(GtkTextTag *tag, GObject *obj,
                }
                /* open link and do *not* return TRUE so that
                   further gtk processing of the signal is done */
-               open_uri(link, prefs_common.uri_cmd);
+               open_uri(link, prefs_common_get_uri_cmd());
 
        } else {
                if (bevent->button == 3 && event->type == GDK_BUTTON_PRESS) {
-                       GtkItemFactory *link_popupfactory;
-                       gint n_entries;
-
-                       n_entries = sizeof(textview_link_popup_entries) /
-                                       sizeof(textview_link_popup_entries[0]);
-                       link_popupmenu = menu_create_items(
-                                                       textview_link_popup_entries, n_entries,
-                                               "<UriPopupMenu>", &link_popupfactory,
-                                               textview);
+                       link_popupmenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
+                               gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/TextviewPopupLink")));
 
                        g_object_set_data(
                                        G_OBJECT(link_popupmenu),
-                                       "menu_button", link);
+                                       "raw_url", link);
                        gtk_menu_popup(GTK_MENU(link_popupmenu), 
                                        NULL, NULL, NULL, NULL, 
                                        bevent->button, bevent->time);
@@ -846,34 +851,6 @@ static gboolean about_textview_uri_clicked(GtkTextTag *tag, GObject *obj,
        return FALSE;
 }
 
-static void about_open_link_cb(GtkWidget *widget, guint action, void *data)
-{
-       gchar *link = g_object_get_data(G_OBJECT(link_popupmenu),
-                                          "menu_button");
-
-       if (link == NULL) {
-               return;
-       }
-
-       open_uri(link, prefs_common.uri_cmd);
-       g_object_set_data(G_OBJECT(link_popupmenu), "menu_button",
-                         NULL);
-}
-
-static void about_copy_link_cb(GtkWidget *widget, guint action, void *data)
-{
-       gchar *link = g_object_get_data(G_OBJECT(link_popupmenu),
-                                          "menu_button");
-
-       if (link == NULL) {
-               return;
-       }
-
-       gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_PRIMARY), link, -1);
-       gtk_clipboard_set_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), link, -1);
-       g_object_set_data(G_OBJECT(link_popupmenu), "menu_button", NULL);
-}
-
 static gboolean about_textview_motion_notify(GtkWidget *widget,
                                        GdkEventMotion *event,
                                        GtkWidget *textview)