fix bug 4239, 'Preferences: Text Options Header Display modal is not modal' (sic)
[claws.git] / src / importpine.c
index 9bac252e5de4f99a97314356ec2d248f5c3733a3..21fe27de6fe3ad7e516eb456266d6fc4aab93b3b 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2002-2007 Match Grun and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2002-2015 Match Grun 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
@@ -14,7 +14,6 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * 
  */
 
 /*
@@ -23,6 +22,7 @@
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
+#include "claws-features.h"
 #endif
 
 #include "defs.h"
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <gdk/gdkkeysyms.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkbutton.h>
+#include <gtk/gtk.h>
 
 #include "addrbook.h"
 #include "addressbook.h"
@@ -103,6 +98,7 @@ static gboolean imp_pine_import_file( gchar *sName, gchar *sFile ) {
        else {
                addrbook_free_book( abf );
        }
+       pine_free(pdf);
 
        return retVal;
 }
@@ -114,11 +110,11 @@ static void imp_pine_ok( GtkWidget *widget, gboolean *cancelled ) {
        gboolean errFlag = FALSE;
 
        sFile = gtk_editable_get_chars( GTK_EDITABLE(imppine_dlg.file_entry), 0, -1 );
-       g_strchug( sFile ); g_strchomp( sFile );
+       g_strstrip( sFile );
        gtk_entry_set_text( GTK_ENTRY(imppine_dlg.file_entry), sFile );
 
        sName = gtk_editable_get_chars( GTK_EDITABLE(imppine_dlg.name_entry), 0, -1 );
-       g_strchug( sName ); g_strchomp( sName );
+       g_strstrip( sName );
        gtk_entry_set_text( GTK_ENTRY(imppine_dlg.name_entry), sName );
 
        if( *sFile == '\0'|| strlen( sFile ) < 1 ) {
@@ -178,7 +174,7 @@ static gint imp_pine_delete_event( GtkWidget *widget, GdkEventAny *event, gboole
 }
 
 static gboolean imp_pine_key_pressed( GtkWidget *widget, GdkEventKey *event, gboolean *cancelled ) {
-       if (event && event->keyval == GDK_Escape) {
+       if (event && event->keyval == GDK_KEY_Escape) {
                *cancelled = TRUE;
                gtk_main_quit();
        }
@@ -205,7 +201,7 @@ static void imp_pine_create( gboolean *cancelled ) {
        gtk_container_set_border_width( GTK_CONTAINER(window), 0 );
        gtk_window_set_title( GTK_WINDOW(window), _("Import Pine file into Address Book") );
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
-       gtk_window_set_modal(GTK_WINDOW(window), TRUE); 
+       gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG);
        g_signal_connect(G_OBJECT(window), "delete_event",
                         G_CALLBACK(imp_pine_delete_event), cancelled);
        g_signal_connect(G_OBJECT(window), "key_press_event",
@@ -288,6 +284,7 @@ AddressBookFile *addressbook_imp_pine( AddressIndex *addrIndex ) {
        gtk_widget_grab_focus(imppine_dlg.file_entry);
        gtk_widget_show(imppine_dlg.window);
        manage_window_set_transient(GTK_WINDOW(imppine_dlg.window));
+       gtk_window_set_modal(GTK_WINDOW(imppine_dlg.window), TRUE);
 
        imp_pine_status_show( _( "Please select a file to import." ) );
        pineFile = pine_find_file();
@@ -298,6 +295,7 @@ AddressBookFile *addressbook_imp_pine( AddressIndex *addrIndex ) {
 
        gtk_main();
        gtk_widget_hide(imppine_dlg.window);
+       gtk_window_set_modal(GTK_WINDOW(imppine_dlg.window), FALSE);
        _imp_addressIndex_ = NULL;
 
        if (cancelled == TRUE) return NULL;