fix bug 4239, 'Preferences: Text Options Header Display modal is not modal' (sic)
[claws.git] / src / expldifdlg.c
index 1345d46c1266f605632fb6f14baffc061850a852..0b3e5dfb33dfe8329efda7a83295a577cc8712c4 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2003-2007 Match Grun and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2003-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"
@@ -148,7 +148,7 @@ static gint export_ldif_delete_event( GtkWidget *widget, GdkEventAny *event, gpo
  * \param data   User data.
  */
 static gboolean export_ldif_key_pressed( GtkWidget *widget, GdkEventKey *event, gpointer data ) {
-       if (event && event->keyval == GDK_Escape) {
+       if (event && event->keyval == GDK_KEY_Escape) {
                export_ldif_cancel( widget, data );
        }
        return FALSE;
@@ -164,7 +164,7 @@ static gboolean exp_ldif_move_file( void ) {
        AlertValue aval;
 
        sFile = gtk_editable_get_chars( GTK_EDITABLE(expldif_dlg.entryLdif), 0, -1 );
-       g_strchug( sFile ); g_strchomp( sFile );
+       g_strstrip( sFile );
        gtk_entry_set_text( GTK_ENTRY(expldif_dlg.entryLdif), sFile );
        exportldif_parse_filespec( _exportCtl_, sFile );
 
@@ -177,7 +177,8 @@ static gboolean exp_ldif_move_file( void ) {
        if( errFlag ) return FALSE;
 
        /* Test for directory */
-       if( exportldif_test_dir( _exportCtl_ ) ) {
+       if( g_file_test(_exportCtl_->dirOutput,
+                               G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) ) {
                return TRUE;
        }
 
@@ -187,7 +188,7 @@ static gboolean exp_ldif_move_file( void ) {
                "does not exist. OK to create new directory?" ),
                _exportCtl_->dirOutput );
        aval = alertpanel( _("Create Directory" ),
-               msg, GTK_STOCK_NO, GTK_STOCK_YES, NULL );
+               msg, GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST );
        g_free( msg );
        if( aval != G_ALERTALTERNATE ) return FALSE;
 
@@ -198,8 +199,8 @@ static gboolean exp_ldif_move_file( void ) {
                        "Could not create output directory for LDIF file:\n%s" ),
                        reason );
                aval = alertpanel_full(_("Failed to Create Directory"), msg,
-                                      GTK_STOCK_CLOSE, NULL, NULL, FALSE,
-                                      NULL, ALERT_ERROR, G_ALERTDEFAULT);
+                                      GTK_STOCK_CLOSE, NULL, NULL, ALERTFOCUS_FIRST, FALSE,
+                                      NULL, ALERT_ERROR);
                g_free( msg );
                return FALSE;
        }
@@ -219,7 +220,7 @@ static gboolean exp_ldif_move_dn( void ) {
 
        /* Set suffix */
        suffix = gtk_editable_get_chars( GTK_EDITABLE(expldif_dlg.entrySuffix), 0, -1 );
-       g_strchug( suffix ); g_strchomp( suffix );
+       g_strstrip( suffix );
 
        /* Set RDN format */
        id = combobox_get_active_data(GTK_COMBO_BOX(expldif_dlg.optmenuRDN));
@@ -243,7 +244,7 @@ static gboolean exp_ldif_move_dn( void ) {
                                "for an LDAP server. Are you sure you wish " \
                                "to proceed without a suffix?"
                         ),
-                       GTK_STOCK_NO, GTK_STOCK_YES, NULL );
+                       GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST );
                if( aval != G_ALERTALTERNATE ) {
                        gtk_widget_grab_focus( expldif_dlg.entrySuffix );
                        errFlag = TRUE;
@@ -463,7 +464,6 @@ static void export_ldif_page_dn( gint pageNum, gchar *pageLbl ) {
        GtkWidget *checkEMail;
        GtkListStore *store;
        GtkTreeIter iter;
-       CLAWS_TIP_DECL();
        gint top;
 
        vbox = gtk_vbox_new(FALSE, 8);
@@ -609,7 +609,7 @@ static void export_ldif_page_finish( gint pageNum, gchar *pageLbl ) {
 
        /* First row */
        top = 0;
-       label = gtk_label_new( _( "Address Book :" ) );
+       label = gtk_label_new( _( "Address Book:" ) );
        gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
        gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
 
@@ -619,7 +619,7 @@ static void export_ldif_page_finish( gint pageNum, gchar *pageLbl ) {
 
        /* Second row */
        top++;
-       label = gtk_label_new( _( "File Name :" ) );
+       label = gtk_label_new( _( "File Name:" ) );
        gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
        gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
 
@@ -654,7 +654,7 @@ static void export_ldif_dialog_create( void ) {
        gtk_window_set_title( GTK_WINDOW(window),
                _("Export Address Book to LDIF File") );
        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(export_ldif_delete_event),
                         NULL );
@@ -768,7 +768,7 @@ void addressbook_exp_ldif( AddressCache *cache ) {
        expldif_dlg.cancelled = FALSE;
        gtk_widget_show(expldif_dlg.window);
        manage_window_set_transient(GTK_WINDOW(expldif_dlg.window));
-
+       gtk_window_set_modal(GTK_WINDOW(expldif_dlg.window), TRUE);
        gtk_label_set_text( GTK_LABEL(expldif_dlg.labelBook), cache->name );
        gtk_label_set_text( GTK_LABEL(expldif_dlg.labelOutBook), cache->name );
        export_ldif_fill_fields( _exportCtl_ );
@@ -783,6 +783,7 @@ void addressbook_exp_ldif( AddressCache *cache ) {
 
        gtk_main();
        gtk_widget_hide(expldif_dlg.window);
+       gtk_window_set_modal(GTK_WINDOW(expldif_dlg.window), FALSE);
        exportldif_free( _exportCtl_ );
        _exportCtl_ = NULL;