2012-11-18 [colin] 3.9.0cvs6-stable
[claws.git] / src / gtk / inputdialog.c
index a5c8d6988cdd0a67fbf2198f8308c9ac23f30877..119718959f4cec4914dd1203882510d7f1da2552 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2011 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2012 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
@@ -19,6 +19,7 @@
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
+#include "claws-features.h"
 #endif
 
 #include <glib.h>
@@ -85,7 +86,7 @@ static void combo_activated   (GtkEditable    *editable);
 gchar *input_dialog(const gchar *title, const gchar *message,
                    const gchar *default_string)
 {
-       if (dialog && gtkut_widget_get_visible(dialog)) return NULL;
+       if (dialog && gtk_widget_get_visible(dialog)) return NULL;
 
        if (!dialog)
                input_dialog_create(FALSE);
@@ -111,7 +112,7 @@ gchar *input_dialog(const gchar *title, const gchar *message,
 gchar *input_dialog_with_invisible(const gchar *title, const gchar *message,
                                   const gchar *default_string)
 {
-       if (dialog && gtkut_widget_get_visible(dialog)) return NULL;
+       if (dialog && gtk_widget_get_visible(dialog)) return NULL;
 
        if (!dialog)
                input_dialog_create(TRUE);
@@ -137,7 +138,7 @@ gchar *input_dialog_with_invisible_checkbtn(const gchar *title, const gchar *mes
                                   const gchar *default_string, const gchar *checkbtn_label,
                                   gboolean *checkbtn_state)
 {
-       if (dialog && gtkut_widget_get_visible(dialog)) return NULL;
+       if (dialog && gtk_widget_get_visible(dialog)) return NULL;
 
        if (!dialog)
                input_dialog_create(TRUE);
@@ -178,7 +179,7 @@ gchar *input_dialog_combo_remember(const gchar *title, const gchar *message,
                          const gchar *default_string, GList *list,
                          gboolean *remember)
 {
-       if (dialog && gtkut_widget_get_visible(dialog)) return NULL;
+       if (dialog && gtk_widget_get_visible(dialog)) return NULL;
 
        if (!dialog)
                input_dialog_create(FALSE);
@@ -209,7 +210,7 @@ gchar *input_dialog_with_checkbtn(const gchar       *title,
                                   const gchar  *checkbtn_label,
                                   gboolean *checkbtn_state)
 {
-       if (dialog && gtkut_widget_get_visible(dialog)) return NULL;
+       if (dialog && gtk_widget_get_visible(dialog)) return NULL;
 
        if (!dialog)
                input_dialog_create(FALSE);
@@ -302,7 +303,6 @@ gchar *input_dialog_query_password_keep(const gchar *server, const gchar *user,
 static void input_dialog_create(gboolean is_password)
 {
        static PangoFontDescription *font_desc;
-       GtkWidget *w_hbox;
        GtkWidget *hbox;
        GtkWidget *vbox;
        GtkWidget *cancel_button;
@@ -329,8 +329,6 @@ static void input_dialog_create(gboolean is_password)
                            FALSE, FALSE, 0);
 
        /* for title label */
-       w_hbox = gtk_hbox_new(FALSE, 0);
-       
        icon_q = gtk_image_new_from_stock(GTK_STOCK_DIALOG_QUESTION,
                                GTK_ICON_SIZE_DIALOG); 
        gtk_misc_set_alignment (GTK_MISC (icon_q), 0.5, 0.0);
@@ -421,7 +419,7 @@ static gchar *input_dialog_open(const gchar *title, const gchar *message,
 {
        gchar *str;
 
-       if (dialog && gtkut_widget_get_visible(dialog)) return NULL;
+       if (dialog && gtk_widget_get_visible(dialog)) return NULL;
 
        if (!dialog)
                input_dialog_create(FALSE);
@@ -432,7 +430,7 @@ static gchar *input_dialog_open(const gchar *title, const gchar *message,
                gtk_button_set_label(GTK_BUTTON(remember_checkbtn), _("Remember this"));
 
        input_dialog_set(title, message, default_string);
-       gtk_widget_show(dialog);
+       gtk_window_present(GTK_WINDOW(dialog));
 
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remember_checkbtn),
                                     default_checkbtn_state);
@@ -450,7 +448,6 @@ static gchar *input_dialog_open(const gchar *title, const gchar *message,
                gtk_main_iteration();
 
        manage_window_focus_out(dialog, NULL, NULL);
-       gtk_widget_hide(dialog);
 
        if (ack) {
                GtkEditable *editable;
@@ -473,6 +470,10 @@ static gchar *input_dialog_open(const gchar *title, const gchar *message,
        if (remember) {
                *remember = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remember_checkbtn));
        }
+
+       gtk_widget_destroy(dialog);
+       dialog = NULL;
+
        if (is_pass)
                debug_print("return string = %s\n", str ? "********": ("none"));
        else