aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-11-24 13:14:44 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-11-24 13:14:44 +0800
commit4f4615a46d5ba518c1e6a0c2412b1edf1e268d99 (patch)
tree828acaa7b76aa12a490a3238b0ec4a7086b8be16 /composer
parent076b7c45131482b87d18963d34d035435491ee8d (diff)
downloadgsoc2013-evolution-4f4615a46d5ba518c1e6a0c2412b1edf1e268d99.tar.gz
gsoc2013-evolution-4f4615a46d5ba518c1e6a0c2412b1edf1e268d99.tar.zst
gsoc2013-evolution-4f4615a46d5ba518c1e6a0c2412b1edf1e268d99.zip
Merge revisions 36737:36810 from trunk.
svn path=/branches/kill-bonobo/; revision=36811
Diffstat (limited to 'composer')
-rw-r--r--composer/ChangeLog32
-rw-r--r--composer/e-msg-composer.c132
-rw-r--r--composer/e-msg-composer.h3
3 files changed, 150 insertions, 17 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index aa88a29e94..b258637da4 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,35 @@
+2008-11-07 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Fix for bug #559701
+
+ * e-msg-composer.c: (e_load_spell_languages): Don't save when its
+ NULL.
+
+2008-11-05 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes part of bug #559371
+
+ * e-msg-composer.c (e_load_spell_languages):
+ New function loads a list of GtkhtmlSpellLanguage structs from
+ GConf, taking care of details like converting language codes to
+ structs and ensuring the returned list is non-empty.
+
+ * e-msg-composer.c (e_save_spell_languages):
+ New function saves a list of GtkhtmlSpellLanguage structs to
+ GConf, taking care of details like converting the structs to
+ language codes.
+
+ * e-msg-composer.c (msg_composer_constructor):
+ Simplify the logic by using e_load_spell_languages().
+
+2008-11-04 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes bug #554450
+
+ * e-msg-composer.c (msg_composer_init):
+ Get drag-and-drop to the attachment bar working again, but see
+ my note in the source code. I'm still not sure why it broke.
+
2008-11-02 Matthew Barnes <mbarnes@redhat.com>
** Fixes bug #559028
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 6f1b10d7d4..5d2c8b8c73 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -2085,10 +2085,9 @@ msg_composer_constructor (GType type,
GObject *object;
EMsgComposer *composer;
GtkToggleAction *action;
- GList *spell_languages = NULL;
+ GList *spell_languages;
GConfClient *client;
GArray *array;
- GSList *list;
gboolean active;
guint binding_id;
@@ -2155,21 +2154,7 @@ msg_composer_constructor (GType type,
client, COMPOSER_GCONF_REQUEST_RECEIPT_KEY, NULL);
gtk_toggle_action_set_active (action, active);
- list = gconf_client_get_list (
- client, COMPOSER_GCONF_SPELL_LANGUAGES_KEY,
- GCONF_VALUE_STRING, NULL);
- while (list != NULL) {
- gchar *language_code = list->data;
- const GtkhtmlSpellLanguage *language;
-
- language = gtkhtml_spell_language_lookup (language_code);
- if (language != NULL)
- spell_languages = g_list_prepend (
- spell_languages, (gpointer) language);
-
- list = g_slist_delete_link (list, list);
- g_free (language_code);
- }
+ spell_languages = e_load_spell_languages ();
gtkhtml_editor_set_spell_languages (
GTKHTML_EDITOR (composer), spell_languages);
g_list_free (spell_languages);
@@ -2791,6 +2776,27 @@ msg_composer_init (EMsgComposer *composer)
drop_types, G_N_ELEMENTS (drop_types),
GDK_ACTION_COPY | GDK_ACTION_ASK | GDK_ACTION_MOVE);
+ /* XXX I'm not sure why we have to explicitly configure the
+ * attachment bar as a drag destination when CompEditor
+ * doesn't and previous Evolution releases (2.22 and
+ * prior) don't, but this is the only way I could figure
+ * out how to get drag-and-drop to the attachment bar
+ * working again. I'm probably overlooking something
+ * simple... */
+
+ gtk_drag_dest_set (
+ composer->priv->attachment_bar, GTK_DEST_DEFAULT_ALL,
+ drop_types, G_N_ELEMENTS (drop_types),
+ GDK_ACTION_COPY | GDK_ACTION_ASK | GDK_ACTION_MOVE);
+
+ g_signal_connect (
+ composer->priv->attachment_bar, "drag-motion",
+ G_CALLBACK (msg_composer_drag_motion), NULL);
+
+ g_signal_connect (
+ composer->priv->attachment_bar, "drag-data-received",
+ G_CALLBACK (msg_composer_drag_data_received), NULL);
+
g_signal_connect (
html, "drag-data-received",
G_CALLBACK (msg_composer_drag_data_received), NULL);
@@ -4791,3 +4797,95 @@ e_msg_composer_set_send_options (EMsgComposer *composer,
composer->priv->send_invoked = send_enable;
}
+
+GList *
+e_load_spell_languages (void)
+{
+ GConfClient *client;
+ GList *spell_languages = NULL;
+ GSList *list;
+ const gchar *key;
+ GError *error = NULL;
+
+ /* Ask GConf for a list of spell check language codes. */
+ client = gconf_client_get_default ();
+ key = COMPOSER_GCONF_SPELL_LANGUAGES_KEY;
+ list = gconf_client_get_list (client, key, GCONF_VALUE_STRING, &error);
+ g_object_unref (client);
+
+ /* Convert the codes to spell language structs. */
+ while (list != NULL) {
+ gchar *language_code = list->data;
+ const GtkhtmlSpellLanguage *language;
+
+ language = gtkhtml_spell_language_lookup (language_code);
+ if (language != NULL)
+ spell_languages = g_list_prepend (
+ spell_languages, (gpointer) language);
+
+ list = g_slist_delete_link (list, list);
+ g_free (language_code);
+ }
+
+ spell_languages = g_list_reverse (spell_languages);
+
+ /* Pick a default spell language if GConf came back empty. */
+ if (spell_languages == NULL) {
+ const GtkhtmlSpellLanguage *language;
+
+ language = gtkhtml_spell_language_lookup (NULL);
+
+ if (language) {
+ spell_languages = g_list_prepend (
+ spell_languages, (gpointer) language);
+
+ /* Don't overwrite the stored spell check language
+ * codes if there was a problem retrieving them. */
+ if (error == NULL)
+ e_save_spell_languages (spell_languages);
+ }
+ }
+
+ if (error != NULL) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
+
+ return spell_languages;
+}
+
+void
+e_save_spell_languages (GList *spell_languages)
+{
+ GConfClient *client;
+ GSList *list = NULL;
+ const gchar *key;
+ GError *error = NULL;
+
+ /* Build a list of spell check language codes. */
+ while (spell_languages != NULL) {
+ const GtkhtmlSpellLanguage *language;
+ const gchar *language_code;
+
+ language = spell_languages->data;
+ language_code = gtkhtml_spell_language_get_code (language);
+ list = g_slist_prepend (list, (gpointer) language_code);
+
+ spell_languages = g_list_next (spell_languages);
+ }
+
+ list = g_slist_reverse (list);
+
+ /* Save the language codes to GConf. */
+ client = gconf_client_get_default ();
+ key = COMPOSER_GCONF_SPELL_LANGUAGES_KEY;
+ gconf_client_set_list (client, key, GCONF_VALUE_STRING, list, &error);
+ g_object_unref (client);
+
+ g_slist_free (list);
+
+ if (error != NULL) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
+}
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index 7303069bc9..c37845b5ca 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -159,6 +159,9 @@ struct _EAttachmentBar *
gboolean e_msg_composer_is_exiting (EMsgComposer *composer);
+GList * e_load_spell_languages (void);
+void e_save_spell_languages (GList *spell_languages);
+
G_END_DECLS
#endif /* E_MSG_COMPOSER_H */