[Xfce4-commits] <midori:master> Merge compat.h into sokoke and remove gtk_show_uri implementation

Christian Dywan noreply at xfce.org
Fri Jan 1 23:40:02 CET 2010


Updating branch refs/heads/master
         to 578f74a30820dcbc5c8eb2f2d6793b46ec0deaea (commit)
       from 2f202f8020b1de16d60081e89dd6813370585f42 (commit)

commit 578f74a30820dcbc5c8eb2f2d6793b46ec0deaea
Author: Christian Dywan <christian at twotoasts.de>
Date:   Fri Jan 1 23:24:03 2010 +0100

    Merge compat.h into sokoke and remove gtk_show_uri implementation

 midori/compat.c             |   67 -------------------------------------------
 midori/compat.h             |   56 ------------------------------------
 midori/main.c               |    1 -
 midori/midori-browser.c     |    1 -
 midori/midori-panel.c       |    1 -
 midori/midori-preferences.c |    1 -
 midori/midori-view.c        |    1 -
 midori/sokoke.c             |   44 +++++++++++++++++++++++++++-
 midori/sokoke.h             |   21 +++++++++++++
 panels/midori-transfers.c   |    1 -
 tests/magic-uri.c           |    1 -
 11 files changed, 64 insertions(+), 131 deletions(-)

