[gedit] Do not use specific code for win32 with the new api.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gedit] Do not use specific code for win32 with the new api.
- Date: Mon, 30 Nov 2009 15:13:27 +0000 (UTC)
commit e74cf81356f6ecb31a6b280c609a27fad9d36c44
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Mon Nov 30 16:12:47 2009 +0100
Do not use specific code for win32 with the new api.
plugins/spell/gedit-spell-plugin.c | 56 +++--------------------------------
1 files changed, 5 insertions(+), 51 deletions(-)
---
diff --git a/plugins/spell/gedit-spell-plugin.c b/plugins/spell/gedit-spell-plugin.c
index 488f6f3..6cc9d67 100644
--- a/plugins/spell/gedit-spell-plugin.c
+++ b/plugins/spell/gedit-spell-plugin.c
@@ -42,6 +42,7 @@
#ifdef G_OS_WIN32
#include <gedit/gedit-metadata-manager.h>
+#define GEDIT_METADATA_ATTRIBUTE_SPELL_LANGUAGE "spell-language"
#else
#define GEDIT_METADATA_ATTRIBUTE_SPELL_LANGUAGE "metadata::gedit-spell-language"
#endif
@@ -139,36 +140,16 @@ set_spell_language_cb (GeditSpellChecker *spell,
const GeditSpellCheckerLanguage *lang,
GeditDocument *doc)
{
+ const gchar *key;
+
g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
g_return_if_fail (lang != NULL);
-#ifdef G_OS_WIN32
- gchar *uri;
-
- uri = gedit_document_get_uri (doc);
-
- if (uri != NULL)
- {
- const gchar *key;
-
- key = gedit_spell_checker_language_to_key (lang);
- g_return_if_fail (key != NULL);
-
- gedit_metadata_manager_set (uri,
- "spell-language",
- key);
-
- g_free (uri);
- }
-#else
- const gchar *key;
-
key = gedit_spell_checker_language_to_key (lang);
g_return_if_fail (key != NULL);
gedit_document_set_metadata (doc, GEDIT_METADATA_ATTRIBUTE_SPELL_LANGUAGE,
key, NULL);
-#endif
}
static GeditSpellChecker *
@@ -185,37 +166,11 @@ get_spell_checker_from_document (GeditDocument *doc)
if (data == NULL)
{
- spell = gedit_spell_checker_new ();
-
-#ifdef G_OS_WIN32
- gchar *uri;
-
- uri = gedit_document_get_uri (doc);
-
- if (uri != NULL)
- {
- gchar *key;
- const GeditSpellCheckerLanguage *lang = NULL;
-
- key = gedit_metadata_manager_get (uri,
- "spell-language");
-
- if (key != NULL)
- {
- lang = gedit_spell_checker_language_from_key (key);
- g_free (key);
- }
-
- if (lang != NULL)
- gedit_spell_checker_set_language (spell,
- lang);
-
- g_free (uri);
- }
-#else
const GeditSpellCheckerLanguage *lang = NULL;
gchar *value = NULL;
+ spell = gedit_spell_checker_new ();
+
value = gedit_document_get_metadata (doc, GEDIT_METADATA_ATTRIBUTE_SPELL_LANGUAGE);
if (value != NULL)
@@ -228,7 +183,6 @@ get_spell_checker_from_document (GeditDocument *doc)
{
gedit_spell_checker_set_language (spell, lang);
}
-#endif
g_object_set_qdata_full (G_OBJECT (doc),
spell_checker_id,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]