[libpeas/libpeas-1.8.1-osx] Fix use of Cocoa to show help



commit 90532414b975af7a2a7e864868a3e79f930c6521
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Sun Jan 26 15:13:42 2014 +0100

    Fix use of Cocoa to show help

 configure.ac                          |    2 ++
 libpeas-gtk/Makefile.am               |    8 ++++++++
 libpeas-gtk/peas-gtk-osx.h            |    9 +++++++++
 libpeas-gtk/peas-gtk-osx.m            |    9 +++++++++
 libpeas-gtk/peas-gtk-plugin-manager.c |   10 +++++-----
 5 files changed, 33 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2714229..29c8db0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -143,6 +143,8 @@ if test "$os_osx" = "yes"; then
        AC_DEFINE([OS_OSX],[1],[Defined if os is Mac OSX])
 
        PKG_CHECK_MODULES(GTK_MAC, gtk-mac-integration)
+
+       AC_PROG_OBJC
 fi
 
 dnl ================================================================
diff --git a/libpeas-gtk/Makefile.am b/libpeas-gtk/Makefile.am
index 0ed84cd..ff3a001 100644
--- a/libpeas-gtk/Makefile.am
+++ b/libpeas-gtk/Makefile.am
@@ -5,6 +5,7 @@ INCLUDES = \
        -I$(srcdir)                     \
        $(PEAS_CFLAGS)                  \
        $(PEAS_GTK_CFLAGS)              \
+       $(GTK_MAC_CFLAGS)               \
        $(GCOV_CFLAGS)                  \
        $(WARN_CFLAGS)                  \
        $(DISABLE_DEPRECATED)
@@ -17,6 +18,7 @@ libpeas_gtk_1_0_la_LDFLAGS = \
 libpeas_gtk_1_0_la_LIBADD = \
        $(PEAS_LIBS)                                                    \
        $(PEAS_GTK_LIBS)                                                \
+       $(GTK_MAC_LIBS)                                                 \
        $(top_builddir)/libpeas/libpeas-1.0.la
 
 INST_H_FILES = \
@@ -36,6 +38,12 @@ C_FILES = \
        peas-gtk-plugin-manager-store.c         \
        peas-gtk-plugin-manager-view.c
 
+if OS_OSX
+C_FILES += peas-gtk-osx.m
+
+libpeas_gtk_1_0_la_LDFLAGS += -framework Cocoa
+endif
+
 libpeas_gtk_1_0_la_SOURCES = \
        $(INST_H_FILES)                 \
        $(NOINST_H_FILES)               \
diff --git a/libpeas-gtk/peas-gtk-osx.h b/libpeas-gtk/peas-gtk-osx.h
new file mode 100644
index 0000000..7cf9667
--- /dev/null
+++ b/libpeas-gtk/peas-gtk-osx.h
@@ -0,0 +1,9 @@
+#ifndef __PEAS_GTK_OSX_H__
+#define __PEAS_GTK_OSX_H__
+
+#include <glib-object.h>
+
+void peas_gtk_osx_show_uri (const gchar *uri);
+
+#endif /* __PEAS_GTK_OSX_H__ */
+
diff --git a/libpeas-gtk/peas-gtk-osx.m b/libpeas-gtk/peas-gtk-osx.m
new file mode 100644
index 0000000..0340973
--- /dev/null
+++ b/libpeas-gtk/peas-gtk-osx.m
@@ -0,0 +1,9 @@
+#include "peas-gtk-osx.h"
+
+#include <Cocoa/Cocoa.h>
+
+void
+peas_gtk_osx_show_uri (const gchar *uri)
+{
+  [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[NSString stringWithUTF8String:uri]]];
+}
diff --git a/libpeas-gtk/peas-gtk-plugin-manager.c b/libpeas-gtk/peas-gtk-plugin-manager.c
index e8f3248..e48b1eb 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager.c
@@ -29,10 +29,6 @@
 #include <string.h>
 #include <girepository.h>
 
-#ifdef OS_OSX
-#include <Carbon/Carbon.h>
-#endif
-
 #include <libpeas/peas-engine.h>
 #include <libpeas/peas-plugin-info.h>
 #include <libpeas/peas-i18n.h>
@@ -41,6 +37,10 @@
 #include "peas-gtk-plugin-manager-view.h"
 #include "peas-gtk-configurable.h"
 
+#ifdef OS_OSX
+#include "peas-gtk-osx.h"
+#endif
+
 /**
  * SECTION:peas-gtk-plugin-manager
  * @short_description: Management GUI for plugins.
@@ -161,7 +161,7 @@ help_button_cb (GtkWidget      *button,
   help_uri = peas_plugin_info_get_help_uri (info);
 
 #ifdef OS_OSX
-  [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[NSString stringWithUTF8String:help_uri]]];
+  peas_gtk_osx_show_uri (help_uri);
 #else
 
   gtk_show_uri (NULL,


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