[evolution/kill-bonobo] Kill the last GtkOptionMenu instances.
- From: Matthew Barnes <mbarnes src gnome org>
- To: svn-commits-list gnome org
- Subject: [evolution/kill-bonobo] Kill the last GtkOptionMenu instances.
- Date: Thu, 2 Jul 2009 18:04:56 +0000 (UTC)
commit a1082f0e45e1e34c3f0193ff3a51588c89f914c1
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Jul 2 13:49:11 2009 -0400
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.
.../gui/contact-editor/e-contact-quick-add.c | 22 +-
composer/e-composer-actions.c | 2 -
composer/e-composer-private.h | 1 +
composer/e-msg-composer.c | 1 -
e-util/Makefile.am | 2 +
e-util/e-charset.c | 255 ++++++++++
.../misc/e-charset-picker.h => e-util/e-charset.h | 8 +-
mail/e-mail-reader.c | 4 +-
mail/mail-config.glade | 190 +-------
modules/mail/e-mail-shell-settings.c | 16 +-
modules/mail/em-composer-prefs.c | 78 +---
modules/mail/em-mailer-prefs.c | 48 +--
po/POTFILES.in | 3 +-
widgets/misc/Makefile.am | 4 +-
widgets/misc/e-charset-picker.c | 508 --------------------
15 files changed, 332 insertions(+), 810 deletions(-)
---
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c
index 9bd97f2..cd81d28 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -49,7 +49,7 @@ struct _QuickAdd {
GtkWidget *dialog;
GtkWidget *name_entry;
GtkWidget *email_entry;
- GtkWidget *option_menu;
+ GtkWidget *combo_box;
gint refs;
@@ -285,7 +285,7 @@ sanitize_widgets (QuickAdd *qa)
g_return_if_fail (qa->dialog != NULL);
/* do not call here e_book_is_writable (qa->book), because it requires opened book, which takes time for remote books */
- enabled = qa->book != NULL && e_source_combo_box_get_active_uid (E_SOURCE_COMBO_BOX (qa->option_menu));
+ enabled = qa->book != NULL && e_source_combo_box_get_active_uid (E_SOURCE_COMBO_BOX (qa->combo_box));
gtk_dialog_set_response_sensitive (GTK_DIALOG (qa->dialog), QUICK_ADD_RESPONSE_EDIT_FULL, enabled);
gtk_dialog_set_response_sensitive (GTK_DIALOG (qa->dialog), GTK_RESPONSE_OK, enabled);
@@ -356,13 +356,13 @@ build_quick_add_dialog (QuickAdd *qa)
gconf_client = gconf_client_get_default ();
source_list = e_source_list_new_for_gconf (gconf_client, "/apps/evolution/addressbook/sources");
g_object_unref (gconf_client);
- qa->option_menu = e_source_combo_box_new (source_list);
+ qa->combo_box = e_source_combo_box_new (source_list);
book = e_book_new_default_addressbook (NULL);
e_source_combo_box_set_active (
- E_SOURCE_COMBO_BOX (qa->option_menu),
+ E_SOURCE_COMBO_BOX (qa->combo_box),
e_book_get_source (book));
- if (!e_source_combo_box_get_active_uid (E_SOURCE_COMBO_BOX (qa->option_menu))) {
+ if (!e_source_combo_box_get_active_uid (E_SOURCE_COMBO_BOX (qa->combo_box))) {
/* this means the e_book_new_default_addressbook didn't find any "default" nor "system" source,
and created new one for us. That is wrong, choose one from combo instead. */
@@ -372,9 +372,9 @@ build_quick_add_dialog (QuickAdd *qa)
}
book = e_book_new (e_source_list_peek_source_any (source_list), NULL);
- e_source_combo_box_set_active (E_SOURCE_COMBO_BOX (qa->option_menu), e_book_get_source (book));
+ e_source_combo_box_set_active (E_SOURCE_COMBO_BOX (qa->combo_box), e_book_get_source (book));
- if (!e_source_combo_box_get_active_uid (E_SOURCE_COMBO_BOX (qa->option_menu))) {
+ if (!e_source_combo_box_get_active_uid (E_SOURCE_COMBO_BOX (qa->combo_box))) {
/* Does it failed again? What is going on? */
if (book)
g_object_unref (book);
@@ -387,9 +387,9 @@ build_quick_add_dialog (QuickAdd *qa)
qa->book = NULL;
}
qa->book = book;
- source_changed (E_SOURCE_COMBO_BOX (qa->option_menu), qa);
+ source_changed (E_SOURCE_COMBO_BOX (qa->combo_box), qa);
g_signal_connect (
- qa->option_menu, "changed",
+ qa->combo_box, "changed",
G_CALLBACK (source_changed), qa);
g_object_unref (source_list);
@@ -421,13 +421,13 @@ build_quick_add_dialog (QuickAdd *qa)
GTK_EXPAND | GTK_FILL, 0, xpad, ypad);
label = gtk_label_new_with_mnemonic (_("_Select Address Book"));
- gtk_label_set_mnemonic_widget ((GtkLabel *)label, qa->option_menu);
+ gtk_label_set_mnemonic_widget ((GtkLabel *)label, qa->combo_box);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_table_attach (table, label,
0, 1, 2, 3,
GTK_FILL, 0, xpad, ypad);
- gtk_table_attach (table, qa->option_menu,
+ gtk_table_attach (table, qa->combo_box,
1, 2, 2, 3,
GTK_EXPAND | GTK_FILL, 0, xpad, ypad);
diff --git a/composer/e-composer-actions.c b/composer/e-composer-actions.c
index 1ef7e61..bceeb1a 100644
--- a/composer/e-composer-actions.c
+++ b/composer/e-composer-actions.c
@@ -22,8 +22,6 @@
#include <fcntl.h>
#include <e-util/e-error.h>
-#include "misc/e-charset-picker.h"
-
static void
action_attach_cb (GtkAction *action,
EMsgComposer *composer)
diff --git a/composer/e-composer-private.h b/composer/e-composer-private.h
index 82019b4..3d8a1b9 100644
--- a/composer/e-composer-private.h
+++ b/composer/e-composer-private.h
@@ -29,6 +29,7 @@
#include "e-composer-autosave.h"
#include "e-composer-header-table.h"
#include "e-util/e-binding.h"
+#include "e-util/e-charset.h"
#include "e-util/e-util.h"
#include "e-util/gconf-bridge.h"
#include "widgets/misc/e-attachment-paned.h"
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 522538a..c2d8899 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -48,7 +48,6 @@
#include <glade/glade.h>
#include "e-util/e-dialog-utils.h"
-#include "misc/e-charset-picker.h"
#include "e-util/e-error.h"
#include "e-util/e-mktemp.h"
#include "e-util/e-plugin-ui.h"
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
index 60507ec..c8b1c87 100644
--- a/e-util/Makefile.am
+++ b/e-util/Makefile.am
@@ -43,6 +43,7 @@ eutilinclude_HEADERS = \
e-bconf-map.h \
e-binding.h \
e-categories-config.h \
+ e-charset.h \
e-config.h \
e-config-listener.h \
e-cursor.h \
@@ -86,6 +87,7 @@ libeutil_la_SOURCES = \
e-bconf-map.c \
e-binding.c \
e-categories-config.c \
+ e-charset.c \
e-config-listener.c \
e-config.c \
e-cursor.c \
diff --git a/e-util/e-charset.c b/e-util/e-charset.c
new file mode 100644
index 0000000..329f513
--- /dev/null
+++ b/e-util/e-charset.c
@@ -0,0 +1,255 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Authors:
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "e-charset.h"
+
+#include <string.h>
+#include <iconv.h>
+
+#include <glib/gi18n-lib.h>
+
+typedef enum {
+ E_CHARSET_UNKNOWN,
+ E_CHARSET_ARABIC,
+ E_CHARSET_BALTIC,
+ E_CHARSET_CENTRAL_EUROPEAN,
+ E_CHARSET_CHINESE,
+ E_CHARSET_CYRILLIC,
+ E_CHARSET_GREEK,
+ E_CHARSET_HEBREW,
+ E_CHARSET_JAPANESE,
+ E_CHARSET_KOREAN,
+ E_CHARSET_THAI,
+ E_CHARSET_TURKISH,
+ E_CHARSET_UNICODE,
+ E_CHARSET_WESTERN_EUROPEAN,
+ E_CHARSET_WESTERN_EUROPEAN_NEW
+} ECharsetClass;
+
+static const gchar *classnames[] = {
+ N_("Unknown"),
+ N_("Arabic"),
+ N_("Baltic"),
+ N_("Central European"),
+ N_("Chinese"),
+ N_("Cyrillic"),
+ N_("Greek"),
+ N_("Hebrew"),
+ N_("Japanese"),
+ N_("Korean"),
+ N_("Thai"),
+ N_("Turkish"),
+ N_("Unicode"),
+ N_("Western European"),
+ N_("Western European, New"),
+};
+
+typedef struct {
+ const gchar *name;
+ ECharsetClass class;
+ const gchar *subclass;
+} ECharset;
+
+/* This list is based on what other mailers/browsers support. There's
+ * not a lot of point in using, say, ISO-8859-3, if anything that can
+ * read that can read UTF8 too.
+ */
+/* To Translators: Character set "Logical Hebrew" */
+static ECharset charsets[] = {
+ { "ISO-8859-6", E_CHARSET_ARABIC, NULL },
+ { "ISO-8859-13", E_CHARSET_BALTIC, NULL },
+ { "ISO-8859-4", E_CHARSET_BALTIC, NULL },
+ { "ISO-8859-2", E_CHARSET_CENTRAL_EUROPEAN, NULL },
+ { "Big5", E_CHARSET_CHINESE, N_("Traditional") },
+ { "BIG5HKSCS", E_CHARSET_CHINESE, N_("Traditional") },
+ { "EUC-TW", E_CHARSET_CHINESE, N_("Traditional") },
+ { "GB18030", E_CHARSET_CHINESE, N_("Simplified") },
+ { "GB2312", E_CHARSET_CHINESE, N_("Simplified") },
+ { "HZ", E_CHARSET_CHINESE, N_("Simplified") },
+ { "ISO-2022-CN", E_CHARSET_CHINESE, N_("Simplified") },
+ { "KOI8-R", E_CHARSET_CYRILLIC, NULL },
+ { "Windows-1251", E_CHARSET_CYRILLIC, NULL },
+ { "KOI8-U", E_CHARSET_CYRILLIC, N_("Ukrainian") },
+ { "ISO-8859-5", E_CHARSET_CYRILLIC, NULL },
+ { "ISO-8859-7", E_CHARSET_GREEK, NULL },
+ { "ISO-8859-8", E_CHARSET_HEBREW, N_("Visual") },
+ { "ISO-2022-JP", E_CHARSET_JAPANESE, NULL },
+ { "EUC-JP", E_CHARSET_JAPANESE, NULL },
+ { "Shift_JIS", E_CHARSET_JAPANESE, NULL },
+ { "EUC-KR", E_CHARSET_KOREAN, NULL },
+ { "TIS-620", E_CHARSET_THAI, NULL },
+ { "ISO-8859-9", E_CHARSET_TURKISH, NULL },
+ { "UTF-8", E_CHARSET_UNICODE, NULL },
+ { "UTF-7", E_CHARSET_UNICODE, NULL },
+ { "ISO-8859-1", E_CHARSET_WESTERN_EUROPEAN, NULL },
+ { "ISO-8859-15", E_CHARSET_WESTERN_EUROPEAN_NEW, NULL },
+};
+
+/**
+ * e_charset_add_radio_actions:
+ * @action_group: a #GtkActionGroup
+ * @action_prefix: a prefix for action names, or %NULL
+ * @default_charset: the default character set, or %NULL to use the
+ * locale character set
+ * @callback: a callback function for actions in the group, or %NULL
+ * @user_data: user data to be passed to @callback, or %NULL
+ *
+ * Adds a set of #GtkRadioActions for available character sets to
+ * @action_group. The @default_charset (or locale character set if
+ * @default_charset is %NULL) will be added first, and selected by
+ * default (except that ISO-8859-1 will always be used instead of
+ * US-ASCII). Any other character sets of the same language class as
+ * the default will be added next, followed by the remaining character
+ * sets.
+ **/
+GSList *
+e_charset_add_radio_actions (GtkActionGroup *action_group,
+ const gchar *action_prefix,
+ const gchar *default_charset,
+ GCallback callback,
+ gpointer user_data)
+{
+ GtkRadioAction *action = NULL;
+ GSList *group = NULL;
+ const gchar *locale_charset;
+ gint def, ii;
+
+ g_return_val_if_fail (GTK_IS_ACTION_GROUP (action_group), NULL);
+
+ if (action_prefix == NULL)
+ action_prefix = "";
+
+ g_get_charset (&locale_charset);
+ if (!g_ascii_strcasecmp (locale_charset, "US-ASCII"))
+ locale_charset = "ISO-8859-1";
+
+ if (default_charset == NULL)
+ default_charset = locale_charset;
+ for (def = 0; def < G_N_ELEMENTS (charsets); def++)
+ if (!g_ascii_strcasecmp (charsets[def].name, default_charset))
+ break;
+
+ for (ii = 0; ii < G_N_ELEMENTS (charsets); ii++) {
+ const gchar *charset_name;
+ gchar *action_name;
+ gchar *escaped_name;
+ gchar *charset_label;
+ gchar **str_array;
+
+ charset_name = charsets[ii].name;
+ action_name = g_strconcat (action_prefix, charset_name, NULL);
+
+ /* Escape underlines in the character set name so
+ * they're not treated as GtkLabel mnemonics. */
+ str_array = g_strsplit (charset_name, "_", -1);
+ escaped_name = g_strjoinv ("__", str_array);
+ g_strfreev (str_array);
+
+ if (charsets[ii].subclass != NULL)
+ charset_label = g_strdup_printf (
+ "%s, %s (%s)",
+ gettext (classnames[charsets[ii].class]),
+ gettext (charsets[ii].subclass),
+ escaped_name);
+ else if (charsets[ii].class != E_CHARSET_UNKNOWN)
+ charset_label = g_strdup_printf (
+ "%s (%s)",
+ gettext (classnames[charsets[ii].class]),
+ escaped_name);
+ else
+ charset_label = g_strdup (escaped_name);
+
+ /* XXX Add a tooltip! */
+ action = gtk_radio_action_new (
+ action_name, charset_label, NULL, NULL, ii);
+
+ /* Character set name is static so no need to free it. */
+ g_object_set_data (
+ G_OBJECT (action), "charset",
+ (gpointer) charset_name);
+
+ gtk_radio_action_set_group (action, group);
+ group = gtk_radio_action_get_group (action);
+
+ if (callback != NULL)
+ g_signal_connect (
+ action, "changed", callback, user_data);
+
+ gtk_action_group_add_action (
+ action_group, GTK_ACTION (action));
+
+ g_object_unref (action);
+
+ g_free (action_name);
+ g_free (escaped_name);
+ g_free (charset_label);
+ }
+
+ if (def == G_N_ELEMENTS (charsets)) {
+ const gchar *charset_name;
+ gchar *action_name;
+ gchar *charset_label;
+ gchar **str_array;
+
+ charset_name = default_charset;
+ action_name = g_strconcat (action_prefix, charset_name, NULL);
+
+ /* Escape underlines in the character set name so
+ * they're not treated as GtkLabel mnemonics. */
+ str_array = g_strsplit (charset_name, "_", -1);
+ charset_label = g_strjoinv ("__", str_array);
+ g_strfreev (str_array);
+
+ /* XXX Add a tooltip! */
+ action = gtk_radio_action_new (
+ action_name, charset_label, NULL, NULL, def);
+
+ /* Character set name is static so no need to free it. */
+ g_object_set_data (
+ G_OBJECT (action), "charset",
+ (gpointer) charset_name);
+
+ gtk_radio_action_set_group (action, group);
+ group = gtk_radio_action_get_group (action);
+
+ if (callback != NULL)
+ g_signal_connect (
+ action, "changed", callback, user_data);
+
+ gtk_action_group_add_action (
+ action_group, GTK_ACTION (action));
+
+ g_object_unref (action);
+
+ g_free (action_name);
+ g_free (charset_label);
+ }
+
+ /* Any of the actions in the action group will do. */
+ if (action != NULL)
+ gtk_radio_action_set_current_value (action, def);
+
+ return group;
+}
diff --git a/widgets/misc/e-charset-picker.h b/e-util/e-charset.h
similarity index 82%
rename from widgets/misc/e-charset-picker.h
rename to e-util/e-charset.h
index 16f19e3..57b6976 100644
--- a/widgets/misc/e-charset-picker.h
+++ b/e-util/e-charset.h
@@ -18,15 +18,13 @@
*
*/
-#ifndef E_CHARSET_PICKER_H
-#define E_CHARSET_PICKER_H
+#ifndef E_CHARSET_H
+#define E_CHARSET_H
#include <gtk/gtk.h>
G_BEGIN_DECLS
-GtkWidget * e_charset_picker_new (const gchar *default_charset);
-gchar * e_charset_picker_get_charset (GtkWidget *picker);
GSList * e_charset_add_radio_actions (GtkActionGroup *action_group,
const gchar *action_prefix,
const gchar *default_charset,
@@ -35,4 +33,4 @@ GSList * e_charset_add_radio_actions (GtkActionGroup *action_group,
G_END_DECLS
-#endif /* E_CHARSET_PICKER_H */
+#endif /* E_CHARSET_H */
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 7ffc873..0e20dbb 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -30,11 +30,11 @@
#include <X11/XF86keysym.h>
#endif
-#include "e-util/e-util.h"
#include "e-util/e-binding.h"
+#include "e-util/e-charset.h"
+#include "e-util/e-util.h"
#include "e-util/gconf-bridge.h"
#include "shell/e-shell.h"
-#include "widgets/misc/e-charset-picker.h"
#include "widgets/misc/e-popup-action.h"
#include "mail/e-mail-browser.h"
diff --git a/mail/mail-config.glade b/mail/mail-config.glade
index e9fda21..bc92913 100644
--- a/mail/mail-config.glade
+++ b/mail/mail-config.glade
@@ -315,8 +315,8 @@ For example: "Work" or "Personal"</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<accessibility>
- <atkrelation type="labelled-by" target="identity_address_label"/>
<atkrelation type="labelled-by" target="label464"/>
+ <atkrelation type="labelled-by" target="identity_address_label"/>
</accessibility>
</widget>
<packing>
@@ -360,8 +360,8 @@ For example: "Work" or "Personal"</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<accessibility>
- <atkrelation type="labelled-by" target="label464"/>
<atkrelation type="labelled-by" target="identity_full_name_label"/>
+ <atkrelation type="labelled-by" target="label464"/>
</accessibility>
</widget>
<packing>
@@ -488,8 +488,8 @@ For example: "Work" or "Personal"</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<accessibility>
- <atkrelation type="labelled-by" target="identity_organization_label"/>
<atkrelation type="labelled-by" target="label466"/>
+ <atkrelation type="labelled-by" target="identity_organization_label"/>
</accessibility>
</widget>
<packing>
@@ -520,8 +520,8 @@ For example: "Work" or "Personal"</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<accessibility>
- <atkrelation type="labelled-by" target="label466"/>
<atkrelation type="labelled-by" target="reply_to_label"/>
+ <atkrelation type="labelled-by" target="label466"/>
</accessibility>
</widget>
<packing>
@@ -2653,144 +2653,6 @@ For example: "Work" or "Personal"</property>
</widget>
</child>
</widget>
- <widget class="GtkWindow" id="accounts_tab">
- <property name="title" translatable="yes">Email Accounts</property>
- <child>
- <widget class="GtkHBox" id="toplevel">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <widget class="Custom" id="etableMailAccounts">
- <property name="visible">True</property>
- <property name="creation_function">em_account_prefs_treeview_new</property>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkVBox" id="vboxMailFunctions">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <widget class="GtkVButtonBox" id="vbuttonboxMailAccounts">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <property name="layout_style">start</property>
- <child>
- <widget class="GtkButton" id="cmdAccountAdd">
- <property name="label">gtk-add</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="cmdAccountEdit">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <child>
- <widget class="GtkAlignment" id="alignment33">
- <property name="visible">True</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <child>
- <widget class="GtkHBox" id="hbox224">
- <property name="visible">True</property>
- <property name="spacing">2</property>
- <child>
- <widget class="GtkImage" id="image8">
- <property name="visible">True</property>
- <property name="stock">gtk-properties</property>
- <property name="icon-size">4</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label557">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Edit</property>
- <property name="use_underline">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="cmdAccountDelete">
- <property name="label">gtk-delete</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="cmdAccountDefault">
- <property name="label" translatable="yes">De_fault</property>
- <property name="width_request">89</property>
- <property name="height_request">36</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
<widget class="GtkWindow" id="preferences_tab">
<property name="title" translatable="yes">Mail Preferences</property>
<child>
@@ -3218,7 +3080,6 @@ For example: "Work" or "Personal"</property>
<property name="label" translatable="yes">Default character e_ncoding:</property>
<property name="use_underline">True</property>
<property name="justify">center</property>
- <property name="mnemonic_widget">omenuCharset</property>
</widget>
<packing>
<property name="expand">False</property>
@@ -3227,16 +3088,7 @@ For example: "Work" or "Personal"</property>
</packing>
</child>
<child>
- <widget class="GtkOptionMenu" id="omenuCharset">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
+ <placeholder/>
</child>
</widget>
<packing>
@@ -4458,21 +4310,6 @@ Quoted</property>
</packing>
</child>
<child>
- <widget class="GtkOptionMenu" id="omenuCharset1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
<widget class="GtkLabel" id="lblForwardStyle">
<property name="visible">True</property>
<property name="xalign">0</property>
@@ -4490,7 +4327,6 @@ Quoted</property>
<property name="visible">True</property>
<property name="label" translatable="yes">C_haracter set:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">omenuCharset1</property>
</widget>
<packing>
<property name="top_attach">2</property>
@@ -4499,6 +4335,21 @@ Quoted</property>
<property name="y_options"></property>
</packing>
</child>
+ <child>
+ <widget class="GtkHBox" id="hboxComposerCharset">
+ <property name="visible">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="position">5</property>
@@ -4683,7 +4534,6 @@ Quoted</property>
<property name="label" translatable="yes"><b>Sig_natures</b></property>
<property name="use_markup">True</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">listSignatures</property>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c
index c7e3218..897ccfc 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 18dae56..4c29125 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 6b550b1..36afca4 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 (
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 29f914e..9f8008d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -137,6 +137,7 @@ composer/mail-composer.error.xml
data/evolution.desktop.in.in
data/evolution.keys.in.in
e-util/e-categories-config.c
+e-util/e-charset.c
e-util/e-dialog-utils.c
e-util/e-error.c
e-util/e-logger.c
@@ -481,7 +482,7 @@ widgets/misc/e-calendar-item.c
widgets/misc/e-calendar.c
widgets/misc/e-canvas-background.c
widgets/misc/e-canvas-vbox.c
-widgets/misc/e-charset-picker.c
+widgets/misc/e-charset-combo-box.c
widgets/misc/e-dateedit.c
widgets/misc/e-image-chooser.c
widgets/misc/e-map.c
diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am
index ee11ea7..d893247 100644
--- a/widgets/misc/Makefile.am
+++ b/widgets/misc/Makefile.am
@@ -57,7 +57,7 @@ widgetsinclude_HEADERS = \
e-canvas-utils.h \
e-canvas-vbox.h \
e-cell-renderer-combo.h \
- e-charset-picker.h \
+ e-charset-combo-box.h \
e-colors.h \
e-combo-cell-editable.h \
e-cursors.h \
@@ -120,7 +120,7 @@ libemiscwidgets_la_SOURCES = \
e-canvas-utils.c \
e-canvas-vbox.c \
e-cell-renderer-combo.c \
- e-charset-picker.c \
+ e-charset-combo-box.c \
e-colors.c \
e-combo-cell-editable.c \
e-cursors.c \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]