Updating branch refs/heads/master to 52de747198ab38ed8ce7774ea648c9b78fe37e6c (commit) from c06fbee023798cfed102be951d2d907b4cc11b6f (commit)
commit 52de747198ab38ed8ce7774ea648c9b78fe37e6c Author: Christian Dywan <christ...@twotoasts.de> Date: Thu Oct 20 22:46:43 2011 +0200 Merge GLib and GTK+ compatibility in gtk3-compat.h katze/gtk3-compat.h | 72 +++++++++++++++++++++++++++++++++++++++++++++ katze/katze-preferences.c | 4 -- katze/katze-scrolled.c | 20 ------------ katze/katze-throbber.c | 7 ---- katze/katze-utils.c | 8 ----- midori/sokoke.c | 39 ------------------------ midori/sokoke.h | 49 +------------------------------ 7 files changed, 73 insertions(+), 126 deletions(-) diff --git a/katze/gtk3-compat.h b/katze/gtk3-compat.h index ac774eb..c40aca2 100644 --- a/katze/gtk3-compat.h +++ b/katze/gtk3-compat.h @@ -4,6 +4,76 @@ #ifndef H_GTK3_COMPAT_20110110 #define H_GTK3_COMPAT_20110110 +G_BEGIN_DECLS + +#if !GLIB_CHECK_VERSION (2, 32, 0) + #define G_SOURCE_REMOVE FALSE + #define G_SOURCE_CONTINUE TRUE +#endif + +#if !GLIB_CHECK_VERSION (2, 30, 0) + #define g_format_size(sz) g_format_size_for_display ((goffset)sz) +#endif + +#if !GTK_CHECK_VERSION (2, 14, 0) + #define gtk_dialog_get_content_area(dlg) dlg->vbox + #define gtk_dialog_get_action_area(dlg) dlg->action_area + #define gtk_widget_get_window(wdgt) wdgt->window + #define gtk_adjustment_get_page_size(adj) adj->page_size + #define gtk_adjustment_get_upper(adj) adj->upper + #define gtk_adjustment_get_lower(adj) adj->lower + #define gtk_adjustment_get_value(adj) adj->value +#endif + +#if !GTK_CHECK_VERSION (2, 16, 0) + #define GTK_ACTIVATABLE GTK_WIDGET + #define gtk_activatable_get_related_action gtk_widget_get_action + #define gtk_menu_item_set_label(menuitem, label) \ + gtk_label_set_label (GTK_LABEL (GTK_BIN (menuitem)->child), \ + label ? label : ""); +#endif + +#if !GTK_CHECK_VERSION (2, 18, 0) + #define gtk_widget_is_toplevel(widget) GTK_WIDGET_TOPLEVEL (widget) + #define gtk_widget_has_focus(widget) GTK_WIDGET_HAS_FOCUS (widget) + #define gtk_widget_get_visible(widget) GTK_WIDGET_VISIBLE (widget) + #define gtk_widget_get_sensitive(widget) GTK_WIDGET_IS_SENSITIVE (widget) + #define gtk_widget_set_can_focus(widget,flag) \ + GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS) + #define gtk_widget_get_allocation(wdgt, alloc) *alloc = wdgt->allocation + #define gtk_widget_get_has_window(wdgt) !GTK_WIDGET_NO_WINDOW (wdgt) + #define gtk_widget_get_allocation(wdgt, alloc) *alloc = wdgt->allocation + #define gtk_widget_set_window(wdgt, wndw) wdgt->window = wndw + #define gtk_widget_is_drawable GTK_WIDGET_DRAWABLE + #define gtk_widget_get_drawable GTK_WIDGET_VISIBLE + #define gtk_widget_set_has_window(wdgt, wnd) \ + if (wnd) GTK_WIDGET_UNSET_FLAGS (wdgt, GTK_NO_WINDOW); \ + else GTK_WIDGET_SET_FLAGS (wdgt, GTK_NO_WINDOW) +#endif + +#if !GTK_CHECK_VERSION (2, 20, 0) + #define gtk_widget_get_realized(widget) GTK_WIDGET_REALIZED (widget) + #define gtk_widget_set_realized(wdgt, real) \ + if (real) GTK_WIDGET_SET_FLAGS (wdgt, GTK_REALIZED); \ + else GTK_WIDGET_UNSET_FLAGS (wdgt, GTK_REALIZED) +#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 + #if !GTK_CHECK_VERSION (2, 24 ,0) #define gtk_combo_box_text_append_text gtk_combo_box_append_text #define gtk_combo_box_text_new gtk_combo_box_new_text @@ -43,4 +113,6 @@ #define GDK_KEY_Return GDK_Return #endif +G_END_DECLS + #endif diff --git a/katze/katze-preferences.c b/katze/katze-preferences.c index c700c27..6c05f63 100644 --- a/katze/katze-preferences.c +++ b/katze/katze-preferences.c @@ -23,10 +23,6 @@ #include <string.h> #include <glib/gi18n.h> -#if !GTK_CHECK_VERSION (2, 14, 0) - #define gtk_dialog_get_content_area(dialog) dialog->vbox -#endif - struct _KatzePreferencesPrivate { #if HAVE_HILDON diff --git a/katze/katze-scrolled.c b/katze/katze-scrolled.c index d9ed5ad..4fe090b 100644 --- a/katze/katze-scrolled.c +++ b/katze/katze-scrolled.c @@ -18,26 +18,6 @@ #include "katze-scrolled.h" #include "katze-utils.h" -#if !GTK_CHECK_VERSION (2, 14, 0) - #define gtk_adjustment_get_page_size(adj) adj->page_size - #define gtk_adjustment_get_upper(adj) adj->upper - #define gtk_adjustment_get_lower(adj) adj->lower - #define gtk_adjustment_get_value(adj) adj->value - #define gtk_widget_get_window(wdgt) wdgt->window -#endif -#if !GTK_CHECK_VERSION (2, 18, 0) - #define gtk_widget_set_window(wdgt, wndw) wdgt->window = wndw - #define gtk_widget_get_allocation(wdgt, alloc) *alloc = wdgt->allocation - #define gtk_widget_is_drawable GTK_WIDGET_DRAWABLE - #define gtk_widget_get_drawable GTK_WIDGET_VISIBLE - #define gtk_widget_get_visible(wdgt) GTK_WIDGET_VISIBLE (wdgt) -#endif -#if !GTK_CHECK_VERSION (2, 19, 6) - #define gtk_widget_set_realized(wdgt, real) \ - if (real) GTK_WIDGET_SET_FLAGS (wdgt, GTK_REALIZED); \ - else GTK_WIDGET_UNSET_FLAGS (wdgt, GTK_REALIZED) -#endif - #define DEFAULT_INTERVAL 50 #define DEFAULT_DECELERATION 0.7 #define DEFAULT_DRAGGING_STOPPED_DELAY 100 diff --git a/katze/katze-throbber.c b/katze/katze-throbber.c index ff40323..0ffc74a 100644 --- a/katze/katze-throbber.c +++ b/katze/katze-throbber.c @@ -18,13 +18,6 @@ #define HAVE_SPINNER GTK_CHECK_VERSION (2, 20, 0) -#if !GTK_CHECK_VERSION (2, 18, 0) - #define gtk_widget_get_allocation(wdgt, alloc) *alloc = wdgt->allocation - #define gtk_widget_set_has_window(wdgt, wnd) \ - if (wnd) GTK_WIDGET_UNSET_FLAGS (wdgt, GTK_NO_WINDOW); \ - else GTK_WIDGET_SET_FLAGS (wdgt, GTK_NO_WINDOW) -#endif - struct _KatzeThrobber { #if HAVE_SPINNER diff --git a/katze/katze-utils.c b/katze/katze-utils.c index 9869908..27366f2 100644 --- a/katze/katze-utils.c +++ b/katze/katze-utils.c @@ -32,14 +32,6 @@ #include <hildon/hildon.h> #endif -#if !GTK_CHECK_VERSION (2, 14, 0) - #define gtk_widget_get_window(wdgt) wdgt->window -#endif -#if !GTK_CHECK_VERSION (2, 18, 0) - #define gtk_widget_get_has_window(wdgt) !GTK_WIDGET_NO_WINDOW (wdgt) - #define gtk_widget_get_allocation(wdgt, alloc) *alloc = wdgt->allocation -#endif - #define I_ g_intern_static_string static void diff --git a/midori/sokoke.c b/midori/sokoke.c index 14027c1..5aae9ca 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -12,7 +12,6 @@ */ #include "sokoke.h" -#include "gtk3-compat.h" #if HAVE_CONFIG_H #include <config.h> @@ -46,44 +45,6 @@ #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) { diff --git a/midori/sokoke.h b/midori/sokoke.h index 3e132df..a7ddf8a 100644 --- a/midori/sokoke.h +++ b/midori/sokoke.h @@ -15,54 +15,7 @@ #include <JavaScriptCore/JavaScript.h> #include <midori/midori-websettings.h> - -#if !GLIB_CHECK_VERSION (2, 30, 0) - #define g_format_size(sz) g_format_size_for_display ((goffset)sz) -#endif - -#if !GTK_CHECK_VERSION (2, 14, 0) - #define gtk_dialog_get_content_area(dlg) dlg->vbox - #define gtk_dialog_get_action_area(dlg) dlg->action_area - #define gtk_widget_get_window(wdgt) wdgt->window -#endif - -#if !GTK_CHECK_VERSION (2, 16, 0) - #define GTK_ACTIVATABLE GTK_WIDGET - #define gtk_activatable_get_related_action gtk_widget_get_action - #define gtk_menu_item_set_label(menuitem, label) \ - gtk_label_set_label (GTK_LABEL (GTK_BIN (menuitem)->child), \ - label ? label : ""); -#endif - -#if !GTK_CHECK_VERSION (2, 18, 0) - #define gtk_widget_is_toplevel(widget) GTK_WIDGET_TOPLEVEL (widget) - #define gtk_widget_has_focus(widget) GTK_WIDGET_HAS_FOCUS (widget) - #define gtk_widget_get_visible(widget) GTK_WIDGET_VISIBLE (widget) - #define gtk_widget_get_sensitive(widget) GTK_WIDGET_IS_SENSITIVE (widget) - #define gtk_widget_set_can_focus(widget,flag) \ - GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS) - #define gtk_widget_get_allocation(wdgt, alloc) *alloc = wdgt->allocation -#endif - -#if !GTK_CHECK_VERSION (2, 20, 0) - #define gtk_widget_get_realized(widget) GTK_WIDGET_REALIZED (widget) -#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 +#include <katze/gtk3-compat.h> gchar* sokoke_js_script_eval (JSContextRef js_context, _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits