2005-09-19 [colin] 1.9.14cvs43
authorColin Leroy <colin@colino.net>
Mon, 19 Sep 2005 17:53:13 +0000 (17:53 +0000)
committerColin Leroy <colin@colino.net>
Mon, 19 Sep 2005 17:53:13 +0000 (17:53 +0000)
* src/addressbook.c
Fix sensitivity of Delete button
* src/compose.c
Warn if the requested Privacy system
is not available
* src/exphtmldlg.c
* src/expldifdlg.c
* src/importldif.c
* src/importmutt.c
* src/importpine.c
Fix crappy UI
* src/
* src/ssl.h
* src/prefs_account.h
* src/prefs_account.c
Save SSL prefs even in builds that have
SSL support disable
* src/imap.c
* src/inc.c
* src/news.c
* src/send_message.c
Warn if connection should be secure, but
SSL support isn't compiled in
* src/gtkaspell.c
Fix word separation on UTF-8 systems
* src/compose.c
Warn if the requested Privacy system
is not available
Factorize offline warning
* src/imap.c
* src/imap_gtk.c
* src/imap_gtk.h
* src/inc.h
* src/news_gtk.c
* src/news_gtk.h
* src/messageview.c
Factorize offline warning

23 files changed:
ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/addressbook.c
src/common/ssl.h
src/compose.c
src/exphtmldlg.c
src/expldifdlg.c
src/gtk/gtkaspell.c
src/imap.c
src/imap_gtk.c
src/importldif.c
src/importmutt.c
src/importpine.c
src/inc.c
src/inc.h
src/messageview.c
src/news.c
src/news_gtk.c
src/news_gtk.h
src/prefs_account.c
src/prefs_account.h
src/send_message.c

index db6fff0..b7e7d8e 100644 (file)
@@ -1,3 +1,43 @@
+2005-09-19 [colin]     1.9.14cvs43
+
+       * src/addressbook.c
+               Fix sensitivity of Delete button
+       * src/compose.c
+               Warn if the requested Privacy system
+               is not available
+       * src/exphtmldlg.c
+       * src/expldifdlg.c
+       * src/importldif.c
+       * src/importmutt.c
+       * src/importpine.c
+               Fix crappy UI
+       * src/
+       * src/ssl.h
+       * src/prefs_account.h
+       * src/prefs_account.c
+               Save SSL prefs even in builds that have
+               SSL support disable
+       * src/imap.c
+       * src/inc.c
+       * src/news.c
+       * src/send_message.c
+               Warn if connection should be secure, but
+               SSL support isn't compiled in
+       * src/gtkaspell.c
+               Fix word separation on UTF-8 systems
+       * src/compose.c
+               Warn if the requested Privacy system
+               is not available
+               Factorize offline warning
+       * src/imap.c
+       * src/imap_gtk.c
+       * src/imap_gtk.h
+       * src/inc.h
+       * src/news_gtk.c
+       * src/news_gtk.h
+       * src/messageview.c
+               Factorize offline warning
+
 2005-09-19 [paul]
 
        1.9.15-rc2 released
index f45c990..7779f11 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.654.2.850 -r 1.654.2.851 configure.ac;  ) > 1.9.14cvs40.patchset
 ( cvs diff -u -r 1.1.4.10 -r 1.1.4.11 src/gtk/logwindow.c;  ) > 1.9.14cvs41.patchset
 ( cvs diff -u -r 1.65.2.36 -r 1.65.2.37 src/codeconv.c;  cvs diff -u -r 1.15.2.10 -r 1.15.2.11 src/codeconv.h;  cvs diff -u -r 1.49.2.61 -r 1.49.2.62 src/procmime.c;  ) > 1.9.14cvs42.patchset
+( cvs diff -u -r 1.60.2.30 -r 1.60.2.31 src/addressbook.c;  cvs diff -u -r 1.382.2.171 -r 1.382.2.172 src/compose.c;  cvs diff -u -r 1.3.2.10 -r 1.3.2.11 src/exphtmldlg.c;  cvs diff -u -r 1.1.4.12 -r 1.1.4.13 src/expldifdlg.c;  cvs diff -u -r 1.179.2.70 -r 1.179.2.71 src/imap.c;  cvs diff -u -r 1.1.2.19 -r 1.1.2.20 src/imap_gtk.c;  cvs diff -u -r 1.14.2.4 -r 1.14.2.5 src/importldif.c;  cvs diff -u -r 1.4.12.6 -r 1.4.12.7 src/importmutt.c;  cvs diff -u -r 1.1.14.6 -r 1.1.14.7 src/importpine.c;  cvs diff -u -r 1.149.2.32 -r 1.149.2.33 src/inc.c;  cvs diff -u -r 1.29.2.5 -r 1.29.2.6 src/inc.h;  cvs diff -u -r 1.94.2.62 -r 1.94.2.63 src/messageview.c;  cvs diff -u -r 1.101.2.14 -r 1.101.2.15 src/news.c;  cvs diff -u -r 1.2.2.9 -r 1.2.2.10 src/news_gtk.c;  cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/news_gtk.h;  cvs diff -u -r 1.105.2.34 -r 1.105.2.35 src/prefs_account.c;  cvs diff -u -r 1.49.2.14 -r 1.49.2.15 src/prefs_account.h;  cvs diff -u -r 1.17.2.17 -r 1.17.2.18 src/send_message.c;  cvs diff -u -r 1.2 -r 1.3 src/common/ssl.h;  cvs diff -u -r 1.9.2.24 -r 1.9.2.25 src/gtk/gtkaspell.c;  ) > 1.9.14cvs43.patchset
index b659058..ec80685 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=14
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=42
+EXTRA_VERSION=43
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index d9906c7..f4c6cc4 100644 (file)
@@ -387,6 +387,7 @@ static void addressbook_drag_received_cb(GtkWidget        *widget,
                                        guint             info,
                                        guint             time,
                                        void             *pdata);
+static void addressbook_list_menu_setup( void );
 
 static GtkTargetEntry addressbook_drag_types[] =
 {
@@ -1208,6 +1209,7 @@ static void addressbook_del_clicked(GtkButton *button, gpointer data)
                        gtk_sctree_select( GTK_SCTREE(ctree), addrbook.opened);
                addrbook_set_dirty(abf, TRUE);
                addressbook_export_to_file();
+               addressbook_list_menu_setup();
                return;
        }
        else if( pobj->type == ADDR_ITEM_GROUP ) {
@@ -1232,6 +1234,7 @@ static void addressbook_del_clicked(GtkButton *button, gpointer data)
                gtk_sctree_select( GTK_SCTREE(ctree), addrbook.opened);
                addrbook_set_dirty(abf, TRUE);
                addressbook_export_to_file();
+               addressbook_list_menu_setup();
                return;
        }
 
