2005-02-25 [paul] 1.0.1cvs19
authorPaul Mangan <paul@claws-mail.org>
Fri, 25 Feb 2005 10:12:50 +0000 (10:12 +0000)
committerPaul Mangan <paul@claws-mail.org>
Fri, 25 Feb 2005 10:12:50 +0000 (10:12 +0000)
* src/prefs_account.c
* src/prefs_folder_item.c
* src/gtk/prefswindow.c
* src/gtk/prefswindow.h
fix bug 698 'Clicking OK without username 'crashes'
account edit window'. Patch by Alfons

ChangeLog.claws
PATCHSETS
configure.ac
src/gtk/prefswindow.c
src/gtk/prefswindow.h
src/prefs_account.c
src/prefs_folder_item.c

index 5754afb..7965006 100644 (file)
@@ -1,3 +1,12 @@
+2005-02-25 [paul]      1.0.1cvs19
+
+       * src/prefs_account.c
+       * src/prefs_folder_item.c
+       * src/gtk/prefswindow.c
+       * src/gtk/prefswindow.h
+               fix bug 698 'Clicking OK without username 'crashes'
+               account edit window'. Patch by Alfons
+
 2005-02-24 [colin]     1.0.1cvs18
 
        * src/messageview.c
index a6b2ea3..daec3f6 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.477 -r 1.478 src/compose.c; cvs diff -u -r 1.177 -r 1.178 src/procmsg.c; ) > 1.0.1cvs16.patchset
 ( cvs diff -u -r 1.478 -r 1.479 src/compose.c; ) > 1.0.1cvs17.patchset
 ( cvs diff -u -r 1.134 -r 1.135 src/messageview.c; ) > 1.0.1cvs18.patchset
+( cvs diff -u -r 1.123 -r 1.124 src/prefs_account.c; cvs diff -u -r 1.63 -r 1.64 src/prefs_folder_item.c; cvs diff -u -r 1.20 -r 1.21 src/gtk/prefswindow.c; cvs diff -u -r 1.9 -r 1.10 src/gtk/prefswindow.h; ) > 1.0.1cvs19.patchset
index df18a2c..83f3a27 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=0
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=18
+EXTRA_VERSION=19
 EXTRA_RELEASE=
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
index 42f6dcd..78f7a0e 100644 (file)
@@ -117,6 +117,20 @@ static void save_all_pages(GSList *prefs_pages)
        }
 }
 
+static gboolean query_can_close_all_pages(GSList *prefs_pages)
+{
+       GSList *cur;
+
+       for (cur = prefs_pages; cur != NULL; cur = g_slist_next(cur)) {
+               PrefsPage *page = (PrefsPage *) cur->data;
+
+               if (page->can_close)
+                       if (!page->can_close(page))
+                               return FALSE;
+       }
+       return TRUE;
+}
+
 static void close_all_pages(GSList *prefs_pages)
 {
        GSList *cur;
@@ -154,8 +168,10 @@ static void ok_button_released(GtkButton *button, gpointer user_data)
 {
        PrefsWindow *prefswindow = (PrefsWindow *) user_data;
 
-       save_all_pages(prefswindow->prefs_pages);
-       close_prefs_window(prefswindow);
+       if (query_can_close_all_pages(prefswindow->prefs_pages)) {
+               save_all_pages(prefswindow->prefs_pages);
+               close_prefs_window(prefswindow);
+       }               
 }
 
 static void cancel_button_released(GtkButton *button, gpointer user_data)
index b3122ab..93f4b89 100644 (file)
@@ -28,6 +28,7 @@ typedef struct _PrefsPage PrefsPage;
 typedef void (*PrefsCreateWidgetFunc) (PrefsPage *, GtkWindow *window, gpointer);
 typedef void (*PrefsDestroyWidgetFunc) (PrefsPage *);
 typedef void (*PrefsSavePageFunc) (PrefsPage *);
+typedef gboolean (*PrefsCanClosePageFunc) (PrefsPage *);
 
 struct _PrefsPage
 {
@@ -39,12 +40,14 @@ struct _PrefsPage
        PrefsCreateWidgetFunc     create_widget;
        PrefsDestroyWidgetFunc    destroy_widget;
        PrefsSavePageFunc         save_page;
+       PrefsCanClosePageFunc     can_close;
 };
 
 void prefswindow_open_full             (const gchar *title, 
                                         GSList *prefs_pages,
                                         gpointer data,
                                         GtkDestroyNotify func);
+
 void prefswindow_open                  (const gchar *title, 
                                         GSList *prefs_pages,
                                         gpointer data);
index f0a11c9..7cbbe28 100644 (file)
@@ -658,6 +658,11 @@ static void destroy_widget_func(PrefsPage *_page)
        gtk_container_remove(GTK_CONTAINER (page->vbox), notebook);
 }
 
+static gboolean can_close_func(PrefsPage *page_)
+{      
+       return prefs_account_apply() >= 0;
+}
+
 static void save_func(PrefsPage * _page)
 {
        if (prefs_account_apply() >= 0)
@@ -676,6 +681,7 @@ void prefs_account_init()
         account_page.page.create_widget = create_widget_func;
         account_page.page.destroy_widget = destroy_widget_func;
         account_page.page.save_page = save_func;
+       account_page.page.can_close = can_close_func;
 
         prefs_account_register_page((PrefsPage *) &account_page);
 }
index 9b52af6..9164f0a 100644 (file)
@@ -759,11 +759,10 @@ static void folder_color_set_dialog(GtkWidget *widget, gpointer data)
 }
 
 
-FolderItemGeneralPage folder_item_general_page;
-
 static void register_general_page()
 {
        static gchar *pfi_general_path[2];
+       static FolderItemGeneralPage folder_item_general_page;
 
        pfi_general_path[0] = _("General");
        pfi_general_path[1] = NULL;
@@ -776,11 +775,11 @@ static void register_general_page()
        prefs_folder_item_register_page((PrefsPage *) &folder_item_general_page);
 }
 
-FolderItemComposePage folder_item_compose_page;
 
 static void register_compose_page(void)
 {
        static gchar *pfi_compose_path[2];
+       static FolderItemComposePage folder_item_compose_page;
 
        pfi_compose_path[0] = _("Compose");
        pfi_compose_path[1] = NULL;