diff --git a/midori/compat.c b/midori/compat.c
deleted file mode 100644
index 273935e..0000000
--- a/midori/compat.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- Copyright (C) 2008-2009 Christian Dywan <christian at twotoasts.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- See the file COPYING for the full license text.
-*/
-
-#include "compat.h"
-
-#include <string.h>
-
-#if !GTK_CHECK_VERSION (2, 14, 0)
-
-gboolean
-gtk_show_uri (GdkScreen*   screen,
-              const gchar* uri,
-              guint32      timestamp,
-              GError**     error)
-{
-    g_return_val_if_fail (uri != NULL, FALSE);
-
-    return g_app_info_launch_default_for_uri (uri, NULL, NULL);
-}
-
-#endif
-
-#if !GTK_CHECK_VERSION(2, 12, 0)
-
-void
-gtk_widget_set_has_tooltip (GtkWidget* widget,
-                            gboolean   has_tooltip)
-{
-    /* Do nothing */
-}
-
-void
-gtk_widget_set_tooltip_text (GtkWidget*   widget,
-                             const gchar* text)
-{
-    if (text && *text)
-    {
-        static GtkTooltips* tooltips = NULL;
-        if (G_UNLIKELY (!tooltips))
-            tooltips = gtk_tooltips_new ();
-        gtk_tooltips_set_tip (tooltips, widget, text, NULL);
-    }
-}
-
-void
-gtk_tool_item_set_tooltip_text (GtkToolItem* toolitem,
-                                const gchar* text)
-{
-    if (text && *text)
-    {
-        static GtkTooltips* tooltips = NULL;
-        if (G_UNLIKELY (!tooltips))
-            tooltips = gtk_tooltips_new ();
-
-        gtk_tool_item_set_tooltip (toolitem, tooltips, text, NULL);
-    }
-}
-
-#endif
diff --git a/midori/compat.h b/midori/compat.h
deleted file mode 100644
index b7df704..0000000
--- a/midori/compat.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- Copyright (C) 2008-2009 Christian Dywan <christian at twotoasts.de>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- See the file COPYING for the full license text.
-*/
-
-#ifndef __COMPAT_H__
-#define __COMPAT_H__
-
-#if HAVE_CONFIG_H
-    #include <config.h>
-#endif
-
-#include <webkit/webkit.h>
-
-G_BEGIN_DECLS
-
-#if !GLIB_CHECK_VERSION (2, 14, 0)
-    #define G_PARAM_STATIC_STRINGS \
-    (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
-#endif
-
-#if !GTK_CHECK_VERSION (2, 14, 0)
-
-gboolean
-gtk_show_uri                           (GdkScreen*         screen,
-                                        const gchar*       uri,
-                                        guint32            timestamp,
-                                        GError**           error);
-
-#endif
-
-#if !GTK_CHECK_VERSION(2, 12, 0)
-
-void
-gtk_widget_set_has_tooltip             (GtkWidget*         widget,
-                                        gboolean           has_tooltip);
-
-void
-gtk_widget_set_tooltip_text            (GtkWidget*         widget,
-                                        const gchar*       text);
-
-void
-gtk_tool_item_set_tooltip_text         (GtkToolItem*       toolitem,
-                                        const gchar*       text);
-
-#endif
-
-G_END_DECLS
-
-#endif /* __COMPAT_H__ */
diff --git a/midori/main.c b/midori/main.c
index 077bc6a..6efde20 100644
--- a/midori/main.c
+++ b/midori/main.c
@@ -25,7 +25,6 @@
 #include "midori-transfers.h"
 
 #include "sokoke.h"
-#include "compat.h"
 
 #if HAVE_UNISTD_H
     #include <unistd.h>
diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index 62667db..e65187b 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -26,7 +26,6 @@
 #include "midori-stock.h"
 
 #include "gtkiconentry.h"
-#include "compat.h"
 #include "marshal.h"
 #include "sokoke.h"
 
diff --git a/midori/midori-panel.c b/midori/midori-panel.c
index bb1af4e..5f2c972 100644
--- a/midori/midori-panel.c
+++ b/midori/midori-panel.c
@@ -13,7 +13,6 @@
 
 #include "midori-view.h"
 
-#include "compat.h"
 #include "marshal.h"
 #include "sokoke.h"
 
diff --git a/midori/midori-preferences.c b/midori/midori-preferences.c
index f80b31c..f822755 100644
--- a/midori/midori-preferences.c
+++ b/midori/midori-preferences.c
@@ -16,7 +16,6 @@
 #endif
 
 #include "sokoke.h"
-#include "compat.h"
 
 #include <string.h>
 #include <glib/gi18n.h>
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 5a2e43d..d86a539 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -18,7 +18,6 @@
 #include "midori-stock.h"
 #include "midori-browser.h"
 
-#include "compat.h"
 #include "marshal.h"
 #include "sokoke.h"
 
diff --git a/midori/sokoke.c b/midori/sokoke.c
index 15e5504..bd74132 100644
--- a/midori/sokoke.c
+++ b/midori/sokoke.c
@@ -17,7 +17,6 @@
     #include <config.h>
 #endif
 
-#include "compat.h"
 #include "midori-stock.h"
 
 #if HAVE_UNISTD_H
@@ -52,6 +51,44 @@
     #include <hildon-uri.h>
 #endif
 
+#if !GTK_CHECK_VERSION(2, 12, 0)
+
+void
+gtk_widget_set_has_tooltip (GtkWidget* widget,
+                            gboolean   has_tooltip)
+{
+    /* Do nothing */
+}
+
+void
+gtk_widget_set_tooltip_text (GtkWidget*   widget,
+                             const gchar* text)
+{
+    if (text && *text)
+    {
+        static GtkTooltips* tooltips = NULL;
+        if (G_UNLIKELY (!tooltips))
+            tooltips = gtk_tooltips_new ();
+        gtk_tooltips_set_tip (tooltips, widget, text, NULL);
+    }
+}
+
+void
+gtk_tool_item_set_tooltip_text (GtkToolItem* toolitem,
+                                const gchar* text)
+{
+    if (text && *text)
+    {
+        static GtkTooltips* tooltips = NULL;
+        if (G_UNLIKELY (!tooltips))
+            tooltips = gtk_tooltips_new ();
+
+        gtk_tool_item_set_tooltip (toolitem, tooltips, text, NULL);
+    }
+}
+
+#endif
+
 static gchar*
 sokoke_js_string_utf8 (JSStringRef js_string)
 {
@@ -248,8 +285,13 @@ sokoke_show_uri (GdkScreen*   screen,
     g_return_val_if_fail (uri != NULL, FALSE);
     g_return_val_if_fail (!error || !*error, FALSE);
 
+    #if GTK_CHECK_VERSION (2, 14, 0)
     if (gtk_show_uri (screen, uri, timestamp, error))
         return TRUE;
+    #else
+    if (g_app_info_launch_default_for_uri (uri, NULL, NULL))
+        return TRUE;
+    #endif
 
     for (i = 0; i < G_N_ELEMENTS (fallbacks); i++)
     {
diff --git a/midori/sokoke.h b/midori/sokoke.h
index 85c11ff..621ca99 100644
--- a/midori/sokoke.h
+++ b/midori/sokoke.h
@@ -18,6 +18,27 @@
 #include <webkit/webkit.h>
 #include <JavaScriptCore/JavaScript.h>
 
+#if !GLIB_CHECK_VERSION (2, 14, 0)
+    #define G_PARAM_STATIC_STRINGS \
+    (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
+#endif
+
+#if !GTK_CHECK_VERSION(2, 12, 0)
+
+void
+gtk_widget_set_has_tooltip             (GtkWidget*         widget,
+                                        gboolean           has_tooltip);
+
+void
+gtk_widget_set_tooltip_text            (GtkWidget*         widget,
+                                        const gchar*       text);
+
+void
+gtk_tool_item_set_tooltip_text         (GtkToolItem*       toolitem,
+                                        const gchar*       text);
+
+#endif
+
 gchar*
 sokoke_js_script_eval                   (JSContextRef    js_context,
                                          const gchar*    script,
diff --git a/panels/midori-transfers.c b/panels/midori-transfers.c
index 4678337..55d74c4 100644
--- a/panels/midori-transfers.c
+++ b/panels/midori-transfers.c
@@ -17,7 +17,6 @@
 #include "midori-view.h"
 
 #include "sokoke.h"
-#include "compat.h"
 #include <glib/gi18n.h>
 
 struct _MidoriTransfers
diff --git a/tests/magic-uri.c b/tests/magic-uri.c
index 35c6fdb..7c47d4c 100644
--- a/tests/magic-uri.c
+++ b/tests/magic-uri.c
@@ -14,7 +14,6 @@
     #include <config.h>
 #endif
 
-#include "compat.h"
 #include "sokoke.h"
 
 #define SM "http://www.searchmash.com/search/"



More information about the Xfce4-commits mailing list