@@ -1441,7 +1444,7 @@ static void addressbook_menuitem_set_sensitive( AddressObject *obj, GtkCTreeNode
 
        /* Enable edit */
        menu_set_sensitive( addrbook.menu_factory, "/Address/Edit",   canEdit );
-       menu_set_sensitive( addrbook.menu_factory, "/Address/Delete", canEdit );
+       menu_set_sensitive( addrbook.menu_factory, "/Address/Delete", canDelete );
        gtk_widget_set_sensitive( addrbook.edit_btn, canEdit );
        gtk_widget_set_sensitive( addrbook.del_btn, canDelete );
 
@@ -1534,7 +1537,7 @@ static gboolean addressbook_tree_selected(GtkCTree *ctree, GtkCTreeNode *node,
        addressbook_menuitem_set_sensitive( obj, node );
 
        addressbook_list_select_clear();
-       
+       addressbook_list_menu_setup();
        return FALSE;
 }
 
@@ -1612,7 +1615,6 @@ static void addressbook_list_menu_setup( void ) {
        if( GTK_CLIST(clist)->selection && GTK_CLIST(clist)->selection->next ) {
                canEdit = FALSE;
                canBrowse = FALSE;
-               canDelete = canEdit;
        }
 
        /* Now go finalize menu items */
index ccc2362..f81aec9 100644 (file)
 #  include "config.h"
 #endif
 
+typedef enum {
+       SSL_NONE,
+       SSL_TUNNEL,
+       SSL_STARTTLS
+} SSLType;
+
 #if USE_OPENSSL
 
 #include <glib.h>
@@ -41,12 +47,6 @@ typedef enum {
        SSL_METHOD_TLSv1
 } SSLMethod;
 
-typedef enum {
-       SSL_NONE,
-       SSL_TUNNEL,
-       SSL_STARTTLS
-} SSLType;
-
 void ssl_init                          (void);
 void ssl_done                          (void);
 gboolean ssl_init_socket               (SockInfo       *sockinfo);
index 92530ce..eeed63a 100644 (file)
 #include "undo.h"
 #include "foldersel.h"
 #include "toolbar.h"
-
+#include "inc.h"
 enum
 {
        COL_MIMETYPE = 0,
@@ -419,9 +419,10 @@ static void compose_toggle_encrypt_cb      (gpointer        data,
                                         GtkWidget      *widget);
 static void compose_set_privacy_system_cb(GtkWidget      *widget,
                                          gpointer        data);
-static void compose_update_privacy_system_menu_item(Compose * compose);
+static void compose_update_privacy_system_menu_item(Compose * compose, gboolean warn);
 static void activate_privacy_system     (Compose *compose, 
-                                         PrefsAccount *account);
+                                         PrefsAccount *account,
+                                        gboolean warn);
 static void compose_use_signing(Compose *compose, gboolean use_signing);
 static void compose_use_encryption(Compose *compose, gboolean use_encryption);
 static void compose_toggle_return_receipt_cb(gpointer data, guint action,
@@ -944,7 +945,7 @@ static void compose_force_encryption(Compose *compose, PrefsAccount *account,
        }
        if (privacy != NULL) {
                compose->privacy_system = g_strdup(privacy);
-               compose_update_privacy_system_menu_item(compose);
+               compose_update_privacy_system_menu_item(compose, FALSE);
                compose_use_encryption(compose, TRUE);
        }
 }      
@@ -964,7 +965,7 @@ static void compose_force_signing(Compose *compose, PrefsAccount *account)
        }
        if (privacy != NULL) {
                compose->privacy_system = g_strdup(privacy);
-               compose_update_privacy_system_menu_item(compose);
+               compose_update_privacy_system_menu_item(compose, FALSE);
                compose_use_signing(compose, TRUE);
        }
 }      
@@ -1472,9 +1473,9 @@ void compose_reedit(MsgInfo *msginfo)
                compose->privacy_system = privacy_system;
                compose_use_signing(compose, use_signing);
                compose_use_encryption(compose, use_encryption);
-               compose_update_privacy_system_menu_item(compose);
+               compose_update_privacy_system_menu_item(compose, FALSE);
        } else {
-               activate_privacy_system(compose, account);
+               activate_privacy_system(compose, account, FALSE);
        }
        compose->targetinfo = procmsg_msginfo_copy(msginfo);
 
@@ -2270,7 +2271,7 @@ static void compose_reedit_set_entry(Compose *compose, MsgInfo *msginfo)
        SET_ADDRESS(COMPOSE_FOLLOWUPTO, compose->followup_to);
 
        compose_update_priority_menu_item(compose);
-       compose_update_privacy_system_menu_item(compose);
+       compose_update_privacy_system_menu_item(compose, FALSE);
        compose_show_first_last_header(compose, TRUE);
 }
 
@@ -3341,7 +3342,7 @@ static void compose_select_account(Compose *compose, PrefsAccount *account,
        else
                menu_set_active(ifactory, "/Options/Encrypt", FALSE);
                                       
-       activate_privacy_system(compose, account);
+       activate_privacy_system(compose, account, FALSE);
 
        if (!init && compose->mode != COMPOSE_REDIRECT)
                compose_insert_sig(compose, TRUE);
@@ -5308,7 +5309,7 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
        /* Privacy Systems menu */
        compose_update_privacy_systems_menu(compose);
 
-       activate_privacy_system(compose, account);
+       activate_privacy_system(compose, account, TRUE);
        toolbar_set_style(compose->toolbar->toolbar, compose->handlebox, prefs_common.toolbar_style);
        gtk_widget_show(window);
        
@@ -5427,13 +5428,14 @@ static void compose_set_privacy_system_cb(GtkWidget *widget, gpointer data)
        menu_set_sensitive(ifactory, "/Options/Encrypt", can_encrypt);
 }
 
-static void compose_update_privacy_system_menu_item(Compose * compose)
+static void compose_update_privacy_system_menu_item(Compose * compose, gboolean warn)
 {
        static gchar *branch_path = "/Options/Privacy System";
        GtkItemFactory *ifactory;
        GtkWidget *menuitem = NULL;
        GList *amenu;
        gboolean can_sign = FALSE, can_encrypt = FALSE;
+       gboolean found = FALSE;
 
        ifactory = gtk_item_factory_from_widget(compose->menubar);
 
@@ -5455,7 +5457,7 @@ static void compose_update_privacy_system_menu_item(Compose * compose)
 
                                        can_sign = privacy_system_can_sign(systemid);
                                        can_encrypt = privacy_system_can_encrypt(systemid);
-
+                                       found = TRUE;
                                        break;
                                }
 
@@ -5463,6 +5465,15 @@ static void compose_update_privacy_system_menu_item(Compose * compose)
                }
                if (menuitem != NULL)
                        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
+               
+               if (warn && !found && strlen(compose->privacy_system)) {
+                       gchar *tmp = g_strdup_printf(
+                               _("The privacy system '%s' cannot be loaded. You "
+                                 "will not be able to sign or encrypt this message."),
+                                 compose->privacy_system);
+                       alertpanel_warning(tmp);
+                       g_free(tmp);
+               }
        }
 
        menu_set_sensitive(ifactory, "/Options/Sign", can_sign);
