[rhythmbox] fix build with gtk+ 2.21.1 or newer
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] fix build with gtk+ 2.21.1 or newer
- Date: Tue, 22 Jun 2010 04:30:10 +0000 (UTC)
commit 4248dc39fdd9dc0f64d1018bd7f3e2feb46cbff6
Author: Marc-Antoine Perennou <Marc-Antoine Perennou com>
Date: Mon Jun 21 07:35:13 2010 +0200
fix build with gtk+ 2.21.1 or newer
Use accessors to access to struct members since gdk has been gsealed
in gtk+ 2.21.1
Remove by the way old gtk version checks no longer necessary since we
now depend on gtk+ 2.18.0
lib/gseal-gtk-compat.h | 31 +++++++++----------------------
lib/rb-tree-dnd.c | 10 ++++++----
sources/rb-sourcelist-model.c | 7 +++++--
3 files changed, 20 insertions(+), 28 deletions(-)
---
diff --git a/lib/gseal-gtk-compat.h b/lib/gseal-gtk-compat.h
index a839073..f9281a4 100644
--- a/lib/gseal-gtk-compat.h
+++ b/lib/gseal-gtk-compat.h
@@ -1,7 +1,8 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* Copyright © 2009 Thomas H.P. Andersen <phomes gmail com>,
- * 2009 Javier Jardón <jjardon gnome org>
+ * 2009 Javier Jardón <jjardon gnome org>,
+ * 2010 Marc-Antoine Perennou <Marc-Antoine Perennou com>
*
* This runtime is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -23,32 +24,18 @@
G_BEGIN_DECLS
+#if !GTK_CHECK_VERSION (2, 21, 1)
+#define gdk_drag_context_list_targets(context) context->targets
+#define gdk_drag_context_get_actions(context) context->actions
+#define gdk_drag_context_get_suggested_action(context) context->suggested_action
+#define gdk_drag_context_get_selected_action(context) context->action
+#endif
+
#if !GTK_CHECK_VERSION (2, 19, 5)
#define gtk_widget_get_realized(widget) GTK_WIDGET_REALIZED(widget)
#define gtk_widget_set_realized(widget, TRUE) GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED)
#endif
-#if !GTK_CHECK_VERSION (2, 18, 0)
-#define gtk_widget_has_focus(widget) (GTK_WIDGET_HAS_FOCUS (widget))
-#define gtk_widget_is_drawable(widget) (GTK_WIDGET_DRAWABLE (widget))
-#define gtk_widget_get_allocation(widget, alloc) (*(alloc)=(widget)->allocation)
-#define gtk_widget_get_app_paintable(widget) (GTK_WIDGET_APP_PAINTABLE (widget))
-#define gtk_widget_get_has_window(widget) (!GTK_WIDGET_NO_WINDOW (widget))
-#define gtk_widget_get_state(widget) ((widget)->state)
-#define gtk_widget_get_visible(widget) (GTK_WIDGET_VISIBLE (widget))
-#define gtk_widget_set_allocation(widget, alloc) ((widget)->allocation=*(alloc))
-#define gtk_widget_set_can_default(widget, TRUE) GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_DEFAULT)
-#define gtk_widget_set_can_focus(widget, TRUE) GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS)
-#define gtk_widget_set_double_buffered(widget, FALSE) GTK_WIDGET_UNSET_FLAGS (widget, GTK_DOUBLE_BUFFERED)
-#define gtk_widget_set_window(widget, _window) ((widget)->window=_window)
-#define gtk_widget_set_visible(widget, visible) ((visible?gtk_widget_show:gtk_widget_hide)(widget))
-
-#define gtk_cell_renderer_get_padding(cell, xpad, ypad) g_object_get (cell, "xpad", xpad, "ypad", ypad, NULL);
-#define gtk_cell_renderer_get_alignment(cell, xalign, yalign) g_object_get (cell, "xalign", xalign, "yalign", yalign, NULL);
-#define gtk_cell_renderer_set_padding(cell, xpad, ypad) g_object_set (cell, "xpad", xpad, "ypad", ypad, NULL);
-
-#endif /* GTK+ < 2.18.0 */
-
G_END_DECLS
#endif /* GSEAL_GTK_COMPAT_H */
diff --git a/lib/rb-tree-dnd.c b/lib/rb-tree-dnd.c
index bc14700..7af44fd 100644
--- a/lib/rb-tree-dnd.c
+++ b/lib/rb-tree-dnd.c
@@ -25,6 +25,8 @@
#include "rb-debug.h"
+#include "gseal-gtk-compat.h"
+
#define RB_TREE_DND_STRING "RbTreeDndString"
/* must be the same value as in gtk_tree_view.c */
#define SCROLL_EDGE_SIZE 15
@@ -448,7 +450,7 @@ filter_drop_position (GtkWidget *widget, GdkDragContext *context, GtkTreePath *p
ret = rb_tree_drag_dest_row_drop_position (RB_TREE_DRAG_DEST (model),
path,
- context->targets,
+ gdk_drag_context_list_targets (context),
pos);
rb_debug ("filtered drop position: %s", ret ? "TRUE" : "FALSE");
@@ -737,10 +739,10 @@ rb_tree_dnd_drag_motion_cb (GtkWidget *widget,
}
if (GTK_WIDGET (tree_view) == gtk_drag_get_source_widget (context) &&
- context->actions & GDK_ACTION_MOVE)
+ gdk_drag_context_get_actions (context) & GDK_ACTION_MOVE)
action = GDK_ACTION_MOVE;
else
- action = context->suggested_action;
+ action = gdk_drag_context_get_suggested_action (context);
if (path) {
gtk_tree_view_set_drag_dest_row (tree_view, path, pos);
@@ -863,7 +865,7 @@ rb_tree_dnd_drag_data_received_cb (GtkWidget *widget,
gtk_drag_finish (context,
accepted,
- (context->action == GDK_ACTION_MOVE),
+ (gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE),
time);
if (dest_row)
diff --git a/sources/rb-sourcelist-model.c b/sources/rb-sourcelist-model.c
index fca3fc3..bbc8eb3 100644
--- a/sources/rb-sourcelist-model.c
+++ b/sources/rb-sourcelist-model.c
@@ -41,6 +41,8 @@
#include "rb-marshal.h"
#include "rb-playlist-source.h"
+#include "gseal-gtk-compat.h"
+
/**
* SECTION:rb-sourcelist-model
* @short_description: models backing the source list widget
@@ -459,7 +461,8 @@ rb_sourcelist_model_get_drag_target (RbTreeDragDest *drag_dest,
GtkTreePath *path,
GtkTargetList *target_list)
{
- if (g_list_find (context->targets, gdk_atom_intern ("application/x-rhythmbox-source", TRUE))) {
+ if (g_list_find (gdk_drag_context_list_targets (context),
+ gdk_atom_intern ("application/x-rhythmbox-source", TRUE))) {
/* always accept rb source path if offered */
return gdk_atom_intern ("application/x-rhythmbox-source", TRUE);
}
@@ -469,7 +472,7 @@ rb_sourcelist_model_get_drag_target (RbTreeDragDest *drag_dest,
GdkAtom entry_atom;
entry_atom = gdk_atom_intern ("application/x-rhythmbox-entry", FALSE);
- if (g_list_find (context->targets, entry_atom))
+ if (g_list_find (gdk_drag_context_list_targets (context), entry_atom))
return entry_atom;
return gdk_atom_intern ("text/uri-list", FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]