Remove commented out code.
[geeqie.git] / src / ui_help.c
index a816b9e..a21f7f6 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * (SLIK) SimpLIstic sKin functions
  * (C) 2004 John Ellis
+ * Copyright (C) 2008 - 2012 The Geeqie Team
  *
  * Author: John Ellis
  *
 
 #include <gtk/gtk.h>
 
+#include "main.h"
 #include "ui_help.h"
 
 #include "ui_fileops.h"
 #include "ui_misc.h"
+#include "window.h"
 
 
-#define HELP_WINDOW_WIDTH 620
+#define HELP_WINDOW_WIDTH 650
 #define HELP_WINDOW_HEIGHT 350
 
 
@@ -62,10 +65,6 @@ static void help_window_scroll(GtkWidget *text, const gchar *key)
                gtk_text_buffer_get_iter_at_line_offset(buffer, &iter, line, 0);
                gtk_text_buffer_place_cursor(buffer, &iter);
 
-#if 0
-               gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(text), &iter, 0.0, TRUE, 0, 0);
-#endif
-
                /* apparently only scroll_to_mark works when the textview is not visible yet */
 
                /* if mark exists, move it instead of creating one for every scroll */
@@ -123,7 +122,7 @@ static void help_window_load_text(GtkWidget *text, const gchar *path)
 
                        if (!g_utf8_validate(s_buf, l, NULL))
                                {
-                               buf = g_locale_to_utf8(s_buf, strlen(s_buf), NULL, NULL, NULL);
+                               buf = g_locale_to_utf8(s_buf, l, NULL, NULL, NULL);
                                if (!buf) buf = g_strdup("\n");
                                }
                        else
@@ -143,7 +142,7 @@ static void help_window_load_text(GtkWidget *text, const gchar *path)
        gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(text), &iter, 0.0, TRUE, 0, 0);
 }
 
-static gint help_window_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data)
+static gboolean help_window_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data)
 {
        gtk_widget_destroy(widget);
        return TRUE;
@@ -164,7 +163,7 @@ void help_window_set_key(GtkWidget *window, const gchar *key)
        text = g_object_get_data(G_OBJECT(window), "text_widget");
        if (!text) return;
 
-       gdk_window_raise(window->window);
+       gdk_window_raise(gtk_widget_get_window(window));
 
        if (key) help_window_scroll(text, key);
 }
@@ -178,14 +177,14 @@ void help_window_set_file(GtkWidget *window, const gchar *path, const gchar *key
        text = g_object_get_data(G_OBJECT(window), "text_widget");
        if (!text) return;
 
-       gdk_window_raise(window->window);
+       gdk_window_raise(gtk_widget_get_window(window));
 
        help_window_load_text(text, path);
        help_window_scroll(text, key);
 }
 
 GtkWidget *help_window_new(const gchar *title,
-                          const gchar *wmclass, const gchar *subclass,
+                          const gchar *subclass,
                           const gchar *path, const gchar *key)
 {
        GtkWidget *window;
@@ -198,17 +197,10 @@ GtkWidget *help_window_new(const gchar *title,
 
        /* window */
 
-       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+       window = window_new(GTK_WINDOW_TOPLEVEL, subclass, NULL, NULL, title);
        gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
-#if 0
-       gtk_container_set_border_width(GTK_CONTAINER(window), PREF_PAD_BORDER);
-#endif
-       gtk_window_set_wmclass(GTK_WINDOW(window), subclass, wmclass);
-
        gtk_window_set_default_size(GTK_WINDOW(window), HELP_WINDOW_WIDTH, HELP_WINDOW_HEIGHT);
 
-       gtk_window_set_title(GTK_WINDOW(window), title);
-
        g_signal_connect(G_OBJECT(window), "delete_event",
                         G_CALLBACK(help_window_delete_cb), NULL);
 
@@ -247,10 +239,10 @@ GtkWidget *help_window_new(const gchar *title,
        gtk_widget_show(hbox);
 
        button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
-       g_signal_connect(G_OBJECT (button), "clicked",
+       g_signal_connect(G_OBJECT(button), "clicked",
                         G_CALLBACK(help_window_close), window);
        gtk_container_add(GTK_CONTAINER(hbox), button);
-       GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+       gtk_widget_set_can_default(button, TRUE);
        gtk_widget_grab_default(button);
        gtk_widget_show(button);
 
@@ -269,4 +261,4 @@ GtkWidget *help_window_get_box(GtkWidget *window)
 {
        return g_object_get_data(G_OBJECT(window), "text_vbox");
 }
-
+/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */