aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-07-03 01:49:11 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-07-03 02:02:55 +0800
commita1082f0e45e1e34c3f0193ff3a51588c89f914c1 (patch)
tree9666a5cd090740aba0729c5ad55b808b1bf083e3 /modules/mail
parentb554b165941e9b4e394554591e93e31e5accef16 (diff)
downloadgsoc2013-evolution-a1082f0e45e1e34c3f0193ff3a51588c89f914c1.tar.gz
gsoc2013-evolution-a1082f0e45e1e34c3f0193ff3a51588c89f914c1.tar.zst
gsoc2013-evolution-a1082f0e45e1e34c3f0193ff3a51588c89f914c1.zip
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.
Diffstat (limited to 'modules/mail')
-rw-r--r--modules/mail/e-mail-shell-settings.c16
-rw-r--r--modules/mail/em-composer-prefs.c78
-rw-r--r--modules/mail/em-mailer-prefs.c48
3 files changed, 34 insertions, 108 deletions
diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c
index c7e3218191..897ccfc18b 100644
--- a/modules/mail/e-mail-shell-settings.c
+++ b/modules/mail/e-mail-shell-settings.c
@@ -95,14 +95,14 @@ e_mail_shell_settings_init (EShell *shell)
e_shell_settings_install_property (
g_param_spec_string (
- "mail-charset-default",
+ "mail-charset",
NULL,
NULL,
NULL,
G_PARAM_READWRITE));
e_shell_settings_bind_to_gconf (
- shell_settings, "mail-charset-default",
+ shell_settings, "mail-charset",
"/apps/evolution/mail/display/charset");
e_shell_settings_install_property (
@@ -400,6 +400,18 @@ e_mail_shell_settings_init (EShell *shell)
/*** Composer Preferences ***/
e_shell_settings_install_property (
+ g_param_spec_string (
+ "composer-charset",
+ NULL,
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "composer-charset",
+ "/apps/evolution/mail/composer/charset");
+
+ e_shell_settings_install_property (
g_param_spec_boolean (
"composer-format-html",
NULL,
diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c
index 18dae567ca..4c29125c0b 100644
--- a/modules/mail/em-composer-prefs.c
+++ b/modules/mail/em-composer-prefs.c
@@ -47,12 +47,12 @@
#include <gtkhtml/gtkhtml.h>
#include <editor/gtkhtml-spell-language.h>
-#include "misc/e-charset-picker.h"
-#include "misc/e-signature-editor.h"
-#include "misc/e-signature-manager.h"
-#include "misc/e-signature-preview.h"
#include "e-util/e-error.h"
#include "e-util/e-util-private.h"
+#include "widgets/misc/e-charset-combo-box.h"
+#include "widgets/misc/e-signature-editor.h"
+#include "widgets/misc/e-signature-manager.h"
+#include "widgets/misc/e-signature-preview.h"
#include "mail-config.h"
#include "em-config.h"
@@ -320,54 +320,6 @@ spell_setup (EMComposerPrefs *prefs)
g_list_free (active_languages);
}
-static void
-charset_activate (GtkWidget *item,
- EMComposerPrefs *prefs)
-{
- GConfClient *client;
- GtkWidget *menu;
- gchar *string;
-
- client = mail_config_get_gconf_client ();
- menu = gtk_option_menu_get_menu (prefs->charset);
- string = e_charset_picker_get_charset (menu);
-
- if (string == NULL)
- string = g_strdup (camel_iconv_locale_charset ());
-
- gconf_client_set_string (
- client, "/apps/evolution/mail/composer/charset",
- string, NULL);
-
- g_free (string);
-}
-
-static void
-option_menu_connect (EMComposerPrefs *prefs,
- GtkOptionMenu *omenu,
- GCallback callback,
- const gchar *key)
-{
- GConfClient *client;
- GtkWidget *menu;
- GList *list;
-
- client = mail_config_get_gconf_client ();
- menu = gtk_option_menu_get_menu (omenu);
- list = GTK_MENU_SHELL (menu)->children;
-
- while (list != NULL) {
- GtkWidget *widget = list->data;
-
- g_object_set_data (G_OBJECT (widget), "key", (gpointer) key);
- g_signal_connect (widget, "activate", callback, prefs);
- list = list->next;
- }
-
- if (!gconf_client_key_is_writable (client, key, NULL))
- gtk_widget_set_sensitive (GTK_WIDGET (omenu), FALSE);
-}
-
static GtkWidget *
emcp_widget_glade (EConfig *ec,
EConfigItem *item,
@@ -405,7 +357,7 @@ static void
em_composer_prefs_construct (EMComposerPrefs *prefs,
EShell *shell)
{
- GtkWidget *toplevel, *widget, *menu, *info_pixmap;
+ GtkWidget *toplevel, *widget, *info_pixmap;
GtkWidget *container;
EShellSettings *shell_settings;
ESignatureList *signature_list;
@@ -417,7 +369,6 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
GtkCellRenderer *renderer;
GConfBridge *bridge;
GConfClient *client;
- gchar *buf;
EMConfig *ec;
EMConfigTargetPrefs *target;
GSList *l;
@@ -497,18 +448,13 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
G_OBJECT (shell_settings), "composer-inline-spelling",
G_OBJECT (widget), "active");
- prefs->charset = GTK_OPTION_MENU (
- glade_xml_get_widget (gui, "omenuCharset1"));
- buf = gconf_client_get_string (
- client, "/apps/evolution/mail/composer/charset", NULL);
- menu = e_charset_picker_new (
- buf && *buf ? buf : camel_iconv_locale_charset ());
- gtk_option_menu_set_menu (prefs->charset, GTK_WIDGET (menu));
- option_menu_connect (
- prefs, prefs->charset,
- G_CALLBACK (charset_activate),
- "/apps/evolution/mail/composer/charset");
- g_free (buf);
+ widget = e_charset_combo_box_new ();
+ container = glade_xml_get_widget (gui, "hboxComposerCharset");
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "composer-charset",
+ G_OBJECT (widget), "charset");
/* Spell Checking */
widget = glade_xml_get_widget (gui, "listSpellCheckLanguage");
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 <camel/camel-iconv.h>
#include <gtkhtml/gtkhtml-properties.h>
#include <libxml/tree.h>
-#include "misc/e-charset-picker.h"
#include <glade/glade.h>
@@ -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"
@@ -565,43 +565,6 @@ toggle_button_init (EMMailerPrefs *prefs, GtkToggleButton *toggle, gint not, con
}
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 (