Merge GLib and GTK+ compatibility in gtk3-compat.h
This commit is contained in:
parent
c06fbee023
commit
52de747198
7 changed files with 73 additions and 126 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue