#include <time.h>
#include <dirent.h>
+#include <glib.h>
+
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gtk/gtkoptionmenu.h>
}
+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;
#include "folder_item_prefs.h"
#include "gtk/colorsel.h"
+#define ASSIGN_STRING(string, value) \
+ { \
+ g_free(string); \
+ string = (value); \
+ }
+
struct FolderItemGeneralPage
{
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 &&
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);
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);
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));
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;
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));