0.9.4claws34
authorChristoph Hohmann <reboot@gmx.ch>
Fri, 22 Aug 2003 15:06:56 +0000 (15:06 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Fri, 22 Aug 2003 15:06:56 +0000 (15:06 +0000)
* src/prefs_folder_item.c
        use macro to assign strings that always frees the old string

* src/gtk/gtkaspell.[ch]
        add gtkaspell_set_dictionary_menu_active_item() to set active
        item in dictionary option menu

* src/prefs_spelling.c
        use gtkaspell_set_dictionary_menu_active_item() to select
        dictionary

ChangeLog.claws
configure.ac
src/gtk/gtkaspell.c
src/gtk/gtkaspell.h
src/prefs_folder_item.c
src/prefs_spelling.c

index f88600946106cd53cf40286a3e46634dce3c8072..744c4673b968b0adaf621cd96ffe217de31aec82 100644 (file)
@@ -1,3 +1,16 @@
+2003-08-22 [christoph] 0.9.4claws34
+
+       * src/prefs_folder_item.c
+               use macro to assign strings that always frees the old string
+
+       * src/gtk/gtkaspell.[ch]
+               add gtkaspell_set_dictionary_menu_active_item() to set active
+               item in dictionary option menu
+
+       * src/prefs_spelling.c
+               use gtkaspell_set_dictionary_menu_active_item() to select
+               dictionary
+
 2003-08-21 [christoph] 0.9.4claws33
 
        * src/folder.[ch]
index 420401d135004e34bce44f333d11a3b23b83f7a1..77972afbdfca3f4ac831f3321fc0cd8c5d7040cf 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=4
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=33
+EXTRA_VERSION=34
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
index edfae15792f0dcef067eab4191e300020fa07a08..f1ff505f4ec2c235353e15994878e6616a108db8 100644 (file)
@@ -44,6 +44,8 @@
 #include <time.h>
 #include <dirent.h>
 
+#include <glib.h>
+
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
 #include <gtk/gtkoptionmenu.h>
@@ -1632,6 +1634,35 @@ gchar *gtkaspell_get_dictionary_menu_active_item(GtkWidget *menu)
   
 }
 
+gint gtkaspell_set_dictionary_menu_active_item(GtkWidget *menu, const gchar *dictionary)
+{
+       GList *cur;
+       gint n;
+
+       g_return_val_if_fail(menu != NULL, 0);
+       g_return_val_if_fail(dictionary != NULL, 0);
+       g_return_val_if_fail(GTK_IS_OPTION_MENU(menu), 0);
+
+       n = 0;
+       for (cur = GTK_MENU_SHELL(gtk_option_menu_get_menu(GTK_OPTION_MENU(menu)))->children;
+            cur != NULL; cur = cur->next) {
+               GtkWidget *menuitem;
+               gchar *dict_name;
+
+               menuitem = GTK_WIDGET(cur->data);
+               dict_name = gtk_object_get_data(GTK_OBJECT(menuitem), 
+                                               "dict_name");
+               if ((dict_name != NULL) && !strcmp2(dict_name, dictionary)) {
+                       gtk_option_menu_set_history(GTK_OPTION_MENU(menu), n);
+
+                       return 1;
+               }
+               n++;
+       }
+
+       return 0;
+}
+
 GtkWidget *gtkaspell_sugmode_option_menu_new(gint sugmode)
 {
        GtkWidget *menu;
index 07ded79ba829bfdfb95d9e37b2e5c95aef7b9e84..92e348ff2d3c1bf88d0ccfa2e4fa9fcb40a28377 100644 (file)
@@ -88,6 +88,9 @@ GtkWidget*    gtkaspell_dictionary_option_menu_new    (const gchar *aspell_path);
 
 gchar*         gtkaspell_get_dictionary_menu_active_item
                                                        (GtkWidget *menu);
+gint           gtkaspell_set_dictionary_menu_active_item
+                                                       (GtkWidget *menu, 
+                                                        const gchar *dictionary);
 
 GtkWidget*     gtkaspell_sugmode_option_menu_new       (gint sugmode);
 
index 821b4a91ddf792863c8b06108f478d3e257114a1..7d21058e1a019f48fbf4bf8d3ce5867f9b6b3415 100644 (file)
 #include "folder_item_prefs.h"
 #include "gtk/colorsel.h"
 
+#define ASSIGN_STRING(string, value) \
+       { \
+               g_free(string); \
+               string = (value); \
+       }
+
 struct FolderItemGeneralPage
 {
        PrefsPage page;
@@ -204,13 +210,10 @@ void prefs_folder_item_general_save_func(PrefsPage *_page)
 
        g_return_if_fail(prefs != NULL);
 
-       old_simplify_val = prefs->enable_simplify_subject;
-       old_simplify_str = prefs->simplify_subject_regexp;
-
        prefs->enable_simplify_subject =
            gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_simplify_subject));
