aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/e-mail-shell-module-settings.c31
-rw-r--r--mail/em-composer-prefs.c167
-rw-r--r--mail/em-composer-prefs.h4
-rw-r--r--mail/em-folder-view.c141
-rw-r--r--mail/mail-config.glade79
5 files changed, 141 insertions, 281 deletions
diff --git a/mail/e-mail-shell-module-settings.c b/mail/e-mail-shell-module-settings.c
index 06474755ef..e3d77e6a82 100644
--- a/mail/e-mail-shell-module-settings.c
+++ b/mail/e-mail-shell-module-settings.c
@@ -190,6 +190,20 @@ e_mail_shell_module_init_settings (EShell *shell)
"/apps/evolution/mail/display/force_message_limit");
e_shell_settings_install_property (
+ g_param_spec_int (
+ "mail-forward-style",
+ NULL,
+ NULL,
+ 0,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-forward-style",
+ "/apps/evolution/mail/format/forward_style");
+
+ e_shell_settings_install_property (
g_param_spec_boolean (
"mail-magic-spacebar",
NULL,
@@ -277,6 +291,23 @@ e_mail_shell_module_init_settings (EShell *shell)
shell_settings, "mail-prompt-delete-in-vfolder",
"/apps/evolution/mail/prompts/delete_in_vfolder");
+ /* Note: This value corresponds to MailConfigReplyStyle enum,
+ * but the ordering of the combo box items in preferences
+ * has changed. We use transformation functions there. */
+ e_shell_settings_install_property (
+ g_param_spec_int (
+ "mail-reply-style",
+ NULL,
+ NULL,
+ 0,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+
+ e_shell_settings_bind_to_gconf (
+ shell_settings, "mail-reply-style",
+ "/apps/evolution/mail/format/reply_style");
+
e_shell_settings_install_property (
g_param_spec_boolean (
"mail-show-animated-images",
diff --git a/mail/em-composer-prefs.c b/mail/em-composer-prefs.c
index 6d5da4936c..686b9c8da0 100644
--- a/mail/em-composer-prefs.c
+++ b/mail/em-composer-prefs.c
@@ -90,6 +90,76 @@ transform_string_to_color (const GValue *src_value,
return success;
}
+static gboolean
+transform_old_to_new_reply_style (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ gboolean success = TRUE;
+
+ /* XXX This is the kind of legacy crap we wind up
+ * with when we don't migrate things properly. */
+
+ switch (g_value_get_int (src_value)) {
+ case 0: /* Quoted: 0 -> 2 */
+ g_value_set_int (dst_value, 2);
+ break;
+
+ case 1: /* Do Not Quote: 1 -> 3 */
+ g_value_set_int (dst_value, 3);
+ break;
+
+ case 2: /* Attach: 2 -> 0 */
+ g_value_set_int (dst_value, 0);
+ break;
+
+ case 3: /* Outlook: 3 -> 1 */
+ g_value_set_int (dst_value, 1);
+ break;
+
+ default:
+ success = FALSE;
+ break;
+ }
+
+ return success;
+}
+
+static gboolean
+transform_new_to_old_reply_style (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ gboolean success = TRUE;
+
+ /* XXX This is the kind of legacy crap we wind up
+ * with when we don't migrate things properly. */
+
+ switch (g_value_get_int (src_value)) {
+ case 0: /* Attach: 0 -> 2 */
+ g_value_set_int (dst_value, 2);
+ break;
+
+ case 1: /* Outlook: 1 -> 3 */
+ g_value_set_int (dst_value, 3);
+ break;
+
+ case 2: /* Quoted: 2 -> 0 */
+ g_value_set_int (dst_value, 0);
+ break;
+
+ case 3: /* Do Not Quote: 3 -> 1 */
+ g_value_set_int (dst_value, 1);
+ break;
+
+ default:
+ success = FALSE;
+ break;
+ }
+
+ return success;
+}
+
static void
composer_prefs_dispose (GObject *object)
{
@@ -673,65 +743,6 @@ spell_setup (EMComposerPrefs *prefs)
g_list_free (active_languages);
}
-static gint
-attach_style_reply_new_order (gint style_id,
- gboolean from_enum_to_option_id)
-{
- gint values[] = {
- MAIL_CONFIG_REPLY_ATTACH, 0,
- MAIL_CONFIG_REPLY_OUTLOOK, 1,
- MAIL_CONFIG_REPLY_QUOTED, 2,
- MAIL_CONFIG_REPLY_DO_NOT_QUOTE, 3,
- -1, -1};
- gint ii;
-
- for (ii = from_enum_to_option_id ? 0 : 1; values[ii] != -1; ii += 2) {
- if (values[ii] == style_id)
- return values [from_enum_to_option_id ? ii + 1 : ii - 1];
- }
-
- return style_id;
-}
-
-static void
-attach_style_info (GtkWidget *item,
- gpointer user_data)
-{
- gint *style = user_data;
-
- g_object_set_data (
- G_OBJECT (item), "style", GINT_TO_POINTER (*style));
-
- (*style)++;
-}
-
-static void
-attach_style_info_reply (GtkWidget *item,
- gpointer user_data)
-{
- gint *style = user_data;
-
- g_object_set_data (
- G_OBJECT (item), "style", GINT_TO_POINTER (
- attach_style_reply_new_order (*style, FALSE)));
-
- (*style)++;
-}
-
-static void
-style_activate (GtkWidget *item,
- EMComposerPrefs *prefs)
-{
- GConfClient *client;
- const gchar *key;
- gint style;
-
- client = mail_config_get_gconf_client ();
- key = g_object_get_data (G_OBJECT (item), "key");
- style = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "style"));
- gconf_client_set_int (client, key, style, NULL);
-}
-
static void
charset_activate (GtkWidget *item,
EMComposerPrefs *prefs)
@@ -855,7 +866,6 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
GConfBridge *bridge;
GConfClient *client;
const gchar *key;
- int style;
gchar *buf;
EMConfig *ec;
EMConfigTargetPrefs *target;
@@ -971,7 +981,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
gtk_tree_view_insert_column_with_attributes (
view, -1, _("Language(s)"),
- gtk_cell_renderer_text_new (),
+ gtk_cell_renderer_text_new (),
"text", 1, NULL);
selection = gtk_tree_view_get_selection (view);
gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);
@@ -991,31 +1001,18 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
spell_setup (prefs);
/* Forwards and Replies */
- prefs->forward_style = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuForwardStyle"));
- style = gconf_client_get_int (client, "/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);
-
- if (gtk_option_menu_get_menu (prefs->forward_style)) {
- option_menu_connect (prefs, prefs->forward_style, G_CALLBACK (style_activate),
- "/apps/evolution/mail/format/forward_style");
- }
+ widget = glade_xml_get_widget (gui, "comboboxForwardStyle");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "mail-forward-style",
+ G_OBJECT (widget), "active");
- prefs->reply_style = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuReplyStyle"));
- style = gconf_client_get_int (client, "/apps/evolution/mail/format/reply_style", NULL);
- gtk_option_menu_set_history (prefs->reply_style, attach_style_reply_new_order (style, TRUE));
- style = 0;
- gtk_container_foreach (GTK_CONTAINER (gtk_option_menu_get_menu (prefs->reply_style)),
- attach_style_info_reply, &style);
-
-
- if (gtk_option_menu_get_menu (prefs->reply_style)) {
- option_menu_connect (prefs, prefs->reply_style, G_CALLBACK (style_activate),
- "/apps/evolution/mail/format/reply_style");
- }
+ widget = glade_xml_get_widget (gui, "comboboxReplyStyle");
+ e_mutual_binding_new_full (
+ G_OBJECT (shell_settings), "mail-reply-style",
+ G_OBJECT (widget), "active",
+ transform_old_to_new_reply_style,
+ transform_new_to_old_reply_style,
+ NULL, NULL);
/* Signatures */
dialog = (GtkDialog *) gtk_dialog_new ();
diff --git a/mail/em-composer-prefs.h b/mail/em-composer-prefs.h
index 0906253af6..0dc848743e 100644
--- a/mail/em-composer-prefs.h
+++ b/mail/em-composer-prefs.h
@@ -65,10 +65,6 @@ struct _EMComposerPrefs {
GtkTreeModel *language_model;
- /* Forwards and Replies */
- GtkOptionMenu *forward_style;
- GtkOptionMenu *reply_style;
-
/* Keyboard Shortcuts */
GtkOptionMenu *shortcuts_type;
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 6276fb1158..7412f0abe3 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -338,143 +338,6 @@ emfv_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, EMFolder
/* Popup menu
In many cases these are the functions called by the bonobo callbacks too */
-static EPopupItem emfv_popup_items[] = {
-
- { E_POPUP_SUBMENU, "60.label.00", N_("_Label"), NULL, NULL, NULL, EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY },
- { E_POPUP_ITEM, "60.label.00/00.label", N_("_None"), emfv_popup_label_clear, NULL, NULL, EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY },
- { E_POPUP_BAR, "60.label.00/00.label.00", NULL, NULL, NULL, NULL },
- { E_POPUP_BAR, "60.label.00/01.label", NULL, NULL, NULL, NULL },
- { E_POPUP_ITEM, "60.label.00/01.label.00", N_("_New Label"), emfv_popup_label_new, NULL, NULL, EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY },
-
-};
-
-static enum _e_popup_t
-emfv_popup_labels_get_state_for_tag (EMFolderView *emfv, GPtrArray *uids, const char *label_tag)
-{
- enum _e_popup_t state = 0;
- int i;
- gboolean exists = FALSE, not_exists = FALSE;
-
- g_return_val_if_fail (emfv != 0, state);
- g_return_val_if_fail (label_tag != NULL, state);
-
- for (i = 0; i < uids->len && (!exists || !not_exists); i++) {
- if (camel_folder_get_message_user_flag (emfv->folder, uids->pdata[i], label_tag))
- exists = TRUE;
- else {
- const char *label = e_util_labels_get_new_tag (camel_folder_get_message_user_tag (emfv->folder, uids->pdata[i], "label"));
-
- /* backward compatibility... */
- if (label && !strcmp (label, label_tag))
- exists = TRUE;
- else
- not_exists = TRUE;
- }
- }
-
- if (exists && not_exists)
- state = E_POPUP_INCONSISTENT;
- else if (exists)
- state = E_POPUP_ACTIVE;
-
- return state;
-}
-
-static void
-emfv_popup_labels_free(EPopup *ep, GSList *l, void *data)
-{
- while (l) {
- GSList *n = l->next;
- EPopupItem *item = l->data;
-
- g_free(item->path);
- g_free(item);
-
- g_slist_free_1(l);
- l = n;
- }
-}
-
-static void
-emfv_popup_items_free(EPopup *ep, GSList *items, void *data)
-{
- g_slist_free(items);
-}
-
-static void
-emfv_popup(EMFolderView *emfv, GdkEvent *event, int on_display)
-{
- GSList *menus = NULL, *l, *label_list = NULL;
- GtkMenu *menu;
- EMPopup *emp;
- EMPopupTargetSelect *target;
- int i;
-
- /** @HookPoint-EMPopup: Message List Context Menu
- * @Id: org.gnome.evolution.mail.folderview.popup.select
- * @Type: EMPopup
- * @Target: EMPopupTargetSelect
- *
- * This is the context menu shown on the message list or over a message.
- */
- emp = em_popup_new("org.gnome.evolution.mail.folderview.popup");
- target = em_folder_view_get_popup_target(emfv, emp, on_display);
-
- for (i=0;i<sizeof(emfv_popup_items)/sizeof(emfv_popup_items[0]);i++)
- menus = g_slist_prepend(menus, &emfv_popup_items[i]);
-
- e_popup_add_items((EPopup *)emp, menus, NULL, emfv_popup_items_free, emfv);
-
- i = 1;
- if (!on_display) {
- GPtrArray *uids = message_list_get_selected (emfv->list);
-
- for (l = mail_config_get_labels (); l; l = l->next) {
- EPopupItem *item;
- EUtilLabel *label = l->data;
- GdkPixmap *pixmap;
- GdkColor colour;
- GdkGC *gc;
-
- item = g_malloc0(sizeof(*item));
- item->type = E_POPUP_TOGGLE | emfv_popup_labels_get_state_for_tag (emfv, uids, label->tag);
- item->path = g_strdup_printf("60.label.00/00.label.%02d", i++);
- item->label = label->name;
- item->activate = emfv_popup_label_set;
- item->user_data = label->tag;
-
- item->visible = EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY;
-
- gdk_color_parse (label->colour, &colour);
- gdk_colormap_alloc_color(gdk_colormap_get_system(), &colour, FALSE, TRUE);
-
- pixmap = gdk_pixmap_new(((GtkWidget *)emfv)->window, 16, 16, -1);
- gc = gdk_gc_new(((GtkWidget *)emfv)->window);
- gdk_gc_set_foreground(gc, &colour);
- gdk_draw_rectangle(pixmap, gc, TRUE, 0, 0, 16, 16);
- g_object_unref(gc);
-
- item->image = gtk_image_new_from_pixmap(pixmap, NULL);
- gtk_widget_show(item->image);
-
- label_list = g_slist_prepend(label_list, item);
- }
-
- message_list_free_uids (emfv->list, uids);
- }
-
- e_popup_add_items((EPopup *)emp, label_list, NULL, emfv_popup_labels_free, emfv);
-
- menu = e_popup_create_menu_once((EPopup *)emp, (EPopupTarget *)target, 0);
-
- if (event == NULL || event->type == GDK_KEY_PRESS) {
- /* FIXME: menu pos function */
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0, event ? event->key.time : gtk_get_current_event_time());
- } else {
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button.button, event->button.time);
- }
-}
-
/* ********************************************************************** */
/* Bonobo menu's */
@@ -487,10 +350,6 @@ from(BonoboUIComponent *uid, void *data, const char *path) \
to(NULL, NULL, data); \
}
-//EMFV_MAP_CALLBACK(emfv_message_delete, emfv_popup_delete)
-//EMFV_MAP_CALLBACK(emfv_message_open, emfv_popup_open)
-//EMFV_MAP_CALLBACK(emfv_message_source, emfv_popup_source)
-
static void
prepare_offline(void *key, void *value, void *data)
{
diff --git a/mail/mail-config.glade b/mail/mail-config.glade
index 84b3bbd6ab..d2d8da8ea7 100644
--- a/mail/mail-config.glade
+++ b/mail/mail-config.glade
@@ -1132,6 +1132,7 @@ For example: "Work" or "Personal"</property>
<property name="visible">True</property>
</widget>
<packing>
+ <property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
@@ -4230,6 +4231,33 @@ For example: "Work" or "Personal"</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
+ <widget class="GtkComboBox" id="comboboxReplyStyle">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Attachment
+Inline (Outlook style)
+Quoted
+Do Not Quote</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="comboboxForwardStyle">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Attachment
+Inline
+Quoted</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkLabel" id="lblCharset">
<property name="visible">True</property>
<property name="label" translatable="yes">C_haracter set:</property>
@@ -4250,7 +4278,6 @@ For example: "Work" or "Personal"</property>
<property name="label" translatable="yes">_Forward style:</property>
<property name="use_underline">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="mnemonic_widget">omenuForwardStyle</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
@@ -4273,62 +4300,12 @@ For example: "Work" or "Personal"</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hboxForwardStyle">
- <property name="visible">True</property>
- <child>
- <widget class="GtkOptionMenu" id="omenuForwardStyle">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="response_id">0</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <widget class="GtkAlignment" id="alignment25">
- <property name="visible">True</property>
- <property name="xalign">7.4505801528346183e-09</property>
- <property name="xscale">0</property>
- <child>
- <widget class="GtkHBox" id="hboxReplyStyle">
- <property name="visible">True</property>
- <child>
- <widget class="GtkOptionMenu" id="omenuReplyStyle">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="response_id">0</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
<widget class="GtkLabel" id="lblReplyStyle">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Reply style:</property>
<property name="use_underline">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="mnemonic_widget">omenuReplyStyle</property>
</widget>
<packing>
<property name="top_attach">1</property>