diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-11-21 02:35:30 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-11-21 02:35:30 +0800 |
commit | bdefd8ec42c5ecbf9f5904f44c5205d677753c99 (patch) | |
tree | 5662ecc5994490cad22342b8e602e75569a2e10f | |
parent | bd4153c91aee4e7dfded61ba439c746ca04fefc4 (diff) | |
download | gsoc2013-evolution-bdefd8ec42c5ecbf9f5904f44c5205d677753c99.tar.gz gsoc2013-evolution-bdefd8ec42c5ecbf9f5904f44c5205d677753c99.tar.zst gsoc2013-evolution-bdefd8ec42c5ecbf9f5904f44c5205d677753c99.zip |
gconfify. (mail_composer_prefs_apply): gconfify this also.
2002-11-20 Jeffrey Stedfast <fejj@ximian.com>
* mail-composer-prefs.c (mail_composer_prefs_construct): gconfify.
(mail_composer_prefs_apply): gconfify this also.
* mail-preferences.c (mail_preferences_construct):
gconf_client_get_string() probably returns an allocated buffer.
svn path=/trunk/; revision=18859
-rw-r--r-- | mail/ChangeLog | 8 | ||||
-rw-r--r-- | mail/mail-composer-prefs.c | 74 | ||||
-rw-r--r-- | mail/mail-preferences.c | 16 |
3 files changed, 61 insertions, 37 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 7bd0ac3c06..368a9c8a2f 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2002-11-20 Jeffrey Stedfast <fejj@ximian.com> + + * mail-composer-prefs.c (mail_composer_prefs_construct): gconfify. + (mail_composer_prefs_apply): gconfify this also. + + * mail-preferences.c (mail_preferences_construct): + gconf_client_get_string() probably returns an allocated buffer. + 2002-11-20 Not Zed <NotZed@Ximian.com> * importers/Makefile.am (%.server.in): provide a proper implicit diff --git a/mail/mail-composer-prefs.c b/mail/mail-composer-prefs.c index 6482678093..0cc6b510e8 100644 --- a/mail/mail-composer-prefs.c +++ b/mail/mail-composer-prefs.c @@ -30,12 +30,9 @@ #include "mail-composer-prefs.h" #include "composer/e-msg-composer.h" -#include <gtk/gtksignal.h> - #include <bonobo/bonobo-generic-factory.h> #include <gal/widgets/e-gui-utils.h> -#include <gal/widgets/e-unicode.h> #include "widgets/misc/e-charset-picker.h" @@ -84,7 +81,7 @@ mail_composer_prefs_class_init (MailComposerPrefsClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); - parent_class = g_type_class_ref(gtk_vbox_get_type ()); + parent_class = g_type_class_ref (gtk_vbox_get_type ()); object_class->destroy = mail_composer_prefs_destroy; gobject_class->finalize = mail_composer_prefs_finalise; @@ -103,8 +100,8 @@ mail_composer_prefs_finalise (GObject *obj) { MailComposerPrefs *prefs = (MailComposerPrefs *) obj; - g_object_unref((prefs->gui)); - g_object_unref((prefs->pman)); + g_object_unref ((prefs->gui)); + g_object_unref ((prefs->pman)); g_object_unref (prefs->enabled_pixbuf); gdk_pixmap_unref (prefs->mark_pixmap); g_object_unref (prefs->mark_bitmap); @@ -127,7 +124,7 @@ attach_style_info (GtkWidget *item, gpointer user_data) { int *style = user_data; - g_object_set_data((GObject *)(item), "style", GINT_TO_POINTER (*style)); + g_object_set_data ((GObject *) item, "style", GINT_TO_POINTER (*style)); (*style)++; } @@ -770,7 +767,9 @@ mail_composer_prefs_construct (MailComposerPrefs *prefs) GtkWidget *toplevel, *widget, *menu, *info_pixmap; GtkDialog *dialog; GladeXML *gui; + gboolean bool; int style; + char *buf; char *names[][2] = { { "live_spell_check", "chkEnableSpellChecking" }, { "magic_smileys_check", "chkAutoSmileys" }, @@ -797,31 +796,37 @@ mail_composer_prefs_construct (MailComposerPrefs *prefs) /* Default Behavior */ prefs->send_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkSendHTML")); - gtk_toggle_button_set_active (prefs->send_html, mail_config_get_send_html ()); - g_signal_connect (prefs->send_html, "toggled", G_CALLBACK(toggle_button_toggled), prefs); + bool = gconf_client_get_bool (prefs->gconf, "/apps/evolution/mail/composer/send_html", NULL); + gtk_toggle_button_set_active (prefs->send_html, bool); + g_signal_connect (prefs->send_html, "toggled", G_CALLBACK (toggle_button_toggled), prefs); prefs->auto_smileys = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkAutoSmileys")); - g_signal_connect (prefs->auto_smileys, "toggled", G_CALLBACK(toggle_button_toggled), prefs); + /* FIXME: set active? */ + g_signal_connect (prefs->auto_smileys, "toggled", G_CALLBACK (toggle_button_toggled), prefs); prefs->prompt_empty_subject = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptEmptySubject")); - gtk_toggle_button_set_active (prefs->prompt_empty_subject, mail_config_get_prompt_empty_subject ()); - g_signal_connect (prefs->prompt_empty_subject, "toggled", G_CALLBACK(toggle_button_toggled), prefs); + bool = gconf_client_get_bool (prefs->gconf, "/apps/evolution/mail/prompts/empty_subject", NULL); + gtk_toggle_button_set_active (prefs->prompt_empty_subject, bool); + g_signal_connect (prefs->prompt_empty_subject, "toggled", G_CALLBACK (toggle_button_toggled), prefs); prefs->prompt_bcc_only = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptBccOnly")); - gtk_toggle_button_set_active (prefs->prompt_bcc_only, mail_config_get_prompt_only_bcc ()); - g_signal_connect (prefs->prompt_bcc_only, "toggled", G_CALLBACK(toggle_button_toggled), prefs); + bool = gconf_client_get_bool (prefs->gconf, "/apps/evolution/mail/prompts/only_bcc", NULL); + gtk_toggle_button_set_active (prefs->prompt_bcc_only, bool); + g_signal_connect (prefs->prompt_bcc_only, "toggled", G_CALLBACK (toggle_button_toggled), prefs); prefs->charset = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuCharset")); - menu = e_charset_picker_new (mail_config_get_default_charset ()); + buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/composer/charset", NULL); + menu = e_charset_picker_new (buf ? buf : e_iconv_locale_charset ()); gtk_option_menu_set_menu (prefs->charset, GTK_WIDGET (menu)); option_menu_connect (prefs->charset, prefs); - + g_free (buf); + #warning "gtkhtml prop manager" #if 0 /* Spell Checking: GtkHTML part */ prefs->pman = GTK_HTML_PROPMANAGER (gtk_html_propmanager_new (NULL)); g_signal_connect (prefs->pman, "changed", G_CALLBACK(toggle_button_toggled), prefs); - g_object_ref((prefs->pman)); + g_object_ref ((prefs->pman)); gtk_html_propmanager_set_names (prefs->pman, names); gtk_html_propmanager_set_gui (prefs->pman, gui, NULL); @@ -843,14 +848,16 @@ mail_composer_prefs_construct (MailComposerPrefs *prefs) /* Forwards and Replies */ prefs->forward_style = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuForwardStyle")); - gtk_option_menu_set_history (prefs->forward_style, mail_config_get_default_forward_style ()); + style = gconf_client_get_int (prefs->gconf, "/apps/evolution/mail/format/forward_style", NULL); + gtk_option_menu_set_history (prefs->forward_style, style); style = 0; gtk_container_foreach (GTK_CONTAINER (gtk_option_menu_get_menu (prefs->forward_style)), attach_style_info, &style); option_menu_connect (prefs->forward_style, prefs); prefs->reply_style = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuReplyStyle")); - gtk_option_menu_set_history (prefs->reply_style, mail_config_get_default_reply_style ()); + style = gconf_client_get_int (prefs->gconf, "/apps/evolution/mail/format/reply_style", NULL); + gtk_option_menu_set_history (prefs->reply_style, style); style = 0; gtk_container_foreach (GTK_CONTAINER (gtk_option_menu_get_menu (prefs->reply_style)), attach_style_info, &style); @@ -922,16 +929,21 @@ mail_composer_prefs_apply (MailComposerPrefs *prefs) /* General tab */ /* Default Behavior */ - mail_config_set_send_html (gtk_toggle_button_get_active (prefs->send_html)); - mail_config_set_prompt_empty_subject (gtk_toggle_button_get_active (prefs->prompt_empty_subject)); - mail_config_set_prompt_only_bcc (gtk_toggle_button_get_active (prefs->prompt_bcc_only)); + gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/composer/send_html", + gtk_toggle_button_get_active (prefs->send_html), NULL); + + gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/prompts/empty_subject", + gtk_toggle_button_get_active (prefs->prompt_empty_subject), NULL); + + gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/prompts/only_bcc", + gtk_toggle_button_get_active (prefs->prompt_bcc_only), NULL); menu = gtk_option_menu_get_menu (prefs->charset); - string = e_charset_picker_get_charset (menu); - if (string) { - mail_config_set_default_charset (string); - g_free (string); - } + if (!(string = e_charset_picker_get_charset (menu))) + string = g_strdup (e_iconv_locale_charset ()); + + gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/composer/charset", string, NULL); + g_free (string); /* Spell Checking */ #warning "gtkhtml propmanager" @@ -943,13 +955,13 @@ mail_composer_prefs_apply (MailComposerPrefs *prefs) /* Forwards and Replies */ menu = gtk_option_menu_get_menu (prefs->forward_style); item = gtk_menu_get_active (GTK_MENU (menu)); - val = GPOINTER_TO_INT (g_object_get_data((GObject *)item, "style")); - mail_config_set_default_forward_style (val); + val = GPOINTER_TO_INT (g_object_get_data ((GObject *) item, "style")); + gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/format/forward_style", val, NULL); menu = gtk_option_menu_get_menu (prefs->reply_style); item = gtk_menu_get_active (GTK_MENU (menu)); - val = GPOINTER_TO_INT (g_object_get_data((GObject *)item, "style")); - mail_config_set_default_reply_style (val); + val = GPOINTER_TO_INT (g_object_get_data ((GObject *) item, "style")); + gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/format/reply_style", val, NULL); /* Keyboard Shortcuts */ /* FIXME: implement me */ diff --git a/mail/mail-preferences.c b/mail/mail-preferences.c index cb05806185..1077fc73ed 100644 --- a/mail/mail-preferences.c +++ b/mail/mail-preferences.c @@ -197,6 +197,7 @@ mail_preferences_construct (MailPreferences *prefs) gboolean bool; guint32 rgb; int i, val; + char *buf; char *names[][2] = { { "anim_check", "chkShowAnimatedImages" }, { "magic_check", "chkAutoDetectLinks" }, @@ -229,10 +230,11 @@ mail_preferences_construct (MailPreferences *prefs) g_signal_connect (prefs->timeout, "changed", G_CALLBACK (entry_changed), prefs); prefs->charset = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuCharset")); - text = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/format/charset", NULL); - menu = e_charset_picker_new (text ? text : e_iconv_locale_charset ()); + buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/format/charset", NULL); + menu = e_charset_picker_new (buf ? buf : e_iconv_locale_charset ()); gtk_option_menu_set_menu (prefs->charset, GTK_WIDGET (menu)); option_menu_connect (prefs->charset, prefs); + g_free (buf); prefs->citation_highlight = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkHighlightCitations")); bool = gconf_client_get_bool (prefs->gconf, "/apps/evolution/mail/display/highlight_citations", NULL); @@ -240,11 +242,12 @@ mail_preferences_construct (MailPreferences *prefs) g_signal_connect (prefs->citation_highlight, "toggled", G_CALLBACK (toggle_button_toggled), prefs); prefs->citation_color = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, "colorpickerHighlightCitations")); - text = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/citation_colour", NULL); - gdk_color_parse (text ? text : "#737373", &colour); + buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/citation_colour", NULL); + gdk_color_parse (buf ? buf : "#737373", &colour); rgb = ((colour.red & 0xff00) << 8) | (colour.green & 0xff00) | ((colour.blue & 0xff) >> 8); colorpicker_set_color (prefs->citation_color, rgb); g_signal_connect (prefs->citation_color, "color-set", G_CALLBACK (color_set), prefs); + g_free (buf); /* Deleting Mail */ prefs->empty_trash = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkEmptyTrashOnExit")); @@ -272,10 +275,11 @@ mail_preferences_construct (MailPreferences *prefs) g_signal_connect (prefs->notify_play_sound, "toggled", G_CALLBACK (toggle_button_toggled), prefs); prefs->notify_sound_file = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileNotifyPlaySound")); - text = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/notify/sound", NULL); - gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->notify_sound_file)), text ? text : ""); + buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/notify/sound", NULL); + gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->notify_sound_file)), buf ? buf : ""); g_signal_connect (gnome_file_entry_gtk_entry (prefs->notify_sound_file), "changed", G_CALLBACK (entry_changed), prefs); + g_free (buf); /* HTML Mail tab */ |