@@ -6534,11 +6545,8 @@ static void compose_send_cb(gpointer data, guint action, GtkWidget *widget)
 {
        Compose *compose = (Compose *)data;
        
-       if (prefs_common.work_offline)
-               if (alertpanel(_("Offline warning"), 
-                              _("You're working offline. Override?"),
-                              GTK_STOCK_YES, GTK_STOCK_NO, NULL) != G_ALERTDEFAULT)
-                       return;
+       if (prefs_common.work_offline && !inc_offline_should_override())
+               return;
        
        if (compose->draft_timeout_tag != -1) { /* CLAWS: disable draft timeout */
                gtk_timeout_remove(compose->draft_timeout_tag);
@@ -7394,11 +7402,11 @@ static void compose_toggle_encrypt_cb(gpointer data, guint action,
                compose->use_encryption = FALSE;
 }
 
-static void activate_privacy_system(Compose *compose, PrefsAccount *account) 
+static void activate_privacy_system(Compose *compose, PrefsAccount *account, gboolean warn
 {
        g_free(compose->privacy_system);
        compose->privacy_system = g_strdup(account->default_privacy_system);
-       compose_update_privacy_system_menu_item(compose);
+       compose_update_privacy_system_menu_item(compose, warn);
 }
 
 static void compose_toggle_ruler_cb(gpointer data, guint action,
index 245e028..d0d1a10 100644 (file)
@@ -46,6 +46,7 @@
 #include "exporthtml.h"
 #include "utils.h"
 #include "manage_window.h"
+#include "filesel.h"
 
 #define PAGE_FILE_INFO             0
 #define PAGE_FORMAT                1
@@ -299,6 +300,8 @@ static void export_html_next( GtkWidget *widget ) {
                if( exp_html_move_format() ) {
                        gtk_notebook_set_current_page(
                                GTK_NOTEBOOK(exphtml_dlg.notebook), PAGE_FINISH );
+                       gtk_button_set_label(GTK_BUTTON(exphtml_dlg.btnCancel),
+                               GTK_STOCK_CLOSE);
                        exp_html_finish_show();
                        exporthtml_save_settings( _exportCtl_ );
                        export_html_message();
@@ -319,75 +322,27 @@ static void export_html_browse( GtkWidget *widget, gpointer data ) {
        g_free( uri );
 }
 
-/**
- * Callback function to accept HTML file selection.
- * \param widget Widget (button).
- * \param data   User data.
- */
-static void exp_html_file_ok( GtkWidget *widget, gpointer data ) {
-       const gchar *sFile;
-       AddressFileSelection *afs;
-       GtkWidget *fileSel;
-
-       afs = ( AddressFileSelection * ) data;
-       fileSel = afs->fileSelector;
-       sFile = gtk_file_selection_get_filename( GTK_FILE_SELECTION(fileSel) );
-
-       afs->cancelled = FALSE;
-       gtk_entry_set_text( GTK_ENTRY(exphtml_dlg.entryHtml), sFile );
-       gtk_widget_hide( afs->fileSelector );
-       gtk_grab_remove( afs->fileSelector );
-       gtk_widget_grab_focus( exphtml_dlg.entryHtml );
-}
-
-/**
- * Callback function to cancel HTML file selection dialog.
- * \param widget Widget (button).
- * \param data   User data.
- */
-static void exp_html_file_cancel( GtkWidget *widget, gpointer data ) {
-       AddressFileSelection *afs = ( AddressFileSelection * ) data;
-       afs->cancelled = TRUE;
-       gtk_widget_hide( afs->fileSelector );
-       gtk_grab_remove( afs->fileSelector );
-       gtk_widget_grab_focus( exphtml_dlg.entryHtml );
-}
-
 /**
  * Create HTML file selection dialog.
  * \param afs Address file selection data.
  */
 static void exp_html_file_select_create( AddressFileSelection *afs ) {
-       GtkWidget *fileSelector;
-
-       fileSelector = gtk_file_selection_new( _("Select HTML Output File") );
-       gtk_file_selection_hide_fileop_buttons( GTK_FILE_SELECTION(fileSelector) );
-       gtk_file_selection_complete( GTK_FILE_SELECTION(fileSelector), "*.html" );
-       g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(fileSelector)->ok_button),
-                        "clicked", 
-                        G_CALLBACK(exp_html_file_ok), (gpointer)afs);
-       g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(fileSelector)->cancel_button),
-                        "clicked", 
-                        G_CALLBACK(exp_html_file_cancel), (gpointer)afs);
-       afs->fileSelector = fileSelector;
-       afs->cancelled = TRUE;
+       gchar *file = filesel_select_file_save(_("Select HTML output file"), NULL);
+       
+       if (file == NULL)
+               afs->cancelled = TRUE;
+       else {
+               afs->cancelled = FALSE;
+               gtk_entry_set_text( GTK_ENTRY(exphtml_dlg.entryHtml), file );
+               g_free(file);
+       }
 }
 
 /**
  * Callback function to display HTML file selection dialog.
  */
 static void exp_html_file_select( void ) {
-       gchar *sFile;
-       if( ! _exp_html_file_selector_.fileSelector )
-               exp_html_file_select_create( & _exp_html_file_selector_ );
-
-       sFile = gtk_editable_get_chars( GTK_EDITABLE(exphtml_dlg.entryHtml), 0, -1 );
-       gtk_file_selection_set_filename(
-               GTK_FILE_SELECTION( _exp_html_file_selector_.fileSelector ),
-               sFile );
-       g_free( sFile );
-       gtk_widget_show( _exp_html_file_selector_.fileSelector );
-       gtk_grab_add( _exp_html_file_selector_.fileSelector );
+       exp_html_file_select_create( & _exp_html_file_selector_ );
 }
 
 /**
@@ -799,6 +754,9 @@ void addressbook_exp_html( AddressCache *cache ) {
        /* Setup GUI */
        if( ! exphtml_dlg.window )
                export_html_create();
+
+       gtk_button_set_label(GTK_BUTTON(exphtml_dlg.btnCancel),
+                            GTK_STOCK_CANCEL);
        exphtml_dlg.cancelled = FALSE;
        gtk_widget_show(exphtml_dlg.window);
        manage_window_set_transient(GTK_WINDOW(exphtml_dlg.window));
index 9995ad2..e08defa 100644 (file)
@@ -46,6 +46,7 @@
 #include "exportldif.h"
 #include "utils.h"
 #include "manage_window.h"
+#include "filesel.h"
 
 #define PAGE_FILE_INFO             0
 #define PAGE_DN                    1
@@ -324,6 +325,8 @@ static void export_ldif_next( GtkWidget *widget ) {
                if( exp_ldif_move_dn() ) {
                        gtk_notebook_set_current_page(
                                GTK_NOTEBOOK(expldif_dlg.notebook), PAGE_FINISH );
+                       gtk_button_set_label(GTK_BUTTON(expldif_dlg.btnCancel),
+                               GTK_STOCK_CLOSE);
                        exp_ldif_finish_show();
                        exportldif_save_settings( _exportCtl_ );
                        export_ldif_message();
@@ -331,75 +334,27 @@ static void export_ldif_next( GtkWidget *widget ) {
        }
 }
 
-/**
- * Callback function to accept LDIF file selection.
- * \param widget Widget (button).
- * \param data   User data.
- */
-static void exp_ldif_file_ok( GtkWidget *widget, gpointer data ) {
-       const gchar *sFile;
-       AddressFileSelection *afs;
-       GtkWidget *fileSel;
-
-       afs = ( AddressFileSelection * ) data;
-       fileSel = afs->fileSelector;
-       sFile = gtk_file_selection_get_filename( GTK_FILE_SELECTION(fileSel) );
-
-       afs->cancelled = FALSE;
-       gtk_entry_set_text( GTK_ENTRY(expldif_dlg.entryLdif), sFile );
-       gtk_widget_hide( afs->fileSelector );
-       gtk_grab_remove( afs->fileSelector );
-       gtk_widget_grab_focus( expldif_dlg.entryLdif );
-}
-
-/**
- * Callback function to cancel LDIF file selection dialog.
- * \param widget Widget (button).
- * \param data   User data.
- */
-static void exp_ldif_file_cancel( GtkWidget *widget, gpointer data ) {
-       AddressFileSelection *afs = ( AddressFileSelection * ) data;
-       afs->cancelled = TRUE;
-       gtk_widget_hide( afs->fileSelector );
-       gtk_grab_remove( afs->fileSelector );
-       gtk_widget_grab_focus( expldif_dlg.entryLdif );
-}
-
 /**
  * Create LDIF file selection dialog.
  * \param afs Address file selection data.
  */
 static void exp_ldif_file_select_create( AddressFileSelection *afs ) {
-       GtkWidget *fileSelector;
-
-       fileSelector = gtk_file_selection_new( _("Select LDIF Output File") );
-       gtk_file_selection_hide_fileop_buttons( GTK_FILE_SELECTION(fileSelector) );
-       gtk_file_selection_complete( GTK_FILE_SELECTION(fileSelector), "*.html" );
-       g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(fileSelector)->ok_button),
-                        "clicked", 
-                        G_CALLBACK(exp_ldif_file_ok), (gpointer)afs);
-       g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(fileSelector)->cancel_button),
-                        "clicked", 
-                        G_CALLBACK(exp_ldif_file_cancel), (gpointer)afs);
-       afs->fileSelector = fileSelector;
-       afs->cancelled = TRUE;
+       gchar *file = filesel_select_file_save(_("Select LDIF output file"), NULL);
+       
+       if (file == NULL)
+               afs->cancelled = TRUE;
+       else {
+               afs->cancelled = FALSE;
+               gtk_entry_set_text( GTK_ENTRY(expldif_dlg.entryLdif), file );
+               g_free(file);
+       }
 }
 
 /**
  * Callback function to display LDIF file selection dialog.
  */
 static void exp_ldif_file_select( void ) {
-       gchar *sFile;
-       if( ! _exp_ldif_file_selector_.fileSelector )
-               exp_ldif_file_select_create( & _exp_ldif_file_selector_ );
-
-       sFile = gtk_editable_get_chars( GTK_EDITABLE(expldif_dlg.entryLdif), 0, -1 );
-       gtk_file_selection_set_filename(
-               GTK_FILE_SELECTION( _exp_ldif_file_selector_.fileSelector ),
-               sFile );
-       g_free( sFile );
-       gtk_widget_show( _exp_ldif_file_selector_.fileSelector );
-       gtk_grab_add( _exp_ldif_file_selector_.fileSelector );
+       exp_ldif_file_select_create( & _exp_ldif_file_selector_ );
 }
 
 /**
@@ -821,6 +776,9 @@ void addressbook_exp_ldif( AddressCache *cache ) {
        /* Setup GUI */
        if( ! expldif_dlg.window )
                export_ldif_create();
