2007-04-27 [wwp] 2.9.1cvs32
authorTristan Chabredier <wwp@claws-mail.org>
Fri, 27 Apr 2007 21:07:03 +0000 (21:07 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Fri, 27 Apr 2007 21:07:03 +0000 (21:07 +0000)
* src/account.c
* src/prefs_account.c
* src/prefs_account.h
Don't reflect accounts changes to the mainwindow when it's
not necessary.

ChangeLog
PATCHSETS
configure.ac
src/account.c
src/prefs_account.c
src/prefs_account.h

index 61f205f06ad3e39c16ac8a823379727ea4e1b3f3..929afa67719e1ace4b4f4f349e251fd960049350 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-04-27 [wwp]       2.9.1cvs32
+
+       * src/account.c
+       * src/prefs_account.c
+       * src/prefs_account.h
+               Don't reflect accounts changes to the mainwindow when it's
+               not necessary.
+
 2007-04-27 [colin]     2.9.1cvs31
 
        * src/folder.c
index 252f1d4e4a1052034b3ae7d3d36469bb3e621cd7..eefdc683518e6d08bae63598e79c4d68bcb1fe98 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.179.2.169 -r 1.179.2.170 src/imap.c;  ) > 2.9.1cvs29.patchset
 ( cvs diff -u -r 1.274.2.186 -r 1.274.2.187 src/mainwindow.c;  cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/prefs_logging.c;  ) > 2.9.1cvs30.patchset
 ( cvs diff -u -r 1.213.2.142 -r 1.213.2.143 src/folder.c;  cvs diff -u -r 1.179.2.170 -r 1.179.2.171 src/imap.c;  cvs diff -u -r 1.105.2.92 -r 1.105.2.93 src/prefs_account.c;  cvs diff -u -r 1.49.2.25 -r 1.49.2.26 src/prefs_account.h;  cvs diff -u -r 1.1.4.78 -r 1.1.4.79 src/etpan/imap-thread.c;  cvs diff -u -r 1.1.4.15 -r 1.1.4.16 src/etpan/imap-thread.h;  ) > 2.9.1cvs31.patchset
+( cvs diff -u -r 1.61.2.61 -r 1.61.2.62 src/account.c;  cvs diff -u -r 1.105.2.93 -r 1.105.2.94 src/prefs_account.c;  cvs diff -u -r 1.49.2.26 -r 1.49.2.27 src/prefs_account.h;  ) > 2.9.1cvs32.patchset
index 4f9014935fc8a03fd683dc64cce260cd33a1e101..082a0637495377ea3fd008b9282dd4288115b5c4 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=31
+EXTRA_VERSION=32
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 3e9425cabf348dd4a219ba826d54408211c5085e..1a8bb8b902d345a29ab58d580284a37e6a89381d 100644 (file)
@@ -79,6 +79,7 @@ typedef enum
 PrefsAccount *cur_account;
 
 static GList *account_list = NULL;
