From a1082f0e45e1e34c3f0193ff3a51588c89f914c1 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 2 Jul 2009 13:49:11 -0400 Subject: Kill the last GtkOptionMenu instances. Wrote a new widget (ECharsetComboBox) to replace e-charset-picker.c. The widget provides a "charset" string property that allows us to bind to GConf keys (via EShellSettings). Moved e_charset_add_radio_actions() to e-util/e-charset.c. Updated Glade files, #include lines, etc. --- modules/mail/em-mailer-prefs.c | 48 +++++++----------------------------------- 1 file changed, 8 insertions(+), 40 deletions(-) (limited to 'modules/mail/em-mailer-prefs.c') diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c index 6b550b1a55..36afca41ae 100644 --- a/modules/mail/em-mailer-prefs.c +++ b/modules/mail/em-mailer-prefs.c @@ -33,7 +33,6 @@ #include #include #include -#include "misc/e-charset-picker.h" #include @@ -43,6 +42,7 @@ #include "e-util/e-binding.h" #include "e-util/e-util-private.h" +#include "widgets/misc/e-charset-combo-box.h" #include "e-mail-label-manager.h" #include "mail-config.h" @@ -564,43 +564,6 @@ toggle_button_init (EMMailerPrefs *prefs, GtkToggleButton *toggle, gint not, con gtk_widget_set_sensitive ((GtkWidget *) toggle, FALSE); } -static void -charset_activate (GtkWidget *item, EMMailerPrefs *prefs) -{ - GtkWidget *menu; - gchar *string; - - menu = gtk_option_menu_get_menu (prefs->charset); - if (!(string = e_charset_picker_get_charset (menu))) - string = g_strdup (camel_iconv_locale_charset ()); - - gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/display/charset", string, NULL); - g_free (string); -} - -static void -charset_menu_init (EMMailerPrefs *prefs) -{ - GtkWidget *menu, *item; - GList *items; - gchar *buf; - - buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/charset", NULL); - menu = e_charset_picker_new (buf && *buf ? buf : camel_iconv_locale_charset ()); - gtk_option_menu_set_menu (prefs->charset, GTK_WIDGET (menu)); - g_free (buf); - - items = GTK_MENU_SHELL (menu)->children; - while (items) { - item = items->data; - g_signal_connect (item, "activate", G_CALLBACK (charset_activate), prefs); - items = items->next; - } - - if (!gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/charset", NULL)) - gtk_widget_set_sensitive ((GtkWidget *) prefs->charset, FALSE); -} - static void trash_days_changed (GtkComboBox *combo_box, EMMailerPrefs *prefs) @@ -941,8 +904,13 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, G_OBJECT (shell_settings), "mail-magic-spacebar", G_OBJECT (widget), "active"); - prefs->charset = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuCharset")); - charset_menu_init (prefs); + widget = e_charset_combo_box_new (); + container = glade_xml_get_widget (gui, "hboxDefaultCharset"); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "mail-charset", + G_OBJECT (widget), "charset"); widget = glade_xml_get_widget (gui, "chkHighlightCitations"); e_mutual_binding_new ( -- cgit v1.2.3