2008-03-06 [wwp] 3.3.1cvs14
authorTristan Chabredier <wwp@claws-mail.org>
Thu, 6 Mar 2008 16:06:46 +0000 (16:06 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Thu, 6 Mar 2008 16:06:46 +0000 (16:06 +0000)
* src/prefs_account.c
* src/prefs_folder_item.c
* src/prefs_gtk.c
* src/prefs_template.c
* src/gtk/prefswindow.c
* src/gtk/prefswindow.h
prefs_templates: fix missing unregistering of addr_completion widgets
and and ending of addr_completion service.
prefs_folder_item: fix missing registering/unregistering of widgets,
and rework the way add_completion service is started and stopped.
Plus few prefswindow API changes (opening).

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

index 8bd40d4..468a816 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2008-03-06 [wwp]       3.3.1cvs14
+
+       * src/prefs_account.c
+       * src/prefs_folder_item.c
+       * src/prefs_gtk.c
+       * src/prefs_template.c
+       * src/gtk/prefswindow.c
+       * src/gtk/prefswindow.h
+               prefs_templates: fix missing unregistering of addr_completion widgets
+               and and ending of addr_completion service.
+               prefs_folder_item: fix missing registering/unregistering of widgets,
+               and rework the way add_completion service is started and stopped.
+               Plus few prefswindow API changes (opening).
+
 2008-03-06 [wwp]       3.3.1cvs13
 
        * src/folder_item_prefs.c
index 92a24e2..62aa0b7 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.395.2.356 -r 1.395.2.357 src/summaryview.c;  cvs diff -u -r 1.68.2.43 -r 1.68.2.44 src/summaryview.h;  ) > 3.3.1cvs11.patchset
 ( cvs diff -u -r 1.382.2.441 -r 1.382.2.442 src/compose.c;  cvs diff -u -r 1.2.2.28 -r 1.2.2.29 src/folder_item_prefs.c;  cvs diff -u -r 1.2.2.16 -r 1.2.2.17 src/folder_item_prefs.h;  cvs diff -u -r 1.105.2.126 -r 1.105.2.127 src/prefs_account.c;  cvs diff -u -r 1.52.2.59 -r 1.52.2.60 src/prefs_folder_item.c;  cvs diff -u -r 1.1.2.27 -r 1.1.2.28 src/prefs_quote.c;  cvs diff -u -r 1.12.2.58 -r 1.12.2.59 src/prefs_template.c;  cvs diff -u -r 1.8.2.29 -r 1.8.2.30 src/quote_fmt.c;  cvs diff -u -r 1.5.12.16 -r 1.5.12.17 src/quote_fmt.h;  cvs diff -u -r 1.2.4.25 -r 1.2.4.26 src/common/template.c;  cvs diff -u -r 1.1.4.9 -r 1.1.4.10 src/common/template.h;  ) > 3.3.1cvs12.patchset
 ( cvs diff -u -r 1.2.2.29 -r 1.2.2.30 src/folder_item_prefs.c;  cvs diff -u -r 1.12.2.59 -r 1.12.2.60 src/prefs_template.c;  cvs diff -u -r 1.1.16.8 -r 1.1.16.9 src/prefs_template.h;  cvs diff -u -r 1.8.2.30 -r 1.8.2.31 src/quote_fmt.c;  cvs diff -u -r 1.2.4.26 -r 1.2.4.27 src/common/template.c;  ) > 3.3.1cvs13.patchset
+( cvs diff -u -r 1.105.2.127 -r 1.105.2.128 src/prefs_account.c;  cvs diff -u -r 1.52.2.60 -r 1.52.2.61 src/prefs_folder_item.c;  cvs diff -u -r 1.10.2.36 -r 1.10.2.37 src/prefs_gtk.c;  cvs diff -u -r 1.12.2.60 -r 1.12.2.61 src/prefs_template.c;  cvs diff -u -r 1.12.2.44 -r 1.12.2.45 src/gtk/prefswindow.c;  cvs diff -u -r 1.7.2.11 -r 1.7.2.12 src/gtk/prefswindow.h;  ) > 3.3.1cvs14.patchset
index 6d55e8a..a6f97f8 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=3
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=13
+EXTRA_VERSION=14
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 7975885..2331cab 100644 (file)
@@ -64,6 +64,8 @@ struct _PrefsWindow
        GtkWidget *apply_btn;
        gint *save_width;
        gint *save_height;
+       PrefsCloseCallbackFunc open_cb;
+       PrefsCloseCallbackFunc close_cb;
 
        GtkWidget *empty_page;
 
@@ -176,6 +178,9 @@ static void close_prefs_window(PrefsWindow *prefswindow)
 
        close_all_pages(prefswindow->prefs_pages);
 
+       if (prefswindow->close_cb)
+               prefswindow->close_cb(GTK_WINDOW(prefswindow->window));
+
        gtk_widget_destroy(prefswindow->window);
        g_slist_free(prefswindow->prefs_pages);
        if(prefswindow->func != NULL)
@@ -410,7 +415,9 @@ static void prefswindow_build_tree(GtkWidget *tree_view, GSList *prefs_pages,
 void prefswindow_open_full(const gchar *title, GSList *prefs_pages,
                                                         gpointer data, GtkDestroyNotify func,
                                                         gint *save_width, gint *save_height,
-                                                        gboolean preload_pages, gboolean activate_child)
+                                                        gboolean preload_pages, gboolean activate_child,
+                                                        PrefsOpenCallbackFunc open_cb,
+                                                        PrefsCloseCallbackFunc close_cb)
 {
        PrefsWindow *prefswindow;
        gint x = gdk_screen_width();
@@ -426,6 +433,8 @@ void prefswindow_open_full(const gchar *title, GSList *prefs_pages,
        prefswindow->prefs_pages = g_slist_copy(prefs_pages);
        prefswindow->save_width = save_width;
        prefswindow->save_height = save_height;
+       prefswindow->open_cb = open_cb;
+       prefswindow->close_cb = close_cb;
 
        prefswindow->window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefswindow");
        gtk_window_set_title(GTK_WINDOW(prefswindow->window), title);
@@ -504,6 +513,9 @@ void prefswindow_open_full(const gchar *title, GSList *prefs_pages,
        prefswindow_build_tree(prefswindow->tree_view, prefs_pages, prefswindow,
                                                        preload_pages, activate_child);
 
+       if (open_cb)
+               open_cb(GTK_WINDOW(prefswindow->window));
+
        gtk_widget_grab_focus(prefswindow->tree_view);
 
 #ifndef MAEMO
@@ -593,10 +605,12 @@ void prefswindow_open_full(const gchar *title, GSList *prefs_pages,
 }
 
 void prefswindow_open(const gchar *title, GSList *prefs_pages, gpointer data,
-                                        gint *save_width, gint *save_height)
+                                        gint *save_width, gint *save_height,
+                                        PrefsOpenCallbackFunc open_cb,
+                                        PrefsCloseCallbackFunc close_cb)
 {
        prefswindow_open_full(title, prefs_pages, data, NULL, save_width, save_height,
-                                                 FALSE, FALSE);
+                                                 FALSE, FALSE, open_cb, close_cb);
 }
 
 /*!
index 7f9434b..306ec7e 100644 (file)
@@ -29,7 +29,8 @@ typedef void (*PrefsCreateWidgetFunc) (PrefsPage *, GtkWindow *window, gpointer)
 typedef void (*PrefsDestroyWidgetFunc) (PrefsPage *);
 typedef void (*PrefsSavePageFunc) (PrefsPage *);
 typedef gboolean (*PrefsCanClosePageFunc) (PrefsPage *);
-
+typedef void (*PrefsOpenCallbackFunc) (GtkWindow *);
+typedef void (*PrefsCloseCallbackFunc) (GtkWindow *);
 
 struct _PrefsPage
 {
@@ -49,11 +50,15 @@ void prefswindow_open_full          (const gchar *title,
                                         gpointer data,
                                         GtkDestroyNotify func,
                                         gint *save_width, gint *save_height,
-                                        gboolean preload_pages, gboolean activate_child);
+                                        gboolean preload_pages, gboolean activate_child,
+                                        PrefsOpenCallbackFunc open_cb,
+                                        PrefsCloseCallbackFunc close_cb);
 
 void prefswindow_open                  (const gchar *title, 
                                         GSList *prefs_pages,
                                         gpointer data,
-                                        gint *save_width, gint *save_height);
+                                        gint *save_width, gint *save_height,
+                                        PrefsOpenCallbackFunc open_cb,
+                                        PrefsCloseCallbackFunc close_cb);
 
 #endif
index fab1b1a..f356c08 100644 (file)
@@ -3399,7 +3399,8 @@ PrefsAccount *prefs_account_open(PrefsAccount *ac_prefs, gboolean *dirty)
 
        prefswindow_open_full(title, prefs_pages, ac_prefs, destroy_dialog,
                        &prefs_common.editaccountwin_width, &prefs_common.editaccountwin_height,
-                       TRUE, TRUE);
+                       TRUE, TRUE,
+                       NULL, NULL);
        g_free(title);
        gtk_main();
 
index b833e14..dd33f5b 100644 (file)
@@ -1003,8 +1003,6 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
        page->default_alt_dictionary_rec_checkbtn = default_alt_dictionary_rec_checkbtn;
 #endif
 
-       address_completion_start(page->window);
-
        page->page.widget = table;
 }
 
@@ -1016,7 +1014,6 @@ static void prefs_folder_item_compose_destroy_widget_func(PrefsPage *page_)
                address_completion_unregister_entry(GTK_ENTRY(page->entry_default_to));
        if (page->entry_default_reply_to)
                address_completion_unregister_entry(GTK_ENTRY(page->entry_default_reply_to));
-       address_completion_end(page->window);
 }
 
 /** \brief  Save the prefs in page to folder.
@@ -1184,6 +1181,8 @@ static void prefs_folder_item_templates_create_widget_func(PrefsPage * page_,
                                &page->compose_subject_format,
                                &page->compose_body_format,
                                FALSE);
+       address_completion_register_entry(GTK_ENTRY(page->compose_override_from_format),
+                       TRUE);
 
        new_msg_format_rec_checkbtn = gtk_check_button_new_with_label(
                        _("Apply to subfolders"));
@@ -1203,6 +1202,8 @@ static void prefs_folder_item_templates_create_widget_func(PrefsPage * page_,
                                &page->reply_quotemark,
                                &page->reply_body_format,
                                FALSE);
+       address_completion_register_entry(GTK_ENTRY(page->reply_override_from_format),
+                       TRUE);
 
        reply_format_rec_checkbtn = gtk_check_button_new_with_label(
                        _("Apply to subfolders"));
@@ -1222,6 +1223,8 @@ static void prefs_folder_item_templates_create_widget_func(PrefsPage * page_,
                                &page->forward_quotemark,
                                &page->forward_body_format,
                                FALSE);
+       address_completion_register_entry(GTK_ENTRY(page->forward_override_from_format),
+                       TRUE);
 
        forward_format_rec_checkbtn = gtk_check_button_new_with_label(
                        _("Apply to subfolders"));
@@ -1271,7 +1274,14 @@ static void prefs_folder_item_templates_create_widget_func(PrefsPage * page_,
 
 static void prefs_folder_item_templates_destroy_widget_func(PrefsPage *page_) 
 {
-       /* FolderItemTemplatesPage *page = (FolderItemTemplatesPage *) page_; */
+       FolderItemTemplatesPage *page = (FolderItemTemplatesPage *) page_;
+
+       if (page->compose_override_from_format)
+               address_completion_unregister_entry(GTK_ENTRY(page->compose_override_from_format));             
+       if (page->reply_override_from_format)
+               address_completion_unregister_entry(GTK_ENTRY(page->reply_override_from_format));               
+       if (page->forward_override_from_format)
+               address_completion_unregister_entry(GTK_ENTRY(page->forward_override_from_format));             
 }
 
 /** \brief  Save the prefs in page to folder.
@@ -1578,6 +1588,16 @@ static void register_templates_page(void)
 
 static GSList *prefs_pages = NULL;
 
+static void prefs_folder_item_address_completion_start(GtkWindow * window)
+{
+       address_completion_start(GTK_WIDGET(window));
+}
+
+static void prefs_folder_item_address_completion_end(GtkWindow * window)
+{
+       address_completion_end(GTK_WIDGET(window));
+}
+
 void prefs_folder_item_open(FolderItem *item)
 {
        gchar *id, *title;
@@ -1597,8 +1617,10 @@ void prefs_folder_item_open(FolderItem *item)
        title = g_strdup_printf (_("Properties for folder %s"), id);
        g_free (id);
        prefswindow_open(title, prefs_pages, item,
-                       &prefs_common.folderitemwin_width, &prefs_common.folderitemwin_height);
-       
+                       &prefs_common.folderitemwin_width, &prefs_common.folderitemwin_height,
+                       prefs_folder_item_address_completion_start,
+                       prefs_folder_item_address_completion_end);
+
        g_free (title);
 }
 
index 3f55d9c..3169e07 100644 (file)
@@ -936,7 +936,8 @@ static GSList *prefs_pages = NULL;
 void prefs_gtk_open(void)
 {
        prefswindow_open(_("Preferences"), prefs_pages, NULL,
-                       &prefs_common.prefswin_width, &prefs_common.prefswin_height);
+                       &prefs_common.prefswin_width, &prefs_common.prefswin_height,
+                       NULL, NULL);
 }
 
 void prefs_gtk_register_page(PrefsPage *page)
index 61c483d..b53bfb5 100644 (file)
@@ -66,6 +66,26 @@ static struct Templates {
 
 static int modified = FALSE;
 static int modified_list = FALSE;
+
+static struct
+{
+       gchar *label;
+       GtkWidget **entry;
+       gboolean compl;
+       gchar *tooltips;
+} widgets_table[] = {
+       {N_("Name"),    &templates.entry_name,          FALSE,
+               N_("This name is used as the Menu item")},
+       {N_("From"),    &templates.entry_from,          TRUE,
+               N_("Override composing account's From header. This doesn't change the composing account.")},
+       {N_("To"),      &templates.entry_to,            TRUE,   NULL},
+       {N_("Cc"),      &templates.entry_cc,            TRUE,   NULL},
+       {N_("Bcc"),     &templates.entry_bcc,           TRUE,   NULL},
+       {N_("Subject"), &templates.entry_subject,       FALSE,  NULL},
+       {NULL,          NULL,                           FALSE,  NULL}
+};
+
+
 /* widget creating functions */
 static void prefs_template_window_create       (void);
 static void prefs_template_window_setup                (void);
