[gedit/wip/3.14-osx: 12/16] [osx] Fix spell check directories on OS X



commit 2f4679a21f801d7b4265a552ebc2196c7a760013
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Wed Aug 20 13:56:34 2014 +0200

    [osx] Fix spell check directories on OS X

 plugins/spell/Makefile.am                    |    7 ++-----
 plugins/spell/gedit-spell-checker-language.c |   25 +++++++++++--------------
 plugins/spell/gedit-spell-osx.c              |   11 +++++++++--
 plugins/spell/gedit-spell-osx.h              |    3 ++-
 4 files changed, 24 insertions(+), 22 deletions(-)
---
diff --git a/plugins/spell/Makefile.am b/plugins/spell/Makefile.am
index ce710ce..e75ac67 100644
--- a/plugins/spell/Makefile.am
+++ b/plugins/spell/Makefile.am
@@ -46,17 +46,14 @@ plugins_spell_libspell_la_SOURCES =                 \
 if OS_OSX
 noinst_LTLIBRARIES += plugins/spell/libosx.la
 
-plugins_spell_libosx_la_LDFLAGS = -framework Cocoa
-plugins_spell_libosx_la_LIBADD = -lobjc
-plugins_spell_libosx_la_CFLAGS = -xobjective-c
+plugins_spell_libosx_la_LDFLAGS = -framework Cocoa $(GTK_MAC_LIBS)
+plugins_spell_libosx_la_CFLAGS = $(GEDIT_CFLAGS) $(GTK_MAC_CFLAGS) -xobjective-c
 
 plugins_spell_libosx_la_SOURCES =              \
        plugins/spell/gedit-spell-osx.c         \
        plugins/spell/gedit-spell-osx.h
 
 plugins_spell_libspell_la_LIBADD += plugins/spell/libosx.la
-plugins_spell_libspell_la_LDFLAGS += $(GTK_MAC_LIBS)
-plugins_spell_libspell_la_CFLAGS += $(GTK_MAC_CFLAGS)
 endif
 
 plugins/spell/gedit-spell-marshal.h: plugins/spell/gedit-spell-marshal.list $(GLIB_GENMARSHAL)
diff --git a/plugins/spell/gedit-spell-checker-language.c b/plugins/spell/gedit-spell-checker-language.c
index 2684e72..2ad3696 100644
--- a/plugins/spell/gedit-spell-checker-language.c
+++ b/plugins/spell/gedit-spell-checker-language.c
@@ -29,7 +29,7 @@
 #endif
 
 #ifdef OS_OSX
-#include <gtkosxapplication.h>
+#include "gedit-spell-osx.h"
 #endif
 
 #include <string.h>
@@ -74,14 +74,12 @@ get_iso_codes_locale_dir (void)
                                       NULL);
 #else
 #if OS_OSX
-       if (gtkosx_application_get_bundle_id () != NULL)
-       {
-               const gchar *bundle_resource_dir = gtkosx_application_get_resource_path ();
+       gchar *res_dir = gedit_spell_osx_get_resource_path ();
 
-               locale_dir = g_build_filename (bundle_resource_dir,
-                                              "share",
-                                              "locale",
-                                              NULL);
+       if (res_dir != NULL)
+       {
+               locale_dir = g_build_filename (res_dir, "share", "locale", NULL);
+               g_free (res_dir);
        }
 #endif
        if (locale_dir == NULL)
@@ -113,13 +111,12 @@ get_iso_codes_xml_name (gint iso)
                                      NULL);
 #else
 #if OS_OSX
-       if (gtkosx_application_get_bundle_id () != NULL)
-       {
-               const gchar *bundle_resource_dir = gtkosx_application_get_resource_path ();
+       gchar *res_dir = gedit_spell_osx_get_resource_path ();
 
-               share_dir = g_build_filename (bundle_resource_dir,
-                                              "share",
-                                              NULL);
+       if (res_dir != NULL)
+       {
+               share_dir = g_build_filename (res_dir, "share", NULL);
+               g_free (res_dir);
        }
 #endif
        if (share_dir == NULL)
diff --git a/plugins/spell/gedit-spell-osx.c b/plugins/spell/gedit-spell-osx.c
index 502be0a..bf90616 100644
--- a/plugins/spell/gedit-spell-osx.c
+++ b/plugins/spell/gedit-spell-osx.c
@@ -1,5 +1,12 @@
 #include "gedit-spell-osx.h"
-#include <Cocoa/Cocoa.h>
+#include <gtkosxapplication.h>
+#import <Cocoa/Cocoa.h>
+
+gchar *
+gedit_spell_osx_get_resource_path (void)
+{
+       return gtkosx_application_get_resource_path ();
+}
 
 gchar *
 gedit_spell_osx_get_preferred_spell_language ()
@@ -9,7 +16,7 @@ gedit_spell_osx_get_preferred_spell_language ()
 
        pool = [[NSAutoreleasePool alloc] init];
 
-#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
+#if defined(MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
        NSArray *langs;
 
        langs = [[NSSpellChecker sharedSpellChecker] userPreferredLanguages];
diff --git a/plugins/spell/gedit-spell-osx.h b/plugins/spell/gedit-spell-osx.h
index 9b87275..95178a0 100644
--- a/plugins/spell/gedit-spell-osx.h
+++ b/plugins/spell/gedit-spell-osx.h
@@ -6,9 +6,10 @@
 G_BEGIN_DECLS
 
 gchar *gedit_spell_osx_get_preferred_spell_language (void);
+gchar *gedit_spell_osx_get_resource_path (void);
 
 G_END_DECLS
 
 #endif /* _GEDIT_SPELL_OSX_H */
 
-/* ex:set ts=8 noet: */
\ No newline at end of file
+/* ex:set ts=8 noet: */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]