+static gboolean account_list_dirty = FALSE;
 
 static struct EditAccount {
        GtkWidget *window;
@@ -180,6 +181,14 @@ static void account_row_changed_while_drag_drop    (GtkTreeModel *model,
                                                 gpointer      arg3,
                                                 GtkTreeView  *list_view);
 
+void account_flush_state(void)
+{
+       account_set_menu();
+       main_window_reflect_prefs_all();
+
+       account_list_dirty = FALSE;
+}
+
 void account_read_config_all(void)
 {
        GSList *ac_label_list = NULL, *cur;
@@ -368,6 +377,8 @@ void account_edit_open(void)
 {
        inc_lock();
 
+       account_list_dirty = FALSE;
+
        if (compose_get_compose_list()) {
                alertpanel_error(_("Some composing windows are open.\n"
                                   "Please close all the composing "
@@ -394,7 +405,7 @@ void account_add(void)
 {
        PrefsAccount *ac_prefs;
 
-       ac_prefs = prefs_account_open(NULL);
+       ac_prefs = prefs_account_open(NULL, &account_list_dirty);
 
        if (!ac_prefs) return;
 
@@ -433,6 +444,7 @@ void account_open(PrefsAccount *ac_prefs)
 {
        gboolean prev_default;
        gchar *ac_name;
+       gboolean account_dirty = FALSE;
 
        g_return_if_fail(ac_prefs != NULL);
 
@@ -440,20 +452,22 @@ void account_open(PrefsAccount *ac_prefs)
        Xstrdup_a(ac_name, ac_prefs->account_name ? ac_prefs->account_name : "",
                  return);
 
-       prefs_account_open(ac_prefs);
+       prefs_account_open(ac_prefs, &account_dirty);
 
-       if (!prev_default && ac_prefs->is_default)
-               account_set_as_default(ac_prefs);
+       if (account_dirty) {
+               if (!prev_default && ac_prefs->is_default)
+                       account_set_as_default(ac_prefs);
 
-       if (ac_prefs->folder && strcmp2(ac_name, ac_prefs->account_name) != 0) {
-               folder_set_name(FOLDER(ac_prefs->folder),
-                               ac_prefs->account_name);
-               folderview_set_all();
-       }
+               if (ac_prefs->folder && strcmp2(ac_name, ac_prefs->account_name) != 0) {
+                       folder_set_name(FOLDER(ac_prefs->folder),
+                                       ac_prefs->account_name);
+                       folderview_set_all();
+               }
 
-       account_write_config_all();
-       account_set_menu();
-       main_window_reflect_prefs_all();
+               account_write_config_all();
+
+               account_flush_state();
+       }
 }
 
 static void account_set_as_default(PrefsAccount *ac_prefs)
@@ -871,6 +885,7 @@ static void account_clone(GtkWidget *widget, gpointer data)
                alertpanel_error(_("Accounts with remote folders cannot be copied."));
                return;
        }
+       account_list_dirty = TRUE;
        
        ac_clon = prefs_account_new();
        /* copy fields */
@@ -1020,6 +1035,7 @@ static void account_delete(GtkWidget *widget, gpointer data)
                            GTK_STOCK_CANCEL, GTK_STOCK_DELETE, NULL, FALSE,
                            NULL, ALERT_WARNING, G_ALERTDEFAULT) != G_ALERTALTERNATE)
                return;
+       account_list_dirty = TRUE;
 
        if (ac_prefs->folder) {
                FolderItem *item;
@@ -1073,6 +1089,7 @@ static void account_up(GtkWidget *widget, gpointer data)
        
        if (!sel) 
                return;
+       account_list_dirty = TRUE;
 
        up = gtk_tree_path_copy(sel);
        if (!up) {
@@ -1112,6 +1129,7 @@ static void account_down(GtkWidget *widget, gpointer data)
        
        if (!sel) 
                return;
+       account_list_dirty = TRUE;
 
        dn = gtk_tree_path_copy(sel);
        if (!dn) {
@@ -1156,8 +1174,7 @@ static void account_set_default(GtkWidget *widget, gpointer data)
        account_list_view_set();
        
        cur_account = ac_prefs;
-       account_set_menu();
-       main_window_reflect_prefs_all();
+       account_flush_state();
 }
 
 static void account_edit_close(GtkWidget *widget, gpointer data)
@@ -1171,8 +1188,8 @@ static void account_edit_close(GtkWidget *widget, gpointer data)
                cur_account = ac_prefs;
        }
 
-       account_set_menu();
-       main_window_reflect_prefs_all();
+       if (account_list_dirty)
+               account_flush_state();
 
        gtk_widget_hide(edit_account.window);
 
index 06d85c4f43eba3c064f3bd6dbcaa1aa73970aff1..aa436db06a9ed8e3073e733a9de9276bdf5bc378 100644 (file)
@@ -1063,7 +1063,7 @@ static void destroy_dialog(gpointer data)
        gtk_main_quit();
 }
 
-PrefsAccount *prefs_account_open(PrefsAccount *ac_prefs)
+PrefsAccount *prefs_account_open(PrefsAccount *ac_prefs, gboolean *dirty)
 {
        gchar *title;
 
@@ -1095,6 +1095,8 @@ PrefsAccount *prefs_account_open(PrefsAccount *ac_prefs)
 
        inc_unlock();
 
+       if (!cancelled && dirty != NULL)
+               *dirty = TRUE;
        if (cancelled && new_account) {
                prefs_account_free(ac_prefs);
                return NULL;
index df32b877814dc1312a1c8d5d742d7f99b105155c..54f02d8aa9e04d7ace1e47ede71110fc982d1020 100644 (file)
@@ -199,7 +199,7 @@ void prefs_account_write_config_all (GList          *account_list);
 
 void prefs_account_free                        (PrefsAccount   *ac_prefs);
 
-PrefsAccount *prefs_account_open       (PrefsAccount   *ac_prefs);
+PrefsAccount *prefs_account_open       (PrefsAccount   *ac_prefs, gboolean *dirty);
 
 const gchar *prefs_account_get_privacy_prefs(PrefsAccount *account, gchar *id);
 void prefs_account_set_privacy_prefs(PrefsAccount *account, gchar *id, gchar *new_value);