-       prefs->simplify_subject_regexp = 
-           gtk_editable_get_chars(GTK_EDITABLE(page->entry_simplify_subject), 0, -1);
+       ASSIGN_STRING(prefs->simplify_subject_regexp,
+           gtk_editable_get_chars(GTK_EDITABLE(page->entry_simplify_subject), 0, -1));
        
 /*
        if (page->item == page->folderview->summaryview->folder_item &&
@@ -222,8 +225,6 @@ void prefs_folder_item_general_save_func(PrefsPage *_page)
                folderview_select(page->folderview, page->item);
        }
 */
-       if (old_simplify_str) g_free(old_simplify_str);
-
        prefs->enable_folder_chmod = 
            gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_folder_chmod));
        buf = gtk_editable_get_chars(GTK_EDITABLE(page->entry_folder_chmod), 0, -1);
@@ -359,8 +360,6 @@ void prefs_folder_item_compose_create_widget_func(PrefsPage * _page,
                index++;                        
        }
 
-       page->item->prefs->default_account = item->prefs->default_account;
-
        optmenu = GTK_OPTION_MENU(optmenu_default_account);
        gtk_option_menu_set_menu(optmenu, optmenu_default_account_menu);
 
@@ -418,15 +417,13 @@ void prefs_folder_item_compose_save_func(PrefsPage *_page)
 
        prefs->enable_default_to = 
            gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_default_to));
-       g_free(prefs->default_to);
-       prefs->default_to = 
-           gtk_editable_get_chars(GTK_EDITABLE(page->entry_default_to), 0, -1);
+       ASSIGN_STRING(prefs->default_to,
+           gtk_editable_get_chars(GTK_EDITABLE(page->entry_default_to), 0, -1));
 
        prefs->enable_default_reply_to = 
            gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_default_reply_to));
-       g_free(prefs->default_reply_to);
-       prefs->default_reply_to = 
-           gtk_editable_get_chars(GTK_EDITABLE(page->entry_default_reply_to), 0, -1);
+       ASSIGN_STRING(prefs->default_reply_to,
+           gtk_editable_get_chars(GTK_EDITABLE(page->entry_default_reply_to), 0, -1));
 
        prefs->enable_default_account = 
            gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_enable_default_account));
index 2424d9dbcb050813021930a559b79f2469d49bad..b0ae2455e47ac7e61952128fdbbff501f60c9900 100644 (file)
@@ -133,8 +133,6 @@ static void prefs_spelling_colorsel(GtkWidget *widget,
 void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gpointer data)
 {
        SpellingPage *prefs_spelling = (SpellingPage *) _page;
-       GList *cur;
-       gint n;
 
        /* START GLADE CODE */
        GtkWidget *table;
@@ -287,20 +285,7 @@ void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gpointer
 
        gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu_dictionary),
                                 gtkaspell_dictionary_option_menu_new(prefs_common.aspell_path));
-       n = 0;
-       for (cur = GTK_MENU_SHELL(gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu_dictionary)))->children;
-            cur != NULL; cur = cur->next) {
-               GtkWidget *menuitem;
-               gchar *dict_name;
-
-               menuitem = GTK_WIDGET(cur->data);
-               dict_name = gtk_object_get_data(GTK_OBJECT(menuitem), 
-                                               "dict_name");
-               if (!strcmp2(dict_name, prefs_common.dictionary)) {
-                       gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu_dictionary), n);
-               }
-               n++;
-       }
+       gtkaspell_set_dictionary_menu_active_item(optmenu_dictionary, prefs_common.dictionary);
 
        gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu_sugmode),
                                 gtkaspell_sugmode_option_menu_new(prefs_common.aspell_sugmode));