+
+       gtk_button_set_label(GTK_BUTTON(expldif_dlg.btnCancel),
+                            GTK_STOCK_CANCEL);
        expldif_dlg.cancelled = FALSE;
        gtk_widget_show(expldif_dlg.window);
        manage_window_set_transient(GTK_WINDOW(expldif_dlg.window));
index 285059d..fcda9d6 100644 (file)
@@ -922,7 +922,7 @@ static int misspelled_test(GtkAspell *gtkaspell, unsigned char *word)
 
 static gboolean iswordsep(unsigned char c) 
 {
-       return !isalpha(c) && c != '\'';
+       return (isspace(c) || ispunct(c)) && c != '\'';
 }
 
 static guchar get_text_index_whar(GtkAspell *gtkaspell, int pos) 
@@ -982,7 +982,11 @@ static gboolean get_word_from_pos(GtkAspell *gtkaspell, gint pos,
                c = get_text_index_whar(gtkaspell, start);
                if (c == '\'') {
                        if (start > 0) {
-                               if (!isalpha(get_text_index_whar(gtkaspell,
+                               if (isspace(get_text_index_whar(gtkaspell,
+                                                                start - 1))
+                               ||  ispunct(get_text_index_whar(gtkaspell,
+                                                                start - 1))
+                               ||  isdigit(get_text_index_whar(gtkaspell,
                                                                 start - 1))) {
                                        /* start_quote = TRUE; */
                                        break;
@@ -993,7 +997,7 @@ static gboolean get_word_from_pos(GtkAspell *gtkaspell, gint pos,
                                break;
                        }
                }
-               else if (!isalpha(c))
+               else if (isspace(c) || ispunct(c) || isdigit(c))
                                break;
        }
 
@@ -1003,7 +1007,11 @@ static gboolean get_word_from_pos(GtkAspell *gtkaspell, gint pos,
                c = get_text_index_whar(gtkaspell, end); 
                if (c == '\'') {
                        if (end < get_textview_buffer_charcount(gtktext)) {
-                               if (!isalpha(get_text_index_whar(gtkaspell,
+                               if (isspace(get_text_index_whar(gtkaspell,
+                                                                end + 1))
+                               ||  ispunct(get_text_index_whar(gtkaspell,
+                                                                end + 1))
+                               ||  isdigit(get_text_index_whar(gtkaspell,
                                                                 end + 1))) {
                                        /* end_quote = TRUE; */
                                        break;
@@ -1014,7 +1022,7 @@ static gboolean get_word_from_pos(GtkAspell *gtkaspell, gint pos,
                                break;
                        }
                }
-               else if(!isalpha(c))
+               else if (isspace(c) || ispunct(c) || isdigit(c))
                                break;
        }
                                                
@@ -1025,11 +1033,18 @@ static gboolean get_word_from_pos(GtkAspell *gtkaspell, gint pos,
 
        if (buf) {
                if (end - start < buflen) {
-                       for (pos = start; pos < end; pos++) {
-                               buf[pos - start] =
-                                       get_text_index_whar(gtkaspell, pos);
-                       }
-                       buf[pos - start] = 0;
+                       GtkTextIter iterstart, iterend;
+                       gchar *tmp, *conv;
+                       GtkTextBuffer *buffer = gtk_text_view_get_buffer(gtktext);
+                       gtk_text_buffer_get_iter_at_offset(buffer, &iterstart, start);
+                       gtk_text_buffer_get_iter_at_offset(buffer, &iterend, end);
+                       tmp = gtk_text_buffer_get_text(buffer, &iterstart, &iterend, FALSE);
+                       conv = conv_iconv_strdup(tmp, CS_UTF_8, 
+                               gtkaspell->gtkaspeller->dictionary->encoding);
+                       g_free(tmp);
+                       strncpy(buf, conv, buflen-1);
+                       buf[buflen]='\0';
+                       g_free(conv);
                } else
                        return FALSE;
        }
@@ -1050,7 +1065,6 @@ static gboolean check_at(GtkAspell *gtkaspell, gint from_pos)
        if (!get_word_from_pos(gtkaspell, from_pos, buf, sizeof(buf), 
                               &start, &end))
                return FALSE;
-
        if (misspelled_test(gtkaspell, buf)) {
                strncpy(gtkaspell->theword, buf, GTKASPELLWORDSIZE - 1);
                gtkaspell->theword[GTKASPELLWORDSIZE - 1] = 0;
@@ -2400,7 +2414,8 @@ static void change_color(GtkAspell * gtkaspell,
        GtkTextBuffer *buffer;
        GtkTextIter startiter, enditer;
 
-       g_return_if_fail(start < end);
+       if (start < end)
+               return;
     
        gtktext = gtkaspell->gtktext;
     
index 5270bd6..1228491 100644 (file)
@@ -29,6 +29,7 @@
 #include <string.h>
 #include "imap.h"
 #include "imap_gtk.h"
+#include "inc.h"
 
 #ifdef HAVE_LIBETPAN
 
@@ -655,7 +656,7 @@ static IMAPSession *imap_session_get(Folder *folder)
        g_return_val_if_fail(FOLDER_CLASS(folder) == &imap_class, NULL);
        g_return_val_if_fail(folder->account != NULL, NULL);
        
-       if (prefs_common.work_offline && !imap_gtk_should_override()) {
+       if (prefs_common.work_offline && !inc_offline_should_override()) {
                return NULL;
        }
 
@@ -722,6 +723,20 @@ static IMAPSession *imap_session_new(Folder * folder,
                : account->ssl_imap == SSL_TUNNEL ? IMAPS_PORT : IMAP4_PORT;
        ssl_type = account->ssl_imap;   
 #else
+       if (account->ssl_imap != SSL_NONE) {
+               if (alertpanel_full(_("Insecure connection"),
+                       _("This connection is configured to be secured "
+                         "using SSL, but SSL is not available in this "
+                         "build of Sylpheed-Claws. \n\n"
+                         "Do you want to continue connecting to this "
+                         "server? The communication would not be "
+                         "secure."),
+                         _("Continue connecting"), 
+                         GTK_STOCK_CANCEL, NULL,
+                         FALSE, NULL, ALERT_WARNING,
+                         G_ALERTALTERNATE) != G_ALERTDEFAULT)
+                       return NULL;
+       }
        port = account->set_imapport ? account->imapport
                : IMAP4_PORT;
 #endif
@@ -1967,7 +1982,7 @@ static GSList *imap_get_uncached_messages(IMAPSession *session,
                data->numlist = newlist;
                data->cur += count;
                
-               if (prefs_common.work_offline && !imap_gtk_should_override()) {
+               if (prefs_common.work_offline && !inc_offline_should_override()) {
                        g_free(data);
                        return NULL;
                }
@@ -2472,7 +2487,7 @@ static gint imap_cmd_fetch(IMAPSession *session, guint32 uid,
        data->headers = headers;
        data->body = body;
 
-       if (prefs_common.work_offline && !imap_gtk_should_override()) {
+       if (prefs_common.work_offline && !inc_offline_should_override()) {
                g_free(data);
                return -1;
        }
@@ -2557,7 +2572,7 @@ static gint imap_cmd_expunge(IMAPSession *session)
 {
        int r;
        
-       if (prefs_common.work_offline && !imap_gtk_should_override()) {
+       if (prefs_common.work_offline && !inc_offline_should_override()) {
                return -1;
        }
 
@@ -2886,7 +2901,7 @@ static gint get_list_of_uids(Folder *folder, IMAPFolderItem *item, GSList **msgn
        data->item = item;
        data->msgnum_list = msgnum_list;
 
-       if (prefs_common.work_offline && !imap_gtk_should_override()) {
+       if (prefs_common.work_offline && !inc_offline_should_override()) {
                g_free(data);
                return -1;
        }
@@ -2907,8 +2922,6 @@ gint imap_get_num_list(Folder *folder, FolderItem *_item, GSList **msgnum_list,
        gboolean selected_folder;
        
        debug_print("get_num_list\n");
-       statusbar_print_all("Scanning %s...\n", FOLDER_ITEM(item)->path 
-                               ? FOLDER_ITEM(item)->path:"");
        
        g_return_val_if_fail(folder != NULL, -1);
        g_return_val_if_fail(item != NULL, -1);
@@ -2919,6 +2932,9 @@ gint imap_get_num_list(Folder *folder, FolderItem *_item, GSList **msgnum_list,
        session = imap_session_get(folder);
        g_return_val_if_fail(session != NULL, -1);
 
+       statusbar_print_all("Scanning %s...\n", FOLDER_ITEM(item)->path 
+                               ? FOLDER_ITEM(item)->path:"");
+
        selected_folder = (session->mbox != NULL) &&
                          (!strcmp(session->mbox, item->item.path));
        if (selected_folder) {
@@ -3549,7 +3565,7 @@ static gint imap_get_flags(Folder *folder, FolderItem *item,
        data->msginfo_list = msginfo_list;
        data->msgflags = msgflags;
 
-       if (prefs_common.work_offline && !imap_gtk_should_override()) {
+       if (prefs_common.work_offline && !inc_offline_should_override()) {
                g_free(data);
                return -1;
        }
index 361e16b..f8d1a52 100644 (file)
@@ -424,28 +424,3 @@ static void download_cb(FolderView *folderview, guint action,
        item = gtk_ctree_node_get_row_data(ctree, folderview->selected);
        imap_gtk_synchronise(item);
 }
-
-gboolean imap_gtk_should_override(void)
-{
-       static time_t overridden_yes = 0;
-       static time_t overridden_no  = 0;
-       gboolean answer = TRUE;
-
-       if (prefs_common.work_offline) {
-               if (time(NULL) - overridden_yes < 600)
-                        return TRUE;
-               else if (time(NULL) - overridden_no < 600)
-                        return FALSE;
-               
-               answer = (alertpanel(_("Offline warning"), 
-                              _("You're working offline. Override during 10 minutes?"),
-                              GTK_STOCK_YES, GTK_STOCK_NO, NULL) == G_ALERTDEFAULT);
-               
-               if (answer == TRUE)
-                       overridden_yes = time(NULL);
-               else
-                       overridden_no  = time(NULL);
-       }
-       return answer;
-       
-}
index 6f7c5b9..c9fc318 100644 (file)
@@ -47,6 +47,7 @@
 #include "mgutils.h"
 #include "ldif.h"
 #include "utils.h"
+#include "filesel.h"
 
 #define IMPORTLDIF_GUESS_NAME      "LDIF Import"
 
@@ -542,6 +543,8 @@ static void imp_ldif_next( GtkWidget *widget ) {
                if( imp_ldif_field_move() ) {
                        gtk_notebook_set_current_page(
                                GTK_NOTEBOOK(impldif_dlg.notebook), PAGE_FINISH );
+                       gtk_button_set_label(GTK_BUTTON(impldif_dlg.btnCancel),
+                                            GTK_STOCK_CLOSE);
                        imp_ldif_finish_show();
                }
        }
@@ -562,72 +565,28 @@ static void imp_ldif_cancel( GtkWidget *widget, gpointer data ) {
        gtk_main_quit();
 }
 
-/**
- * Callback function to accept LDIF file selection.
- * \param widget Widget (button).
- * \param data   User data.
- */
-static void imp_ldif_file_ok( GtkWidget *widget, gpointer data ) {
-       const gchar *sFile;
-       AddressFileSelection *afs;
-       GtkWidget *fileSel;
-
-       afs = ( AddressFileSelection * ) data;
-       fileSel = afs->fileSelector;
-       sFile = gtk_file_selection_get_filename( GTK_FILE_SELECTION(fileSel) );
-
-       afs->cancelled = FALSE;
-       gtk_entry_set_text( GTK_ENTRY(impldif_dlg.entryFile), sFile );
-       gtk_widget_hide( afs->fileSelector );
-       gtk_grab_remove( afs->fileSelector );
-       gtk_widget_grab_focus( impldif_dlg.entryFile );
-}
-
-/**
- * Callback function to cancel LDIF file selection dialog.
- * \param widget Widget (button).
- * \param data   User data.
- */
-static void imp_ldif_file_cancel( GtkWidget *widget, gpointer data ) {
-       AddressFileSelection *afs = ( AddressFileSelection * ) data;
-       afs->cancelled = TRUE;
-       gtk_widget_hide( afs->fileSelector );
-       gtk_grab_remove( afs->fileSelector );
-       gtk_widget_grab_focus( impldif_dlg.entryFile );
-}
 
 /**
  * Create LDIF file selection dialog.
  * \param afs Address file selection data.
  */
 static void imp_ldif_file_select_create( AddressFileSelection *afs ) {
-       GtkWidget *fileSelector;
-
-       fileSelector = gtk_file_selection_new( _("Select LDIF File") );
-       gtk_file_selection_hide_fileop_buttons( GTK_FILE_SELECTION(fileSelector) );
-       g_signal_connect( G_OBJECT (GTK_FILE_SELECTION(fileSelector)->ok_button),
-                         "clicked", G_CALLBACK (imp_ldif_file_ok), ( gpointer ) afs );
-       g_signal_connect( G_OBJECT (GTK_FILE_SELECTION(fileSelector)->cancel_button),
-                         "clicked", G_CALLBACK (imp_ldif_file_cancel), ( gpointer ) afs );
-       afs->fileSelector = fileSelector;
-       afs->cancelled = TRUE;
+       gchar *file = filesel_select_file_open(_("Select LDIF File"), NULL);
+       
+       if (file == NULL)
+               afs->cancelled = TRUE;
+       else {
+               afs->cancelled = FALSE;
+               gtk_entry_set_text( GTK_ENTRY(impldif_dlg.entryFile), file );
+               g_free(file);
+       }
 }
 
 /**
  * Callback function to display LDIF file selection dialog.
  */
 static void imp_ldif_file_select( void ) {
-       gchar *sFile;
-       if( ! _imp_ldif_file_selector_.fileSelector )
-               imp_ldif_file_select_create( & _imp_ldif_file_selector_ );
-
-       sFile = gtk_editable_get_chars( GTK_EDITABLE(impldif_dlg.entryFile), 0, -1 );
-       gtk_file_selection_set_filename(
-               GTK_FILE_SELECTION( _imp_ldif_file_selector_.fileSelector ),
-               sFile );
-       g_free( sFile );
-       gtk_widget_show( _imp_ldif_file_selector_.fileSelector );
-       gtk_grab_add( _imp_ldif_file_selector_.fileSelector );
+       imp_ldif_file_select_create( & _imp_ldif_file_selector_ );
 }
 
 /**
@@ -1031,8 +990,8 @@ static void imp_ldif_dialog_create() {
        gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, BORDER_WIDTH);
 
        /* Button panel */
-       gtkut_stock_button_set_create(&hbbox, &btnPrev, _("Prev"),
-                                     &btnNext, _("Next"),
+       gtkut_stock_button_set_create(&hbbox, &btnPrev, GTK_STOCK_GO_BACK,
+                                     &btnNext, GTK_STOCK_GO_FORWARD,
                                      &btnCancel, GTK_STOCK_CANCEL);
        gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0);
        gtk_container_set_border_width(GTK_CONTAINER(hbbox), 2);
@@ -1082,6 +1041,10 @@ AddressBookFile *addressbook_imp_ldif( AddressIndex *addrIndex ) {
 
        if( ! impldif_dlg.window )
                imp_ldif_create();
+               
+       gtk_button_set_label(GTK_BUTTON(impldif_dlg.btnCancel),
+                            GTK_STOCK_CANCEL);
+
        impldif_dlg.cancelled = FALSE;
        gtk_widget_show(impldif_dlg.window);
        manage_window_set_transient(GTK_WINDOW(impldif_dlg.window));
index 0456a68..8c569ac 100644 (file)
@@ -45,6 +45,7 @@
 #include "manage_window.h"
 #include "mgutils.h"
 #include "mutt.h"
+#include "filesel.h"
 
 #define IMPORTMUTT_GUESS_NAME "MUTT Import"
 
@@ -154,56 +155,20 @@ static void imp_mutt_cancel( GtkWidget *widget, gboolean *cancelled ) {
        gtk_main_quit();
 }
 
-static void imp_mutt_file_ok( GtkWidget *widget, gpointer data ) {
-       const gchar *sFile;
-       AddressFileSelection *afs;
-       GtkWidget *fileSel;
-
-       afs = ( AddressFileSelection * ) data;
-       fileSel = afs->fileSelector;
-       sFile = gtk_file_selection_get_filename( GTK_FILE_SELECTION(fileSel) );
-
-       afs->cancelled = FALSE;
-       gtk_entry_set_text( GTK_ENTRY(impmutt_dlg.file_entry), sFile );
-       gtk_widget_hide( afs->fileSelector );
-       gtk_grab_remove( afs->fileSelector );
-       gtk_widget_grab_focus( impmutt_dlg.file_entry );
-       imp_mutt_status_show( _( "Please select a file to import." ) );
-}
-
-static void imp_mutt_file_cancel( GtkWidget *widget, gpointer data ) {
-       AddressFileSelection *afs = ( AddressFileSelection * ) data;
-       afs->cancelled = TRUE;
-       gtk_widget_hide( afs->fileSelector );
-       gtk_grab_remove( afs->fileSelector );
-       gtk_widget_grab_focus( impmutt_dlg.file_entry );
-}
-
 static void imp_mutt_file_select_create( AddressFileSelection *afs ) {
-       GtkWidget *fileSelector;
-
-       fileSelector = gtk_file_selection_new( _("Select MUTT File") );
-       gtk_file_selection_hide_fileop_buttons( GTK_FILE_SELECTION(fileSelector) );
-       g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(fileSelector)->ok_button),
-                         "clicked", 
-                        G_CALLBACK(imp_mutt_file_ok), (gpointer)afs);
-       g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(fileSelector)->cancel_button),
-                         "clicked", 
-                        G_CALLBACK(imp_mutt_file_cancel), (gpointer)afs);
-       afs->fileSelector = fileSelector;
-       afs->cancelled = TRUE;
+       gchar *file = filesel_select_file_open(_("Select MUTT File"), NULL);
+       
+       if (file == NULL)
+               afs->cancelled = TRUE;
+       else {
+               afs->cancelled = FALSE;
+               gtk_entry_set_text( GTK_ENTRY(impmutt_dlg.file_entry), file );
+               g_free(file);
+       }
 }
 
 static void imp_mutt_file_select( void ) {
-       gchar *sFile;
-       if (! _imp_mutt_file_selector_.fileSelector )
-               imp_mutt_file_select_create( & _imp_mutt_file_selector_ );
-
-       sFile = gtk_editable_get_chars( GTK_EDITABLE(impmutt_dlg.file_entry), 0, -1 );
-       gtk_file_selection_set_filename( GTK_FILE_SELECTION( _imp_mutt_file_selector_.fileSelector ), sFile );
-       g_free( sFile );
-       gtk_widget_show( _imp_mutt_file_selector_.fileSelector );
-       gtk_grab_add( _imp_mutt_file_selector_.fileSelector );
+       imp_mutt_file_select_create( & _imp_mutt_file_selector_ );
 }
 
 static gint imp_mutt_delete_event( GtkWidget *widget, GdkEventAny *event, gboolean *cancelled ) {
index 173aeff..62bd865 100644 (file)
@@ -45,6 +45,7 @@
 #include "manage_window.h"
 #include "mgutils.h"
 #include "pine.h"
+#include "filesel.h"
 
 #define IMPORTPINE_GUESS_NAME "Pine Import"
 
@@ -154,56 +155,20 @@ static void imp_pine_cancel( GtkWidget *widget, gboolean *cancelled ) {
        gtk_main_quit();
 }
 
-static void imp_pine_file_ok( GtkWidget *widget, gpointer data ) {
-       const gchar *sFile;
-       AddressFileSelection *afs;
-       GtkWidget *fileSel;
-
-       afs = ( AddressFileSelection * ) data;
-       fileSel = afs->fileSelector;
-       sFile = gtk_file_selection_get_filename( GTK_FILE_SELECTION(fileSel) );
-
-       afs->cancelled = FALSE;
-       gtk_entry_set_text( GTK_ENTRY(imppine_dlg.file_entry), sFile );
-       gtk_widget_hide( afs->fileSelector );
-       gtk_grab_remove( afs->fileSelector );
-       gtk_widget_grab_focus( imppine_dlg.file_entry );
-       imp_pine_status_show( _( "Please select a file to import." ) );
-}
-
-static void imp_pine_file_cancel( GtkWidget *widget, gpointer data ) {
-       AddressFileSelection *afs = ( AddressFileSelection * ) data;
-       afs->cancelled = TRUE;
-       gtk_widget_hide( afs->fileSelector );
-       gtk_grab_remove( afs->fileSelector );
-       gtk_widget_grab_focus( imppine_dlg.file_entry );
-}
-
 static void imp_pine_file_select_create( AddressFileSelection *afs ) {
-       GtkWidget *fileSelector;
-
-       fileSelector = gtk_file_selection_new( _("Select Pine File") );
-       gtk_file_selection_hide_fileop_buttons( GTK_FILE_SELECTION(fileSelector) );
-       g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(fileSelector)->ok_button),
-                         "clicked", 
-                        G_CALLBACK(imp_pine_file_ok), (gpointer)afs);
-       g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(fileSelector)->cancel_button),
-                         "clicked", 
-                        G_CALLBACK(imp_pine_file_cancel), (gpointer)afs);
-       afs->fileSelector = fileSelector;
-       afs->cancelled = TRUE;
+       gchar *file = filesel_select_file_open(_("Select Pine File"), NULL);
+       
+       if (file == NULL)
+               afs->cancelled = TRUE;
+       else {
+               afs->cancelled = FALSE;
+               gtk_entry_set_text( GTK_ENTRY(imppine_dlg.file_entry), file );
+               g_free(file);
+       }
 }
 
 static void imp_pine_file_select( void ) {
-       gchar *sFile;
-       if (! _imp_pine_file_selector_.fileSelector )
-               imp_pine_file_select_create( & _imp_pine_file_selector_ );
-
-       sFile = gtk_editable_get_chars( GTK_EDITABLE(imppine_dlg.file_entry), 0, -1 );
-       gtk_file_selection_set_filename( GTK_FILE_SELECTION( _imp_pine_file_selector_.fileSelector ), sFile );
-       g_free( sFile );
-       gtk_widget_show( _imp_pine_file_selector_.fileSelector );
-       gtk_grab_add( _imp_pine_file_selector_.fileSelector );
+       imp_pine_file_select_create( & _imp_pine_file_selector_ );
 }
 
 static gint imp_pine_delete_event( GtkWidget *widget, GdkEventAny *event, gboolean *cancelled ) {
index 522dd68..70a8a92 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -166,10 +166,7 @@ void inc_mail(MainWindow *mainwin, gboolean notify)
 
        if (inc_lock_count) return;
 
-       if (prefs_common.work_offline)
-               if (alertpanel(_("Offline warning"), 
-                              _("You're working offline. Override?"),
-                              GTK_STOCK_YES, GTK_STOCK_NO, NULL) != G_ALERTDEFAULT)
+       if (prefs_common.work_offline && !inc_offline_should_override())
                return;
 
        inc_lock();
@@ -271,11 +268,8 @@ gint inc_account_mail(MainWindow *mainwin, PrefsAccount *account)
 
        if (inc_lock_count) return 0;
 
-       if (prefs_common.work_offline)
-               if (alertpanel(_("Offline warning"), 
-                              _("You're working offline. Override?"),
-                              GTK_STOCK_YES, GTK_STOCK_NO, NULL) != G_ALERTDEFAULT)
-                       return 0;
+       if (prefs_common.work_offline && !inc_offline_should_override())
+               return 0;
 
        inc_autocheck_timer_remove();
        main_window_lock(mainwin);
@@ -297,10 +291,7 @@ void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck,
        gint new_msgs = 0;
        gint account_new_msgs = 0;
        
-       if (prefs_common.work_offline)
-               if (alertpanel(_("Offline warning"), 
-                              _("You're working offline. Override?"),
-                              GTK_STOCK_YES, GTK_STOCK_NO, NULL) != G_ALERTDEFAULT)
+       if (prefs_common.work_offline && !inc_offline_should_override())
                return;
 
        if (inc_lock_count) return;
@@ -760,6 +751,20 @@ static IncState inc_pop3_session_do(IncSession *session)
                SESSION(pop3_session)->nonblocking =
                        pop3_session->ac_prefs->use_nonblocking_ssl;
 #else
+       if (pop3_session->ac_prefs->ssl_pop != SSL_NONE) {
+               if (alertpanel_full(_("Insecure connection"),
+                       _("This connection is configured to be secured "
+                         "using SSL, but SSL is not available in this "
+                         "build of Sylpheed-Claws. \n\n"
+                         "Do you want to continue connecting to this "
+                         "server? The communication would not be "
+                         "secure."),
+                         _("Continue connecting"), 
+                         GTK_STOCK_CANCEL, NULL,
+                         FALSE, NULL, ALERT_WARNING,
+                         G_ALERTALTERNATE) != G_ALERTDEFAULT)
+                       return INC_CONNECT_ERROR;
+       }
        port = pop3_session->ac_prefs->set_popport ?
                pop3_session->ac_prefs->popport : 110;
 #endif
@@ -1418,3 +1423,34 @@ static gint inc_autocheck_func(gpointer data)
 
        return FALSE;
 }
+
+gboolean inc_offline_should_override(void)
+{
+       static time_t overridden_yes = 0;
+       static time_t overridden_no  = 0;
+       int length = 600;
+       gboolean answer = TRUE;
+       
+       if (prefs_common.autochk_newmail)
+               length = prefs_common.autochk_itv;
+
+       if (prefs_common.work_offline) {
+               gchar *tmp = g_strdup_printf(
+                               _("You're working offline. Override during %d minutes?"),
+                               length);
+               if (time(NULL) - overridden_yes < length * 10)
+                        return TRUE;
+               else if (time(NULL) - overridden_no < length * 10)
+                        return FALSE;
+               
+               answer = (alertpanel(_("Offline warning"), 
+                              tmp,
+                              GTK_STOCK_YES, GTK_STOCK_NO, NULL) == G_ALERTDEFAULT);
+               g_free(tmp);
+               if (answer == TRUE)
+                       overridden_yes = time(NULL);
+               else
+                       overridden_no  = time(NULL);
+       }
+       return answer;
+}
index c908926..55fba27 100644 (file)
--- a/src/inc.h
+++ b/src/inc.h
@@ -98,5 +98,6 @@ void inc_unlock                       (void);
 void inc_autocheck_timer_init  (MainWindow     *mainwin);
 void inc_autocheck_timer_set   (void);
 void inc_autocheck_timer_remove        (void);
+gboolean inc_offline_should_override(void);
 
 #endif /* __INC_H__ */
index 7511d7c..caef745 100644 (file)
@@ -62,6 +62,7 @@
 #include "filtering.h"
 #include "partial_download.h"
 #include "gedit-print.h"
+#include "inc.h"
 
 static GList *messageview_list = NULL;
 
@@ -693,11 +694,8 @@ static gint disposition_notification_send(MsgInfo *msginfo)
                return -1;
        }
                
-       if (prefs_common.work_offline)
-               if (alertpanel(_("Offline warning"), 
-                              _("You're working offline. Override?"),
-                              GTK_STOCK_YES, GTK_STOCK_NO, NULL) != G_ALERTDEFAULT)
-                       return 0;
+       if (prefs_common.work_offline && !inc_offline_should_override())
+               return 0;
 
        /* send it */
        path = folder_item_fetch_msg(queue, num);
index 417755f..872bdf4 100644 (file)
@@ -51,6 +51,8 @@
 #include "progressindicator.h"
 #include "remotefolder.h"
 #include "alertpanel.h"
+#include "inc.h"
+
 #if USE_OPENSSL
 #  include "ssl.h"
 #endif
@@ -243,6 +245,20 @@ static Session *news_session_new_for_folder(Folder *folder)
        session = news_session_new(ac->nntp_server, port, userid, passwd,
                                   ac->ssl_nntp);
 #else
+       if (ac->ssl_nntp != SSL_NONE) {
+               if (alertpanel_full(_("Insecure connection"),
+                       _("This connection is configured to be secured "
+                         "using SSL, but SSL is not available in this "
+                         "build of Sylpheed-Claws. \n\n"
+                         "Do you want to continue connecting to this "
+                         "server? The communication would not be "
+                         "secure."),
+                         _("Continue connecting"), 
+                         GTK_STOCK_CANCEL, NULL,
+                         FALSE, NULL, ALERT_WARNING,
+                         G_ALERTALTERNATE) != G_ALERTDEFAULT)
+                       return NULL;
+       }
        port = ac->set_nntpport ? ac->nntpport : NNTP_PORT;
        session = news_session_new(ac->nntp_server, port, userid, passwd);
 #endif
@@ -262,7 +278,7 @@ static NNTPSession *news_session_get(Folder *folder)
        g_return_val_if_fail(FOLDER_CLASS(folder) == &news_class, NULL);
        g_return_val_if_fail(folder->account != NULL, NULL);
 
-       if (prefs_common.work_offline && !news_gtk_should_override()) {
+       if (prefs_common.work_offline && !inc_offline_should_override()) {
                return NULL;
        }
 
index 2c9424a..0763965 100644 (file)
@@ -73,30 +73,6 @@ static FolderViewPopup news_popup =
        set_sensitivity
 };
 
-gboolean news_gtk_should_override(void)
-{
-       static time_t overridden_yes = 0;
-       static time_t overridden_no  = 0;
-       gboolean answer = TRUE;
-
-       if (prefs_common.work_offline) {
-               if (time(NULL) - overridden_yes < 600)
-                        return TRUE;
-               else if (time(NULL) - overridden_no < 3)
-                        return FALSE;
-               
-               answer = (alertpanel(_("Offline warning"), 
-                              _("You're working offline. Override during 10 minutes?"),
-                              GTK_STOCK_YES, GTK_STOCK_NO, NULL) == G_ALERTDEFAULT);
-               
-               if (answer == TRUE)
-                       overridden_yes = time(NULL);
-               else
-                       overridden_no  = time(NULL);
-       }
-       return answer;
-}
-
 void news_gtk_init(void)
 {
        guint i, n_entries;
index 9495841..aa676ce 100644 (file)
@@ -27,6 +27,5 @@
 #include "folder.h"
 
 void news_gtk_init(void);
-gboolean news_gtk_should_override(void);
 void news_gtk_synchronise(FolderItem *item);
 #endif /* NEWS_GTK_H */
index c7b9847..fa8c42a 100644 (file)
@@ -450,6 +450,19 @@ static PrefParam param[] = {
        {"use_nonblocking_ssl", "1", &tmp_ac_prefs.use_nonblocking_ssl, P_BOOL,
         &ssl.use_nonblocking_ssl_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
+#else
+       /* SSL */
+       {"ssl_pop", "0", &tmp_ac_prefs.ssl_pop, P_ENUM,
+        NULL, NULL, NULL},
+       {"ssl_imap", "0", &tmp_ac_prefs.ssl_imap, P_ENUM,
+        NULL, NULL, NULL},
+       {"ssl_nntp", "0", &tmp_ac_prefs.ssl_nntp, P_ENUM,
+        NULL, NULL, NULL},
+       {"ssl_smtp", "0", &tmp_ac_prefs.ssl_smtp, P_ENUM,
+        NULL, NULL, NULL},
+
+       {"use_nonblocking_ssl", "1", &tmp_ac_prefs.use_nonblocking_ssl, P_BOOL,
+        NULL, NULL, NULL},
 #endif /* USE_OPENSSL */
 
        /* Advanced */
index ece1692..82c16ea 100644 (file)
@@ -23,7 +23,7 @@
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
 #endif
-
+#include "ssl.h"
 typedef struct _PrefsAccount   PrefsAccount;
 
 typedef enum {
@@ -71,13 +71,11 @@ struct _PrefsAccount
        gboolean use_mail_command;
        gchar * mail_command;
 
-#if USE_OPENSSL
        SSLType ssl_pop;
        SSLType ssl_imap;
        SSLType ssl_nntp;
        SSLType ssl_smtp;
        gboolean use_nonblocking_ssl;
-#endif /* USE_OPENSSL */
 
        /* Temporarily preserved password */
        gchar *tmp_pass;
index 1af7329..969ffbc 100644 (file)
@@ -255,6 +255,20 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g
                if (ac_prefs->ssl_smtp != SSL_NONE)
                        session->nonblocking = ac_prefs->use_nonblocking_ssl;
        #else
+               if (ac_prefs->ssl_smtp != SSL_NONE) {
+                       if (alertpanel_full(_("Insecure connection"),
+                               _("This connection is configured to be secured "
+                                 "using SSL, but SSL is not available in this "
+                                 "build of Sylpheed-Claws. \n\n"
+                                 "Do you want to continue connecting to this "
+                                 "server? The communication would not be "
+                                 "secure."),
+                                 _("Continue connecting"), 
+                                 GTK_STOCK_CANCEL, NULL,
+                                 FALSE, NULL, ALERT_WARNING,
+                                 G_ALERTALTERNATE) != G_ALERTDEFAULT)
+                               return -1;
+               }
                port = ac_prefs->set_smtpport ? ac_prefs->smtpport : SMTP_PORT;
        #endif