[frogr: 9/9] Merged (experimental) MacOSX support
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [frogr: 9/9] Merged (experimental) MacOSX support
- Date: Thu, 21 Apr 2011 08:15:19 +0000 (UTC)
commit cfc6cf8602cec0b9bc24738119f028bcef00cba9
Merge: 3fc833d fc156bd
Author: Mario Sanchez Prada <msanchez igalia com>
Date: Thu Apr 21 10:07:34 2011 +0200
Merged (experimental) MacOSX support
configure.ac | 33 +++++++++
data/gtkbuilder/frogr-main-view.xml | 10 ---
frogr.bundle | 131 +++++++++++++++++++++++++++++++++++
macosx/Info-frogr.plist | 30 ++++++++
macosx/frogr.icns | Bin 0 -> 246472 bytes
macosx/gtkrc | 1 +
src/Makefile.am | 2 +
src/frogr-main-view.c | 70 +++++++++++++++++--
src/frogr-picture-loader.c | 23 +++++--
src/frogr-util.c | 44 ++++++++----
src/main.c | 10 +++
11 files changed, 319 insertions(+), 35 deletions(-)
---
diff --cc src/frogr-main-view.c
index 2a38554,c34e95f..5a52e2c
--- a/src/frogr-main-view.c
+++ b/src/frogr-main-view.c
@@@ -908,7 -941,9 +948,10 @@@ _add_pictures_dialog (FrogrMainView *se
gtk_file_filter_add_mime_type (filter, "image/png");
gtk_file_filter_add_mime_type (filter, "image/bmp");
gtk_file_filter_add_mime_type (filter, "image/gif");
+ #endif
+
- gtk_file_filter_set_name (filter, "images");
+ gtk_file_filter_set_name (filter, _("images"));
++
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE);
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), FALSE);
diff --cc src/frogr-util.c
index eda7c85,3333990..0934040
--- a/src/frogr-util.c
+++ b/src/frogr-util.c
@@@ -27,6 -27,6 +27,22 @@@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
++static gboolean frogr_util_spawn_command (const gchar* cmd)
++{
++ GError *error = NULL;
++
++ if (!g_spawn_command_line_async (cmd, &error)) {
++ if (error != NULL)
++ {
++ DEBUG ("Error spawning command '%s': %s", cmd, error->message);
++ g_error_free (error);
++ }
++ return FALSE;
++ }
++
++ return TRUE;
++}
++
void
frogr_util_open_url_in_browser (const gchar *url)
{
@@@ -36,26 -36,14 +52,26 @@@
gchar *command = NULL;
GError *error = NULL;
-
+ #ifdef MAC_INTEGRATION
++ /* In MacOSX neither gnome-open nor gtk_show_uri() will work */
+ command = g_strdup_printf ("open %s", url);
++ frogr_util_spawn_command (command);
++#else
+#ifdef GTK_API_VERSION_3
- /* For GTK3 we already dare to do it The Right Way (tm) :-) */
++ /* For GTK3 we dare to do it The Right Way (tm). */
+ gtk_show_uri (NULL, url, GDK_CURRENT_TIME, &error);
#else
+ /* I found some weird behaviours using gtk_show_uri() in GTK2, so
- that's why we just use the gnome-open command instead. */
++ that's why we just use the gnome-open command instead. If
++ gnome-open fails, then we fallback to gtk_show_uri(). */
command = g_strdup_printf ("gnome-open %s", url);
- if (!g_spawn_command_line_async (command, &error)) {
- if (error != NULL)
- {
- DEBUG ("Error opening URL %s through gnome-open: %s", url, error->message);
- g_error_free (error);
- }
-
- /* If gnome-open fails, then we fallback to gtk_show_uri(). */
-#endif
++ if (!frogr_util_spawn_command (command))
+ gtk_show_uri (NULL, url, GDK_CURRENT_TIME, &error);
- }
- g_free (command);
- #endif
++#endif /* ifdef GTK_API_VERSION_3 */
++#endif /* ifdef MAC_INTEGRATION */
+
- g_spawn_command_line_async (command, &error);
- g_free (command);
++ if (command)
++ g_free (command);
if (error != NULL)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]