@@ -201,45 +221,28 @@ static void prefs_template_window_create(void)
 
        tooltips = gtk_tooltips_new();
 
-       struct
-       {
-               gchar *label;
-               GtkWidget **entry;
-               gboolean compl;
-               gchar *tooltips;
-       } tab[] = {
-               {_("Name"),     &templates.entry_name,          FALSE,
-                       _("This name is used as the Menu item")},
-               {_("From"),     &templates.entry_from,          TRUE,
-                       _("Override composing account's From header. This doesn't change the composing account.")},
-               {_("To"),       &templates.entry_to,            TRUE,   NULL},
-               {_("Cc"),       &templates.entry_cc,            TRUE,   NULL},
-               {_("Bcc"),      &templates.entry_bcc,           TRUE,   NULL},
-               {_("Subject"),  &templates.entry_subject,       FALSE,  NULL},
-               {NULL,          NULL,                           FALSE,  NULL}
-       };
-
-       for (i=0; tab[i].label; i++) {
+       for (i=0; widgets_table[i].label; i++) {
 
                GtkWidget *label;
 
-               label = gtk_label_new(tab[i].label);
+               label = gtk_label_new(widgets_table[i].label);
                gtk_widget_show(label);
                gtk_table_attach(GTK_TABLE(table), label, 0, 1, i, (i + 1),
                                (GtkAttachOptions) (GTK_FILL),
                                (GtkAttachOptions) 0, 0, 0);
                gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
 
-               *(tab[i].entry) = gtk_entry_new();
-               gtk_widget_show(*(tab[i].entry));
-               gtk_table_attach(GTK_TABLE(table), *(tab[i].entry), 1, 2, i, (i + 1),
+               *(widgets_table[i].entry) = gtk_entry_new();
+               gtk_widget_show(*(widgets_table[i].entry));
+               gtk_table_attach(GTK_TABLE(table), *(widgets_table[i].entry), 1, 2, i, (i + 1),
                                (GtkAttachOptions) (GTK_EXPAND|GTK_SHRINK|GTK_FILL),
                                (GtkAttachOptions) 0, 0, 0);
-               gtk_tooltips_set_tip(tooltips, *(tab[i].entry), tab[i].tooltips, NULL);
+               gtk_tooltips_set_tip(tooltips, *(widgets_table[i].entry),
+                               widgets_table[i].tooltips, NULL);
 
-               if (tab[i].compl)
+               if (widgets_table[i].compl)
                        address_completion_register_entry(
-                               GTK_ENTRY(*(tab[i].entry)), TRUE);
+                               GTK_ENTRY(*(widgets_table[i].entry)), TRUE);
        }
 
        /* template content */
@@ -514,6 +517,18 @@ static gboolean prefs_template_key_pressed_cb(GtkWidget *widget,
        return FALSE;
 }
 
+static void prefs_template_address_completion_end(void)
+{
+       gint i;
+
+       for (i=0; widgets_table[i].label; i++) {
+               if (widgets_table[i].compl)
+                       address_completion_unregister_entry(
+                               GTK_ENTRY(*(widgets_table[i].entry)));
+       }
+       address_completion_end(templates.window);
+}
+
 static void prefs_template_ok_cb(void)
 {
        GSList *tmpl_list;
@@ -525,6 +540,9 @@ static void prefs_template_ok_cb(void)
                                 NULL) != G_ALERTDEFAULT) {
                return;
        } 
+
+       prefs_template_address_completion_end();
+
        modified = FALSE;
        modified_list = FALSE;
        tmpl_list = prefs_template_get_list();
@@ -552,6 +570,9 @@ static void prefs_template_cancel_cb(void)
                                 NULL) != G_ALERTDEFAULT) {
                return;
        }
+
+       prefs_template_address_completion_end();
+
        modified = FALSE;
        modified_list = FALSE;
        store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW