inital gtk2 patch
[claws.git] / src / gtk / about.c
index 44e2ed1..063c446 100644 (file)
@@ -50,7 +50,7 @@
 static GtkWidget *window;
 
 static void about_create(void);
-static void key_pressed(GtkWidget *widget, GdkEventKey *event);
+static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event);
 static void about_uri_clicked(GtkButton *button, gpointer data);
 
 void about_show(void)
@@ -78,6 +78,8 @@ static void about_create(void)
        GdkColormap *cmap;
        GdkColor uri_color[2] = {{0, 0, 0, 0xffff}, {0, 0xffff, 0, 0}};
        gboolean success[2];
+       GtkTextBuffer *buffer;
+       GtkTextIter iter;
 
 #if HAVE_SYS_UTSNAME_H
        struct utsname utsbuf;
@@ -85,15 +87,15 @@ static void about_create(void)
        gchar buf[1024];
        gint i;
 
-       window = gtk_window_new(GTK_WINDOW_DIALOG);
+       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_window_set_title(GTK_WINDOW(window), _("About"));
        gtk_container_set_border_width(GTK_CONTAINER(window), 8);
-       gtk_widget_set_usize(window, 518, 358);
+       gtk_widget_set_size_request(window, 518, 358);
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
-       gtk_signal_connect(GTK_OBJECT(window), "delete_event",
-                          GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete), NULL);
-       gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
-                          GTK_SIGNAL_FUNC(key_pressed), NULL);
+       g_signal_connect(G_OBJECT(window), "delete_event",
+                        G_CALLBACK(gtk_widget_hide_on_delete), NULL);
+       g_signal_connect(G_OBJECT(window), "key_press_event",
+                        G_CALLBACK(key_pressed), NULL);
        gtk_widget_realize(window);
 
        vbox = gtk_vbox_new(FALSE, 6);
@@ -172,8 +174,8 @@ static void about_create(void)
        button = gtk_button_new_with_label(" "HOMEPAGE_URI" ");
        gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, FALSE, 0);
        gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
-       gtk_signal_connect(GTK_OBJECT(button), "clicked",
-                          GTK_SIGNAL_FUNC(about_uri_clicked), NULL);
+       g_signal_connect(G_OBJECT(button), "clicked",
+                        G_CALLBACK(about_uri_clicked), NULL);
        buf[0] = ' ';
        for (i = 1; i <= strlen(HOMEPAGE_URI); i++) buf[i] = '_';
        strcpy(buf + i, " ");
@@ -196,55 +198,53 @@ static void about_create(void)
                                       GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
        gtk_box_pack_start(GTK_BOX(vbox), scrolledwin, TRUE, TRUE, 0);
 
-       text = gtk_text_new(gtk_scrolled_window_get_hadjustment
-                           (GTK_SCROLLED_WINDOW(scrolledwin)),
-                           gtk_scrolled_window_get_vadjustment
-                           (GTK_SCROLLED_WINDOW(scrolledwin)));
-       gtk_text_set_word_wrap(GTK_TEXT(text), TRUE);
+       text = gtk_text_view_new();
+       gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE);
+       gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
        gtk_container_add(GTK_CONTAINER(scrolledwin), text);
 
-       gtk_text_freeze(GTK_TEXT(text));
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+       gtk_text_buffer_get_iter_at_offset(buffer, &iter, 0);
 
 #if USE_GPGME
-       gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL,
+       gtk_text_buffer_insert(buffer, &iter,
                _("GPGME is copyright 2001 by Werner Koch <dd9jn@gnu.org>\n\n"), -1);
 #endif /* USE_GPGME */
 
-       gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL,
+       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) "
                  "any later version.\n\n"), -1);
 
-       gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL,
+       gtk_text_buffer_insert(buffer, &iter,
                _("This program is distributed in the hope that it will be useful, "
                  "but WITHOUT ANY WARRANTY; without even the implied warranty of "
                  "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. "
                  "See the GNU General Public License for more details.\n\n"), -1);
 
-       gtk_text_insert(GTK_TEXT(text), NULL, NULL, 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, write to the Free Software "
                  "Foundation, Inc., 59 Temple Place - Suite 330, Boston, "
                  "MA 02111-1307, USA."), -1);
 
-       gtk_text_thaw(GTK_TEXT(text));
-
        gtkut_button_set_create(&confirm_area, &ok_button, _("OK"),
                                NULL, NULL, NULL, NULL);
        gtk_box_pack_end(GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0);
        gtk_widget_grab_default(ok_button);
-       gtk_signal_connect_object(GTK_OBJECT(ok_button), "clicked",
-                                 GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete),
-                                 GTK_OBJECT(window));
-
+       g_signal_connect_closure
+               (G_OBJECT(ok_button), "clicked",
+                g_cclosure_new_swap(G_CALLBACK(gtk_widget_hide_on_delete),
+                                    window, NULL), FALSE);
        gtk_widget_show_all(window);
 }
 
-static void key_pressed(GtkWidget *widget, GdkEventKey *event)
+static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event)
 {
        if (event && event->keyval == GDK_Escape)
                gtk_widget_hide(window);
+       return FALSE;
 }
 
 static void about_uri_clicked(GtkButton *button, gpointer data)