[rhythmbox] Use GTK+ accessor functions instead of direct access (bug #595425)
- From: Jonathan Matthew <jmatthew src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rhythmbox] Use GTK+ accessor functions instead of direct access (bug #595425)
- Date: Sat, 2 Jan 2010 00:34:49 +0000 (UTC)
commit 159fa13dee27c323a8872c0aec5cfa65b0176aae
Author: Javier Jardón <jjardon gnome org>
Date: Sat Jan 2 10:27:36 2010 +1000
Use GTK+ accessor functions instead of direct access (bug #595425)
There are still a few things missing, but now we mostly build with GSEAL
enabled. gseal-gtk-compat.h provides compatibility #defines for earlier
versions of GTK+.
lib/Makefile.am | 1 +
lib/gseal-gtk-compat.h | 49 ++++++++++++++++
lib/rb-tree-dnd.c | 10 ++-
plugins/audioscrobbler/rb-audioscrobbler-plugin.c | 3 +-
plugins/audioscrobbler/rb-lastfm-source.c | 8 ++-
plugins/cd-recorder/rb-playlist-source-recorder.c | 3 +-
plugins/daap/rb-daap-dialog.c | 2 +-
plugins/daap/rb-daap-plugin.c | 3 +-
plugins/iradio/rb-iradio-source.c | 2 +-
plugins/iradio/rb-station-properties-dialog.c | 7 ++-
plugins/status-icon/rb-status-icon-plugin.c | 2 +-
plugins/visualizer/rb-vis-widget.c | 65 +++++++++++++-------
plugins/visualizer/rb-visualizer-plugin.c | 10 ++-
podcast/rb-feed-podcast-properties-dialog.c | 6 +-
podcast/rb-podcast-properties-dialog.c | 7 ++-
rhythmdb/rhythmdb-property-model.c | 8 ++-
rhythmdb/rhythmdb-query-model.c | 13 +++--
shell/rb-missing-plugins.c | 2 +-
shell/rb-playlist-manager.c | 26 ++++++---
shell/rb-plugin-manager.c | 7 ++-
shell/rb-plugins-engine.c | 2 +-
shell/rb-shell-preferences.c | 7 ++-
shell/rb-shell.c | 11 ++-
sources/rb-auto-playlist-source.c | 11 ++-
sources/rb-library-source.c | 4 +-
sources/rb-podcast-source.c | 4 +-
sources/rb-removable-media-source.c | 6 +-
sources/rb-sourcelist-model.c | 22 ++++---
sources/rb-sourcelist.c | 3 +-
sources/rb-static-playlist-source.c | 11 ++-
widgets/gedit-message-area.c | 22 +++++---
widgets/gossip-cell-renderer-expander.c | 39 ++++++++----
widgets/rb-cell-renderer-pixbuf.c | 33 +++++++----
widgets/rb-cell-renderer-rating.c | 19 ++++--
widgets/rb-entry-view.c | 2 +-
widgets/rb-header.c | 2 +-
widgets/rb-library-browser.c | 3 +-
widgets/rb-query-creator.c | 7 ++-
widgets/rb-rating-helper.c | 14 +++--
widgets/rb-rating.c | 44 +++++++++-----
widgets/rb-song-info.c | 8 ++-
widgets/rb-uri-dialog.c | 7 ++-
42 files changed, 351 insertions(+), 164 deletions(-)
---
diff --git a/lib/Makefile.am b/lib/Makefile.am
index cee07d4..3c75f72 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -21,6 +21,7 @@ librb_la_SOURCES = \
eggsmclient.h \
eggsmclient-private.h \
eggsmclient-xsmp.c \
+ gseal-gtk-compat.h \
rb-file-helpers.c \
rb-file-helpers.h \
rb-builder-helpers.c \
diff --git a/lib/gseal-gtk-compat.h b/lib/gseal-gtk-compat.h
new file mode 100644
index 0000000..86113c4
--- /dev/null
+++ b/lib/gseal-gtk-compat.h
@@ -0,0 +1,49 @@
+/* -*- 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>
+ *
+ * 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
+ * the Free Software Foundation; either version 2.1, or (at your option)
+ * any later version.
+ *
+ * This runtime is distributed in the hope runtime it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this runtime; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GSEAL_GTK_COMPAT_H
+#define GSEAL_GTK_COMPAT_H
+
+G_BEGIN_DECLS
+
+
+#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_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 e093607..bc14700 100644
--- a/lib/rb-tree-dnd.c
+++ b/lib/rb-tree-dnd.c
@@ -465,6 +465,7 @@ scroll_row_timeout (gpointer data)
gint y, x;
gint offset;
gfloat value;
+ gdouble vadj_value;
GtkAdjustment* vadj;
RbTreeDndData *priv_data;
@@ -500,11 +501,14 @@ scroll_row_timeout (gpointer data)
}
vadj = gtk_tree_view_get_vadjustment (tree_view);
- value = CLAMP (vadj->value + offset, vadj->lower, vadj->upper - vadj->page_size);
+ vadj_value = gtk_adjustment_get_value (vadj);
+ value = CLAMP (vadj_value + offset,
+ gtk_adjustment_get_lower (vadj),
+ gtk_adjustment_get_upper (vadj) - gtk_adjustment_get_page_size (vadj));
gtk_adjustment_set_value (vadj, value);
/* don't remove it if we're on the edge and not scrolling */
- if (ABS (vadj->value - value) > 0.0001)
+ if (ABS (vadj_value - value) > 0.0001)
remove_select_on_drag_timeout(tree_view);
GDK_THREADS_LEAVE ();
@@ -848,7 +852,7 @@ rb_tree_dnd_drag_data_received_cb (GtkWidget *widget,
if (!filter_drop_position (widget, context, dest_row, &pos))
filtered = FALSE;
- if (filtered && selection_data->length >= 0)
+ if (filtered && (gtk_selection_data_get_length (selection_data) >= 0))
{
if (rb_tree_drag_dest_drag_data_received (RB_TREE_DRAG_DEST (model),
dest_row,
diff --git a/plugins/audioscrobbler/rb-audioscrobbler-plugin.c b/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
index 7f87add..2e1e2f8 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
+++ b/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
@@ -223,7 +223,8 @@ impl_create_configure_dialog (RBPlugin *bplugin)
plugin);
gtk_widget_hide_on_delete (plugin->preferences);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (plugin->preferences)->vbox), widget);
+ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (plugin->preferences))),
+ widget);
}
gtk_widget_show_all (plugin->preferences);
diff --git a/plugins/audioscrobbler/rb-lastfm-source.c b/plugins/audioscrobbler/rb-lastfm-source.c
index 2d2bf85..463a4c3 100644
--- a/plugins/audioscrobbler/rb-lastfm-source.c
+++ b/plugins/audioscrobbler/rb-lastfm-source.c
@@ -77,6 +77,8 @@
#include "rb-play-order.h"
#include "rb-lastfm-play-order.h"
+#include "gseal-gtk-compat.h"
+
#define LASTFM_URL "ws.audioscrobbler.com"
#define RB_LASTFM_PLATFORM "linux"
#define RB_LASTFM_VERSION "1.5"
@@ -765,7 +767,7 @@ set_message_area_text_and_icon (RBLastfmSource *source,
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5);
- GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (primary_label, TRUE);
gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
if (secondary_text != NULL) {
@@ -775,7 +777,7 @@ set_message_area_text_and_icon (RBLastfmSource *source,
g_free (secondary_markup);
gtk_widget_show (secondary_label);
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (secondary_label, TRUE);
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
@@ -1187,7 +1189,7 @@ impl_receive_drag (RBSource *asource, GtkSelectionData *selection_data)
char *title = NULL;
RBLastfmSource *source = RB_LASTFM_SOURCE (asource);
- uri = (char *)selection_data->data;
+ uri = (char *) gtk_selection_data_get_data (selection_data);
rb_debug ("parsing uri %s", uri);
if (strstr (uri, "lastfm://") == NULL)
diff --git a/plugins/cd-recorder/rb-playlist-source-recorder.c b/plugins/cd-recorder/rb-playlist-source-recorder.c
index e1add17..b0f09de 100644
--- a/plugins/cd-recorder/rb-playlist-source-recorder.c
+++ b/plugins/cd-recorder/rb-playlist-source-recorder.c
@@ -43,6 +43,7 @@
#include <nautilus-burn.h>
+#include "gseal-gtk-compat.h"
#include "rb-file-helpers.h"
#include "rb-builder-helpers.h"
#include "rb-preferences.h"
@@ -1120,7 +1121,7 @@ rb_playlist_source_recorder_constructed (GObject *object)
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
source->priv->burn_button = gtk_button_new ();
- GTK_WIDGET_SET_FLAGS (source->priv->burn_button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default (source->priv->burn_button, TRUE);
widget = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_container_add (GTK_CONTAINER (source->priv->burn_button), widget);
diff --git a/plugins/daap/rb-daap-dialog.c b/plugins/daap/rb-daap-dialog.c
index f709fec..389d059 100644
--- a/plugins/daap/rb-daap-dialog.c
+++ b/plugins/daap/rb-daap-dialog.c
@@ -63,7 +63,7 @@ rb_daap_collision_dialog_new_run (GtkWindow *parent,
hbox = gtk_hbox_new (FALSE, 6);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, TRUE, TRUE, 0);
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
diff --git a/plugins/daap/rb-daap-plugin.c b/plugins/daap/rb-daap-plugin.c
index 4c3b335..f14f809 100644
--- a/plugins/daap/rb-daap-plugin.c
+++ b/plugins/daap/rb-daap-plugin.c
@@ -887,7 +887,8 @@ impl_create_configure_dialog (RBPlugin *bplugin)
plugin);
gtk_widget_hide_on_delete (plugin->priv->preferences);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (plugin->priv->preferences)->vbox), widget);
+ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (plugin->priv->preferences))),
+ widget);
} else {
update_config_widget (plugin);
}
diff --git a/plugins/iradio/rb-iradio-source.c b/plugins/iradio/rb-iradio-source.c
index 168f52c..1817b17 100644
--- a/plugins/iradio/rb-iradio-source.c
+++ b/plugins/iradio/rb-iradio-source.c
@@ -939,7 +939,7 @@ stations_view_drag_data_received_cb (GtkWidget *widget,
GList *uri_list, *i;
rb_debug ("parsing uri list");
- uri_list = rb_uri_list_parse ((char *)selection_data->data);
+ uri_list = rb_uri_list_parse ((char *) gtk_selection_data_get_data (selection_data));
if (uri_list == NULL)
return;
diff --git a/plugins/iradio/rb-station-properties-dialog.c b/plugins/iradio/rb-station-properties-dialog.c
index 1631e97..a79916a 100644
--- a/plugins/iradio/rb-station-properties-dialog.c
+++ b/plugins/iradio/rb-station-properties-dialog.c
@@ -154,6 +154,7 @@ static void
rb_station_properties_dialog_constructed (GObject *object)
{
RBStationPropertiesDialog *dialog;
+ GtkWidget *content_area;
GtkBuilder *builder;
char *builder_file;
AtkObject *lobj, *robj;
@@ -166,16 +167,18 @@ rb_station_properties_dialog_constructed (GObject *object)
G_CALLBACK (rb_station_properties_dialog_response_cb),
dialog, 0);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
+ gtk_box_set_spacing (GTK_BOX (content_area), 2);
builder_file = rb_plugin_find_file (dialog->priv->plugin, "station-properties.ui");
g_assert (builder_file != NULL);
builder = rb_builder_load (builder_file, dialog);
g_free (builder_file);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
+ gtk_container_add (GTK_CONTAINER (content_area),
GTK_WIDGET (gtk_builder_get_object (builder, "stationproperties")));
dialog->priv->close_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
diff --git a/plugins/status-icon/rb-status-icon-plugin.c b/plugins/status-icon/rb-status-icon-plugin.c
index dd26061..cc7b8aa 100644
--- a/plugins/status-icon/rb-status-icon-plugin.c
+++ b/plugins/status-icon/rb-status-icon-plugin.c
@@ -932,7 +932,7 @@ close_to_tray (RBStatusIconPlugin *plugin)
rb_tray_icon_get_geom (plugin->priv->tray_icon,
&x, &y, &width, &height);
if (GTK_WIDGET_REALIZED (window))
- set_icon_geometry (GTK_WIDGET (window)->window,
+ set_icon_geometry (gtk_widget_get_window (GTK_WIDGET (window)),
x, y, width, height);
/* ask the tasklist not to show our window */
diff --git a/plugins/visualizer/rb-vis-widget.c b/plugins/visualizer/rb-vis-widget.c
index fbb9587..746a19e 100644
--- a/plugins/visualizer/rb-vis-widget.c
+++ b/plugins/visualizer/rb-vis-widget.c
@@ -40,6 +40,8 @@
#include "rb-vis-widget.h"
#include "rb-debug.h"
+#include "gseal-gtk-compat.h"
+
enum
{
PROP_0,
@@ -54,23 +56,27 @@ G_DEFINE_TYPE(RBVisWidget, rb_vis_widget, GTK_TYPE_WIDGET)
static void
rb_vis_widget_init (RBVisWidget *rbvw)
{
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET (rbvw), GTK_CAN_FOCUS);
- GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (rbvw), GTK_DOUBLE_BUFFERED);
+ gtk_widget_set_can_focus (GTK_WIDGET (rbvw), TRUE);
+ gtk_widget_set_double_buffered (GTK_WIDGET (rbvw), FALSE);
}
static void
rb_vis_widget_realize (GtkWidget *widget)
{
- GdkWindowAttr attributes;
- gint attributes_mask;
+ GtkAllocation allocation;
+ GtkStyle *style;
+ GdkWindowAttr attributes;
+ GdkWindow *window;
+ gint attributes_mask;
rb_debug ("realizing container window");
+ gtk_widget_get_allocation (widget, &allocation);
attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
+ attributes.x = allocation.x;
+ attributes.y = allocation.y;
+ attributes.width = allocation.width;
+ attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
@@ -78,13 +84,15 @@ rb_vis_widget_realize (GtkWidget *widget)
attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
- gdk_window_show (widget->window);
+ window = gdk_window_new (gtk_widget_get_parent_window (widget),
+ &attributes, attributes_mask);
+ gtk_widget_set_window (widget, window);
+ gdk_window_set_user_data (window, widget);
+ gdk_window_show (window);
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+ style = gtk_style_attach (gtk_widget_get_style (widget), window);
+ gtk_widget_set_style (widget, style);
+ gtk_style_set_background (style, window, GTK_STATE_NORMAL);
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
}
@@ -94,7 +102,7 @@ rb_vis_widget_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
RBVisWidget *rbvw = RB_VIS_WIDGET (widget);
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
if (!GTK_WIDGET_REALIZED (widget))
return;
@@ -102,7 +110,7 @@ rb_vis_widget_size_allocate (GtkWidget *widget,
rb_debug ("handling size allocate event ([%d,%d] - [%d,%d])",
allocation->x, allocation->y,
allocation->width, allocation->height);
- gdk_window_move_resize (widget->window,
+ gdk_window_move_resize (gtk_widget_get_window (widget),
allocation->x, allocation->y,
allocation->width, allocation->height);
@@ -120,12 +128,15 @@ static gboolean
rb_vis_widget_expose_event (GtkWidget *widget,
GdkEventExpose *event)
{
+ GdkWindow *window;
RBVisWidget *rbvw = RB_VIS_WIDGET (widget);
- if (rbvw->window_xid != GDK_WINDOW_XWINDOW (widget->window)) {
- rbvw->window_xid = GDK_WINDOW_XWINDOW (widget->window);
+ window = gtk_widget_get_window (widget);
+
+ if (rbvw->window_xid != GDK_WINDOW_XWINDOW (window)) {
+ rbvw->window_xid = GDK_WINDOW_XWINDOW (window);
- gdk_display_sync (gdk_drawable_get_display (GDK_DRAWABLE (widget->window)));
+ gdk_display_sync (gdk_drawable_get_display (GDK_DRAWABLE (window)));
rb_debug ("got new window ID %lu", rbvw->window_xid);
g_object_notify (G_OBJECT (rbvw), "window-xid");
@@ -137,9 +148,13 @@ rb_vis_widget_expose_event (GtkWidget *widget,
static void
rb_vis_widget_hide (GtkWidget *widget)
{
- if (widget->window != NULL) {
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (widget);
+
+ if (window != NULL) {
rb_debug ("hiding output window");
- gdk_window_hide (widget->window);
+ gdk_window_hide (window);
}
GTK_WIDGET_CLASS (rb_vis_widget_parent_class)->hide (widget);
@@ -148,9 +163,13 @@ rb_vis_widget_hide (GtkWidget *widget)
static void
rb_vis_widget_show (GtkWidget *widget)
{
- if (widget->window != NULL) {
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (widget);
+
+ if (window != NULL) {
rb_debug ("showing output window");
- gdk_window_show (widget->window);
+ gdk_window_show (window);
} else {
rb_debug ("got show event before realized..");
}
diff --git a/plugins/visualizer/rb-visualizer-plugin.c b/plugins/visualizer/rb-visualizer-plugin.c
index e48c996..c9b3847 100644
--- a/plugins/visualizer/rb-visualizer-plugin.c
+++ b/plugins/visualizer/rb-visualizer-plugin.c
@@ -825,10 +825,13 @@ actually_hide_controls (RBVisualizerPlugin *plugin)
gtk_widget_grab_focus (plugin->vis_widget);
if (GTK_WIDGET_REALIZED (plugin->vis_widget)) {
+ GdkWindow *window;
GdkCursor *cursor;
- cursor = get_blank_cursor (plugin->vis_widget->window);
- gdk_window_set_cursor (plugin->vis_widget->window, cursor);
+ window = gtk_widget_get_window (plugin->vis_widget);
+
+ cursor = get_blank_cursor (window);
+ gdk_window_set_cursor (window, cursor);
gdk_cursor_unref (cursor);
}
/* fall through */
@@ -884,7 +887,8 @@ show_controls (RBVisualizerPlugin *plugin, gboolean play_controls_only)
gtk_widget_show (plugin->play_control_widget);
gtk_widget_show (plugin->disable_button);
if (GTK_WIDGET_REALIZED (plugin->vis_widget)) {
- gdk_window_set_cursor (plugin->vis_widget->window, NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (plugin->vis_widget),
+ NULL);
}
break;
case EXTERNAL_WINDOW:
diff --git a/podcast/rb-feed-podcast-properties-dialog.c b/podcast/rb-feed-podcast-properties-dialog.c
index 1a563ab..9ec420b 100644
--- a/podcast/rb-feed-podcast-properties-dialog.c
+++ b/podcast/rb-feed-podcast-properties-dialog.c
@@ -101,6 +101,7 @@ rb_feed_podcast_properties_dialog_class_init (RBFeedPodcastPropertiesDialogClass
static void
rb_feed_podcast_properties_dialog_init (RBFeedPodcastPropertiesDialog *dialog)
{
+ GtkWidget *content_area;
GtkBuilder *builder;
dialog->priv = RB_FEED_PODCAST_PROPERTIES_DIALOG_GET_PRIVATE (dialog);
@@ -111,14 +112,15 @@ rb_feed_podcast_properties_dialog_init (RBFeedPodcastPropertiesDialog *dialog)
dialog, 0);
gtk_window_set_default_size (GTK_WINDOW (dialog), 600, 400);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
+ gtk_box_set_spacing (GTK_BOX (content_area), 2);
builder = rb_builder_load ("podcast-feed-properties.ui", dialog);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
+ gtk_container_add (GTK_CONTAINER (content_area),
GTK_WIDGET (gtk_builder_get_object (builder, "podcastproperties")));
dialog->priv->close_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
diff --git a/podcast/rb-podcast-properties-dialog.c b/podcast/rb-podcast-properties-dialog.c
index db97317..52a5791 100644
--- a/podcast/rb-podcast-properties-dialog.c
+++ b/podcast/rb-podcast-properties-dialog.c
@@ -133,6 +133,7 @@ rb_podcast_properties_dialog_class_init (RBPodcastPropertiesDialogClass *klass)
static void
rb_podcast_properties_dialog_init (RBPodcastPropertiesDialog *dialog)
{
+ GtkWidget *content_area;
GtkBuilder *builder;
AtkObject *lobj, *robj;
@@ -145,16 +146,18 @@ rb_podcast_properties_dialog_init (RBPodcastPropertiesDialog *dialog)
G_CALLBACK (rb_podcast_properties_dialog_response_cb),
dialog, 0);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
+ gtk_box_set_spacing (GTK_BOX (content_area), 2);
gtk_dialog_set_default_response (GTK_DIALOG (dialog),
GTK_RESPONSE_OK);
builder = rb_builder_load ("podcast-properties.ui", dialog);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
+ gtk_container_add (GTK_CONTAINER (content_area),
GTK_WIDGET (gtk_builder_get_object (builder, "podcastproperties")));
dialog->priv->close_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
GTK_STOCK_CLOSE,
diff --git a/rhythmdb/rhythmdb-property-model.c b/rhythmdb/rhythmdb-property-model.c
index dfdd4ff..8c9e0c7 100644
--- a/rhythmdb/rhythmdb-property-model.c
+++ b/rhythmdb/rhythmdb-property-model.c
@@ -1048,6 +1048,7 @@ rhythmdb_property_model_drag_data_get (RbTreeDragSource *dragsource,
RhythmDBPropertyModel *model = RHYTHMDB_PROPERTY_MODEL (dragsource);
guint target;
GtkTargetList *drag_target_list;
+ GdkAtom selection_data_target;
switch (model->priv->propid) {
case RHYTHMDB_PROP_GENRE:
@@ -1066,8 +1067,9 @@ rhythmdb_property_model_drag_data_get (RbTreeDragSource *dragsource,
g_assert_not_reached ();
}
+ selection_data_target = gtk_selection_data_get_target (selection_data);
if (!gtk_target_list_find (drag_target_list,
- selection_data->target,
+ selection_data_target,
&target)) {
return FALSE;
}
@@ -1160,7 +1162,7 @@ rhythmdb_property_model_drag_data_get (RbTreeDragSource *dragsource,
g_object_unref (query_model);
gtk_selection_data_set (selection_data,
- selection_data->target,
+ selection_data_target,
8, (guchar *)reply->str,
reply->len);
g_string_free (reply, TRUE);
@@ -1188,7 +1190,7 @@ rhythmdb_property_model_drag_data_get (RbTreeDragSource *dragsource,
gtk_tree_path_free (path);
}
gtk_selection_data_set (selection_data,
- selection_data->target,
+ selection_data_target,
8, (guchar *)reply->str,
reply->len);
g_string_free (reply, TRUE);
diff --git a/rhythmdb/rhythmdb-query-model.c b/rhythmdb/rhythmdb-query-model.c
index 06a77c8..668107a 100644
--- a/rhythmdb/rhythmdb-query-model.c
+++ b/rhythmdb/rhythmdb-query-model.c
@@ -1755,6 +1755,7 @@ rhythmdb_query_model_drag_data_get (RbTreeDragSource *dragsource,
{
RhythmDBQueryModel *model = RHYTHMDB_QUERY_MODEL (dragsource);
RhythmDBEntry *entry;
+ GdkAtom selection_data_target;
GString *data;
guint target;
GList *tem;
@@ -1762,8 +1763,9 @@ rhythmdb_query_model_drag_data_get (RbTreeDragSource *dragsource,
rb_debug ("getting drag data");
+ selection_data_target = gtk_selection_data_get_target (selection_data);
if (!gtk_target_list_find (rhythmdb_query_model_drag_target_list,
- selection_data->target, &target)) {
+ selection_data_target, &target)) {
return FALSE;
}
@@ -1803,7 +1805,7 @@ rhythmdb_query_model_drag_data_get (RbTreeDragSource *dragsource,
}
gtk_selection_data_set (selection_data,
- selection_data->target,
+ selection_data_target,
8, (guchar *) data->str,
data->len);
@@ -1849,7 +1851,8 @@ rhythmdb_query_model_drag_data_received (RbTreeDragDest *drag_dest,
if (model->priv->sort_func != NULL)
return FALSE;
- if (selection_data->format == 8 && selection_data->length >= 0) {
+ if ((gtk_selection_data_get_format (selection_data) == 8) &&
+ (gtk_selection_data_get_length (selection_data) >= 0)) {
GtkTreeIter iter;
GSequenceIter *ptr;
char **strv;
@@ -1857,9 +1860,9 @@ rhythmdb_query_model_drag_data_received (RbTreeDragDest *drag_dest,
gboolean uri_list;
int i = 0;
- uri_list = (selection_data->type == gdk_atom_intern ("text/uri-list", TRUE));
+ uri_list = (gtk_selection_data_get_data_type (selection_data) == gdk_atom_intern ("text/uri-list", TRUE));
- strv = g_strsplit ((char *) selection_data->data, "\r\n", -1);
+ strv = g_strsplit ((char *) gtk_selection_data_get_data (selection_data), "\r\n", -1);
if (dest == NULL || !rhythmdb_query_model_get_iter (GTK_TREE_MODEL (model), &iter, dest))
ptr = g_sequence_get_end_iter (model->priv->entries);
diff --git a/shell/rb-missing-plugins.c b/shell/rb-missing-plugins.c
index c7b454a..44fc33e 100644
--- a/shell/rb-missing-plugins.c
+++ b/shell/rb-missing-plugins.c
@@ -211,7 +211,7 @@ missing_plugins_event (RBShell *shell, RBPluginInstallContext *ctx)
if (window != NULL && GTK_WIDGET_REALIZED (window)) {
#ifdef GDK_WINDOWING_X11
gulong xid = 0;
- xid = GDK_WINDOW_XWINDOW (GTK_WIDGET (window)->window);
+ xid = gdk_x11_drawable_get_xid (gtk_widget_get_window (GTK_WIDGET (window)));
gst_install_plugins_context_set_xid (install_ctx, xid);
#endif
g_object_unref (window);
diff --git a/shell/rb-playlist-manager.c b/shell/rb-playlist-manager.c
index 37f8deb..beb361b 100644
--- a/shell/rb-playlist-manager.c
+++ b/shell/rb-playlist-manager.c
@@ -1018,14 +1018,19 @@ static char *
create_name_from_selection_data (RBPlaylistManager *mgr,
GtkSelectionData *data)
{
- char *name = NULL;
- GList *list;
+ GdkAtom type;
+ char *name = NULL;
+ const guchar *selection_data_data;
+ GList *list;
- if (data->type == gdk_atom_intern ("text/uri-list", TRUE) ||
- data->type == gdk_atom_intern ("application/x-rhythmbox-entry", TRUE)) {
+ type = gtk_selection_data_get_data_type (data);
+ selection_data_data = gtk_selection_data_get_data (data);
+
+ if (type == gdk_atom_intern ("text/uri-list", TRUE) ||
+ type == gdk_atom_intern ("application/x-rhythmbox-entry", TRUE)) {
gboolean is_id;
- list = rb_uri_list_parse ((const char *)data->data);
- is_id = (data->type == gdk_atom_intern ("application/x-rhythmbox-entry", TRUE));
+ list = rb_uri_list_parse ((const char *) selection_data_data);
+ is_id = (type == gdk_atom_intern ("application/x-rhythmbox-entry", TRUE));
if (list != NULL) {
GList *l;
@@ -1097,7 +1102,7 @@ create_name_from_selection_data (RBPlaylistManager *mgr,
} else {
char **names;
- names = g_strsplit ((char *)data->data, "\r\n", 0);
+ names = g_strsplit ((char *) selection_data_data, "\r\n", 0);
name = g_strjoinv (", ", names);
g_strfreev (names);
}
@@ -1125,11 +1130,14 @@ rb_playlist_manager_new_playlist_from_selection_data (RBPlaylistManager *mgr,
GtkSelectionData *data)
{
RBSource *playlist;
+ GdkAtom type;
gboolean automatic = TRUE;
char *suggested_name;
- if (data->type == gdk_atom_intern ("text/uri-list", TRUE) ||
- data->type == gdk_atom_intern ("application/x-rhythmbox-entry", TRUE))
+ type = gtk_selection_data_get_data_type (data);
+
+ if (type == gdk_atom_intern ("text/uri-list", TRUE) ||
+ type == gdk_atom_intern ("application/x-rhythmbox-entry", TRUE))
automatic = FALSE;
suggested_name = create_name_from_selection_data (mgr, data);
diff --git a/shell/rb-plugin-manager.c b/shell/rb-plugin-manager.c
index 1b1a6c5..dee908c 100644
--- a/shell/rb-plugin-manager.c
+++ b/shell/rb-plugin-manager.c
@@ -43,6 +43,8 @@
#include "rb-debug.h"
#include "rb-builder-helpers.h"
+#include "gseal-gtk-compat.h"
+
enum
{
ACTIVE_COLUMN,
@@ -199,12 +201,15 @@ cursor_changed_cb (GtkTreeSelection *selection,
icon = rb_plugins_engine_get_plugin_icon (info);
if (icon != NULL) {
/* rescale icon to fit header if needed */
+ GtkAllocation allocation;
GdkPixbuf *icon_scaled;
gint width, height, header_height;
+ gtk_widget_get_allocation (pm->priv->header_hbox, &allocation);
+
width = gdk_pixbuf_get_width (icon);
height = gdk_pixbuf_get_height (icon);
- header_height = pm->priv->header_hbox->allocation.height;
+ header_height = allocation.height;
if (height > header_height) {
icon_scaled = gdk_pixbuf_scale_simple (icon,
(gfloat)width/height*header_height, header_height,
diff --git a/shell/rb-plugins-engine.c b/shell/rb-plugins-engine.c
index 94eea31..6e40641 100644
--- a/shell/rb-plugins-engine.c
+++ b/shell/rb-plugins-engine.c
@@ -628,7 +628,7 @@ rb_plugins_engine_configure_plugin (RBPluginInfo *info,
gtk_window_set_transient_for (GTK_WINDOW (conf_dlg),
parent);
- wg = parent->group;
+ wg = gtk_window_get_group (parent);
if (wg == NULL)
{
wg = gtk_window_group_new ();
diff --git a/shell/rb-shell-preferences.c b/shell/rb-shell-preferences.c
index 26b0bc9..5079864 100644
--- a/shell/rb-shell-preferences.c
+++ b/shell/rb-shell-preferences.c
@@ -165,6 +165,7 @@ static void
rb_shell_preferences_init (RBShellPreferences *shell_preferences)
{
GtkWidget *tmp;
+ GtkWidget *content_area;
GtkBuilder *builder;
shell_preferences->priv = RB_SHELL_PREFERENCES_GET_PRIVATE (shell_preferences);
@@ -195,11 +196,13 @@ rb_shell_preferences_init (RBShellPreferences *shell_preferences)
shell_preferences->priv->notebook = GTK_WIDGET (gtk_notebook_new ());
gtk_container_set_border_width (GTK_CONTAINER (shell_preferences->priv->notebook), 5);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (shell_preferences)->vbox),
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (shell_preferences));
+
+ gtk_container_add (GTK_CONTAINER (content_area),
shell_preferences->priv->notebook);
gtk_container_set_border_width (GTK_CONTAINER (shell_preferences), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (shell_preferences)->vbox), 2);
+ gtk_box_set_spacing (GTK_BOX (content_area), 2);
gtk_dialog_set_has_separator (GTK_DIALOG (shell_preferences), FALSE);
builder = rb_builder_load ("general-prefs.ui", shell_preferences);
diff --git a/shell/rb-shell.c b/shell/rb-shell.c
index ceeda35..4a13c7b 100644
--- a/shell/rb-shell.c
+++ b/shell/rb-shell.c
@@ -43,6 +43,7 @@
#include <X11/XF86keysym.h>
#endif /* HAVE_MMKEYS */
+#include "gseal-gtk-compat.h"
#include "rb-shell.h"
#include "rb-debug.h"
#include "rb-dialog.h"
@@ -1432,7 +1433,7 @@ rb_shell_window_state_cb (GtkWidget *widget,
}
/* don't save maximized state when is hidden */
- if (!GTK_WIDGET_VISIBLE(shell->priv->window))
+ if (!gtk_widget_get_visible (shell->priv->window))
return FALSE;
if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) {
@@ -1468,7 +1469,7 @@ rb_shell_get_visibility (RBShell *shell)
if (shell->priv->iconified)
return FALSE;
- state = gdk_window_get_state (GTK_WIDGET (shell->priv->window)->window);
+ state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (shell->priv->window)));
if (state & (GDK_WINDOW_STATE_WITHDRAWN | GDK_WINDOW_STATE_ICONIFIED))
return FALSE;
@@ -2215,6 +2216,7 @@ rb_shell_cmd_plugins (GtkAction *action,
RBShell *shell)
{
if (shell->priv->plugins == NULL) {
+ GtkWidget *content_area;
GtkWidget *manager;
shell->priv->plugins = gtk_dialog_new_with_buttons (_("Configure Plugins"),
@@ -2223,8 +2225,9 @@ rb_shell_cmd_plugins (GtkAction *action,
GTK_STOCK_CLOSE,
GTK_RESPONSE_CLOSE,
NULL);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (shell->priv->plugins));
gtk_container_set_border_width (GTK_CONTAINER (shell->priv->plugins), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (shell->priv->plugins)->vbox), 2);
+ gtk_box_set_spacing (GTK_BOX (content_area), 2);
gtk_dialog_set_has_separator (GTK_DIALOG (shell->priv->plugins), FALSE);
g_signal_connect_object (G_OBJECT (shell->priv->plugins),
@@ -2238,7 +2241,7 @@ rb_shell_cmd_plugins (GtkAction *action,
manager = rb_plugin_manager_new ();
gtk_widget_show_all (GTK_WIDGET (manager));
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (shell->priv->plugins)->vbox),
+ gtk_container_add (GTK_CONTAINER (content_area),
manager);
}
diff --git a/sources/rb-auto-playlist-source.c b/sources/rb-auto-playlist-source.c
index 300f906..b318fa1 100644
--- a/sources/rb-auto-playlist-source.c
+++ b/sources/rb-auto-playlist-source.c
@@ -570,19 +570,22 @@ impl_receive_drag (RBSource *asource, GtkSelectionData *data)
{
RBAutoPlaylistSource *source = RB_AUTO_PLAYLIST_SOURCE (asource);
+ GdkAtom type;
GPtrArray *subquery = NULL;
gchar **names;
guint propid;
int i;
RhythmDB *db;
+ type = gtk_selection_data_get_data_type (data);
+
/* ignore URI and entry ID lists */
- if (data->type == gdk_atom_intern ("text/uri-list", TRUE) ||
- data->type == gdk_atom_intern ("application/x-rhythmbox-entry", TRUE))
+ if (type == gdk_atom_intern ("text/uri-list", TRUE) ||
+ type == gdk_atom_intern ("application/x-rhythmbox-entry", TRUE))
return TRUE;
- names = g_strsplit ((char *)data->data, "\r\n", 0);
- propid = rb_auto_playlist_source_drag_atom_to_prop (data->type);
+ names = g_strsplit ((char *) gtk_selection_data_get_data (data), "\r\n", 0);
+ propid = rb_auto_playlist_source_drag_atom_to_prop (type);
g_object_get (asource, "db", &db, NULL);
diff --git a/sources/rb-library-source.c b/sources/rb-library-source.c
index 6d261d9..d8678ac 100644
--- a/sources/rb-library-source.c
+++ b/sources/rb-library-source.c
@@ -681,8 +681,8 @@ impl_receive_drag (RBSource *asource, GtkSelectionData *data)
gboolean is_id;
rb_debug ("parsing uri list");
- list = rb_uri_list_parse ((const char *) data->data);
- is_id = (data->type == gdk_atom_intern ("application/x-rhythmbox-entry", TRUE));
+ list = rb_uri_list_parse ((const char *) gtk_selection_data_get_data (data));
+ is_id = (gtk_selection_data_get_data_type (data) == gdk_atom_intern ("application/x-rhythmbox-entry", TRUE));
for (i = list; i != NULL; i = g_list_next (i)) {
if (i->data != NULL) {
diff --git a/sources/rb-podcast-source.c b/sources/rb-podcast-source.c
index 85a3d7a..ceb767d 100644
--- a/sources/rb-podcast-source.c
+++ b/sources/rb-podcast-source.c
@@ -1695,7 +1695,7 @@ impl_receive_drag (RBSource *asource, GtkSelectionData *selection_data)
GList *list, *i;
RBPodcastSource *source = RB_PODCAST_SOURCE (asource);
- list = rb_uri_list_parse ((char *)selection_data->data);
+ list = rb_uri_list_parse ((const char *) gtk_selection_data_get_data (selection_data));
for (i = list; i != NULL; i = i->next) {
char *uri = NULL;
@@ -1706,7 +1706,7 @@ impl_receive_drag (RBSource *asource, GtkSelectionData *selection_data)
rb_podcast_source_add_feed (source, uri);
}
- if (selection_data->type == gdk_atom_intern ("_NETSCAPE_URL", FALSE)) {
+ if (gtk_selection_data_get_data_type (selection_data) == gdk_atom_intern ("_NETSCAPE_URL", FALSE)) {
i = i->next;
}
}
diff --git a/sources/rb-removable-media-source.c b/sources/rb-removable-media-source.c
index 4effe92..ea84491 100644
--- a/sources/rb-removable-media-source.c
+++ b/sources/rb-removable-media-source.c
@@ -519,7 +519,7 @@ impl_receive_drag (RBSource *asource, GtkSelectionData *data)
char *type;
entries = NULL;
- type = gdk_atom_name (data->type);
+ type = gdk_atom_name (gtk_selection_data_get_data_type (data));
db = get_db_for_source (asource);
if (strcmp (type, "text/uri-list") == 0) {
@@ -527,7 +527,7 @@ impl_receive_drag (RBSource *asource, GtkSelectionData *data)
GList *i;
rb_debug ("parsing uri list");
- list = rb_uri_list_parse ((const char *) data->data);
+ list = rb_uri_list_parse ((const char *) gtk_selection_data_get_data (data));
for (i = list; i != NULL; i = g_list_next (i)) {
char *uri;
@@ -554,7 +554,7 @@ impl_receive_drag (RBSource *asource, GtkSelectionData *data)
char **i;
rb_debug ("parsing entry ids");
- list = g_strsplit ((const char*)data->data, "\n", -1);
+ list = g_strsplit ((const char*) gtk_selection_data_get_data (data), "\n", -1);
for (i = list; *i != NULL; i++) {
RhythmDBEntry *entry;
gulong id;
diff --git a/sources/rb-sourcelist-model.c b/sources/rb-sourcelist-model.c
index 9215299..3f7f5c7 100644
--- a/sources/rb-sourcelist-model.c
+++ b/sources/rb-sourcelist-model.c
@@ -327,12 +327,14 @@ rb_sourcelist_model_drag_data_received (RbTreeDragDest *drag_dest,
GtkSelectionData *selection_data)
{
RBSourceListModel *model;
+ GdkAtom type;
g_return_val_if_fail (RB_IS_SOURCELIST_MODEL (drag_dest), FALSE);
model = RB_SOURCELIST_MODEL (drag_dest);
+ type = gtk_selection_data_get_data_type (selection_data);
- if (selection_data->type == gdk_atom_intern ("text/uri-list", TRUE) ||
- selection_data->type == gdk_atom_intern ("application/x-rhythmbox-entry", TRUE)) {
+ if (type == gdk_atom_intern ("text/uri-list", TRUE) ||
+ type == gdk_atom_intern ("application/x-rhythmbox-entry", TRUE)) {
GtkTreeIter iter;
RBSource *target = NULL;
@@ -353,16 +355,16 @@ rb_sourcelist_model_drag_data_received (RbTreeDragDest *drag_dest,
}
/* if artist, album or genre, only allow new playlists */
- if (selection_data->type == gdk_atom_intern ("text/x-rhythmbox-album", TRUE) ||
- selection_data->type == gdk_atom_intern ("text/x-rhythmbox-artist", TRUE) ||
- selection_data->type == gdk_atom_intern ("text/x-rhythmbox-genre", TRUE)) {
+ if (type == gdk_atom_intern ("text/x-rhythmbox-album", TRUE) ||
+ type == gdk_atom_intern ("text/x-rhythmbox-artist", TRUE) ||
+ type == gdk_atom_intern ("text/x-rhythmbox-genre", TRUE)) {
rb_debug ("text/x-rhythmbox-(album|artist|genre) drag data received");
g_signal_emit (G_OBJECT (model), rb_sourcelist_model_signals[DROP_RECEIVED],
0, NULL, pos, selection_data);
return TRUE;
}
- if (selection_data->type == gdk_atom_intern ("application/x-rhythmbox-source", TRUE)) {
+ if (type == gdk_atom_intern ("application/x-rhythmbox-source", TRUE)) {
/* don't support dnd of sources */
return FALSE;
}
@@ -491,14 +493,16 @@ rb_sourcelist_model_drag_data_get (RbTreeDragSource *drag_source,
{
char *path_str;
GtkTreePath *path;
+ GdkAtom selection_data_target;
guint target;
+ selection_data_target = gtk_selection_data_get_target (selection_data);
path = gtk_tree_row_reference_get_path (path_list->data);
if (path == NULL)
return FALSE;
if (!gtk_target_list_find (sourcelist_drag_target_list,
- selection_data->target,
+ selection_data_target,
&target)) {
return FALSE;
}
@@ -508,7 +512,7 @@ rb_sourcelist_model_drag_data_get (RbTreeDragSource *drag_source,
rb_debug ("getting drag data as rb source path");
path_str = gtk_tree_path_to_string (path);
gtk_selection_data_set (selection_data,
- selection_data->target,
+ selection_data_target,
8, (guchar *) path_str,
strlen (path_str));
g_free (path_str);
@@ -562,7 +566,7 @@ rb_sourcelist_model_drag_data_get (RbTreeDragSource *drag_source,
g_object_unref (query_model);
gtk_selection_data_set (selection_data,
- selection_data->target,
+ selection_data_target,
8, (guchar *) data->str,
data->len);
diff --git a/sources/rb-sourcelist.c b/sources/rb-sourcelist.c
index 5e05c1a..f78f76a 100644
--- a/sources/rb-sourcelist.c
+++ b/sources/rb-sourcelist.c
@@ -491,7 +491,8 @@ rb_sourcelist_expander_cell_data_func (GtkTreeViewColumn *column,
gboolean row_expanded;
path = gtk_tree_model_get_path (model, iter);
- row_expanded = gtk_tree_view_row_expanded (GTK_TREE_VIEW (column->tree_view), path);
+ row_expanded = gtk_tree_view_row_expanded (GTK_TREE_VIEW (gtk_tree_view_column_get_tree_view (column)),
+ path);
gtk_tree_path_free (path);
g_object_set (cell,
diff --git a/sources/rb-static-playlist-source.c b/sources/rb-static-playlist-source.c
index 70139dd..2caaa2a 100644
--- a/sources/rb-static-playlist-source.c
+++ b/sources/rb-static-playlist-source.c
@@ -589,16 +589,19 @@ rb_static_playlist_source_browser_changed_cb (RBLibraryBrowser *browser,
static gboolean
impl_receive_drag (RBSource *asource, GtkSelectionData *data)
{
+ GdkAtom type;
GList *list;
RBStaticPlaylistSource *source = RB_STATIC_PLAYLIST_SOURCE (asource);
- if (data->type == gdk_atom_intern ("text/uri-list", TRUE) ||
- data->type == gdk_atom_intern ("application/x-rhythmbox-entry", TRUE)) {
- list = rb_uri_list_parse ((char *)data->data);
+ type = gtk_selection_data_get_data_type (data);
+
+ if (type == gdk_atom_intern ("text/uri-list", TRUE) ||
+ type == gdk_atom_intern ("application/x-rhythmbox-entry", TRUE)) {
+ list = rb_uri_list_parse ((char *)gtk_selection_data_get_data (data));
if (list == NULL)
return FALSE;
- if (data->type == gdk_atom_intern ("text/uri-list", TRUE))
+ if (type == gdk_atom_intern ("text/uri-list", TRUE))
rb_static_playlist_source_add_uri_list (source, list);
else
rb_static_playlist_source_add_id_list (source, list);
diff --git a/widgets/gedit-message-area.c b/widgets/gedit-message-area.c
index 7592e74..dc25f5e 100644
--- a/widgets/gedit-message-area.c
+++ b/widgets/gedit-message-area.c
@@ -49,6 +49,8 @@
#include "gedit-message-area.h"
+#include "gseal-gtk-compat.h"
+
#define GEDIT_MESSAGE_AREA_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
GEDIT_TYPE_MESSAGE_AREA, \
GeditMessageAreaPrivate))
@@ -153,17 +155,21 @@ paint_message_area (GtkWidget *widget,
GdkEventExpose *event,
gpointer user_data)
{
- gtk_paint_flat_box (widget->style,
- widget->window,
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
+
+ gtk_paint_flat_box (gtk_widget_get_style (widget),
+ gtk_widget_get_window (widget),
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
NULL,
widget,
"tooltip",
- widget->allocation.x + 1,
- widget->allocation.y + 1,
- widget->allocation.width - 2,
- widget->allocation.height - 2);
+ allocation.x + 1,
+ allocation.y + 1,
+ allocation.width - 2,
+ allocation.height - 2);
return FALSE;
}
@@ -390,7 +396,7 @@ gedit_message_area_add_button (GeditMessageArea *message_area,
button = gtk_button_new_from_stock (button_text);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default (button, TRUE);
gtk_widget_show (button);
@@ -621,7 +627,7 @@ gedit_message_area_add_stock_button_with_text (GeditMessageArea *message_area,
gtk_image_new_from_stock (stock_id,
GTK_ICON_SIZE_BUTTON));
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default (button, TRUE);
gtk_widget_show (button);
diff --git a/widgets/gossip-cell-renderer-expander.c b/widgets/gossip-cell-renderer-expander.c
index 234a535..0258d29 100644
--- a/widgets/gossip-cell-renderer-expander.c
+++ b/widgets/gossip-cell-renderer-expander.c
@@ -33,6 +33,8 @@
#include "gossip-cell-renderer-expander.h"
+#include "gseal-gtk-compat.h"
+
#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GOSSIP_TYPE_CELL_RENDERER_EXPANDER, GossipCellRendererExpanderPriv))
static void gossip_cell_renderer_expander_init (GossipCellRendererExpander *expander);
@@ -106,9 +108,10 @@ gossip_cell_renderer_expander_init (GossipCellRendererExpander *expander)
priv->activatable = TRUE;
priv->animation_node = NULL;
- GTK_CELL_RENDERER (expander)->xpad = 2;
- GTK_CELL_RENDERER (expander)->ypad = 2;
- GTK_CELL_RENDERER (expander)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
+ gtk_cell_renderer_set_padding (GTK_CELL_RENDERER (expander), 2, 2);
+ g_object_set (expander,
+ "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE,
+ NULL);
}
static void
@@ -257,18 +260,24 @@ gossip_cell_renderer_expander_get_size (GtkCellRenderer *cell,
{
GossipCellRendererExpander *expander;
GossipCellRendererExpanderPriv *priv;
+ gint xpad, ypad;
+ gfloat xalign, yalign;
expander = (GossipCellRendererExpander*) cell;
priv = GET_PRIV (expander);
+ gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
if (cell_area) {
+
+ gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
+
if (x_offset) {
- *x_offset = cell->xalign * (cell_area->width - (priv->expander_size + (2 * cell->xpad)));
+ *x_offset = xalign * (cell_area->width - (priv->expander_size + (2 * xpad)));
*x_offset = MAX (*x_offset, 0);
}
if (y_offset) {
- *y_offset = cell->yalign * (cell_area->height - (priv->expander_size + (2 * cell->ypad)));
+ *y_offset = yalign * (cell_area->height - (priv->expander_size + (2 * ypad)));
*y_offset = MAX (*y_offset, 0);
}
} else {
@@ -280,10 +289,10 @@ gossip_cell_renderer_expander_get_size (GtkCellRenderer *cell,
}
if (width)
- *width = cell->xpad * 2 + priv->expander_size;
+ *width = xpad * 2 + priv->expander_size;
if (height)
- *height = cell->ypad * 2 + priv->expander_size;
+ *height = ypad * 2 + priv->expander_size;
}
static void
@@ -299,6 +308,7 @@ gossip_cell_renderer_expander_render (GtkCellRenderer *cell,
GossipCellRendererExpanderPriv *priv;
GtkExpanderStyle expander_style;
gint x_offset, y_offset;
+ gint xpad, ypad;
expander = (GossipCellRendererExpander*) cell;
priv = GET_PRIV (expander);
@@ -323,15 +333,16 @@ gossip_cell_renderer_expander_render (GtkCellRenderer *cell,
gossip_cell_renderer_expander_get_size (cell, widget, cell_area,
&x_offset, &y_offset,
NULL, NULL);
+ gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
- gtk_paint_expander (widget->style,
+ gtk_paint_expander (gtk_widget_get_style (widget),
window,
GTK_STATE_NORMAL,
expose_area,
widget,
"treeview",
- cell_area->x + x_offset + cell->xpad + priv->expander_size / 2,
- cell_area->y + y_offset + cell->ypad + priv->expander_size / 2,
+ cell_area->x + x_offset + xpad + priv->expander_size / 2,
+ cell_area->y + y_offset + ypad + priv->expander_size / 2,
expander_style);
}
@@ -339,15 +350,17 @@ static void
invalidate_node (GtkTreeView *tree_view,
GtkTreePath *path)
{
- GdkWindow *bin_window;
- GdkRectangle rect;
+ GtkAllocation allocation;
+ GdkWindow *bin_window;
+ GdkRectangle rect;
bin_window = gtk_tree_view_get_bin_window (tree_view);
gtk_tree_view_get_background_area (tree_view, path, NULL, &rect);
+ gtk_widget_get_allocation (GTK_WIDGET (tree_view), &allocation);
rect.x = 0;
- rect.width = GTK_WIDGET (tree_view)->allocation.width;
+ rect.width = allocation.width;
gdk_window_invalidate_rect (bin_window, &rect, TRUE);
}
diff --git a/widgets/rb-cell-renderer-pixbuf.c b/widgets/rb-cell-renderer-pixbuf.c
index 0e52d5d..178b4b9 100644
--- a/widgets/rb-cell-renderer-pixbuf.c
+++ b/widgets/rb-cell-renderer-pixbuf.c
@@ -26,6 +26,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include "gseal-gtk-compat.h"
#include "rb-cell-renderer-pixbuf.h"
#include "rb-cut-and-paste-code.h"
@@ -87,9 +88,10 @@ static guint rb_cell_renderer_pixbuf_signals [LAST_SIGNAL] = { 0 };
static void
rb_cell_renderer_pixbuf_init (RBCellRendererPixbuf *cellpixbuf)
{
-
/* set the renderer able to be activated */
- GTK_CELL_RENDERER (cellpixbuf)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
+ g_object_set (cellpixbuf,
+ "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE,
+ NULL);
}
static void
@@ -210,6 +212,8 @@ rb_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
gint pixbuf_height = 0;
gint calc_width;
gint calc_height;
+ gint xpad, ypad;
+ gfloat xalign, yalign;
if (cellpixbuf->pixbuf)
{
@@ -217,23 +221,26 @@ rb_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
pixbuf_height = gdk_pixbuf_get_height (cellpixbuf->pixbuf);
}
- calc_width = (gint) GTK_CELL_RENDERER (cellpixbuf)->xpad * 2 + pixbuf_width;
- calc_height = (gint) GTK_CELL_RENDERER (cellpixbuf)->ypad * 2 + pixbuf_height;
+ gtk_cell_renderer_get_padding (GTK_CELL_RENDERER (cellpixbuf), &xpad, &ypad);
+ calc_width = xpad * 2 + pixbuf_width;
+ calc_height = ypad * 2 + pixbuf_height;
if (x_offset) *x_offset = 0;
if (y_offset) *y_offset = 0;
if (cell_area && pixbuf_width > 0 && pixbuf_height > 0)
{
+ gtk_cell_renderer_get_alignment (GTK_CELL_RENDERER (cellpixbuf), &xalign, &yalign);
+
if (x_offset)
{
- *x_offset = GTK_CELL_RENDERER (cellpixbuf)->xalign * (cell_area->width - calc_width - (2 * GTK_CELL_RENDERER (cellpixbuf)->xpad));
- *x_offset = MAX (*x_offset, 0) + GTK_CELL_RENDERER (cellpixbuf)->xpad;
+ *x_offset = xalign * (cell_area->width - calc_width - (2 * xpad));
+ *x_offset = MAX (*x_offset, 0) + xpad;
}
if (y_offset)
{
- *y_offset = GTK_CELL_RENDERER (cellpixbuf)->yalign * (cell_area->height - calc_height - (2 * GTK_CELL_RENDERER (cellpixbuf)->ypad));
- *y_offset = MAX (*y_offset, 0) + GTK_CELL_RENDERER (cellpixbuf)->ypad;
+ *y_offset = yalign * (cell_area->height - calc_height - (2 * ypad));
+ *y_offset = MAX (*y_offset, 0) + ypad;
}
}
@@ -258,17 +265,18 @@ rb_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
GdkRectangle pix_rect;
GdkRectangle draw_rect;
GtkStateType state;
+ gint xpad, ypad;
if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
{
- if (GTK_WIDGET_HAS_FOCUS (widget))
+ if (gtk_widget_has_focus (widget))
state = GTK_STATE_SELECTED;
else
state = GTK_STATE_ACTIVE;
}
else
{
- if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
+ if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE)
state = GTK_STATE_INSENSITIVE;
else
state = GTK_STATE_NORMAL;
@@ -285,8 +293,9 @@ rb_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
pix_rect.x += cell_area->x;
pix_rect.y += cell_area->y;
- pix_rect.width -= cell->xpad * 2;
- pix_rect.height -= cell->ypad * 2;
+ gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
+ pix_rect.width -= xpad * 2;
+ pix_rect.height -= ypad * 2;
if (gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect))
gdk_draw_pixbuf (window,
diff --git a/widgets/rb-cell-renderer-rating.c b/widgets/rb-cell-renderer-rating.c
index b87123f..005f18f 100644
--- a/widgets/rb-cell-renderer-rating.c
+++ b/widgets/rb-cell-renderer-rating.c
@@ -29,6 +29,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include "gseal-gtk-compat.h"
#include "rb-cell-renderer-rating.h"
#include "rb-marshal.h"
#include "rb-rating-helper.h"
@@ -111,7 +112,9 @@ rb_cell_renderer_rating_init (RBCellRendererRating *cellrating)
cellrating->priv = RB_CELL_RENDERER_RATING_GET_PRIVATE (cellrating);
/* set the renderer able to be activated */
- GTK_CELL_RENDERER (cellrating)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
+ g_object_set (cellrating,
+ "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE,
+ NULL);
/* create the needed icons */
}
@@ -237,10 +240,12 @@ rb_cell_renderer_rating_get_size (GtkCellRenderer *cell,
gint *width,
gint *height)
{
- int icon_width;
+ gint icon_width;
+ gint xpad, ypad;
RBCellRendererRating *cellrating = (RBCellRendererRating *) cell;
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &icon_width, NULL);
+ gtk_cell_renderer_get_padding (GTK_CELL_RENDERER (cellrating), &xpad, &ypad);
if (x_offset)
*x_offset = 0;
@@ -249,10 +254,10 @@ rb_cell_renderer_rating_get_size (GtkCellRenderer *cell,
*y_offset = 0;
if (width)
- *width = (gint) GTK_CELL_RENDERER (cellrating)->xpad * 2 + icon_width * RB_RATING_MAX_SCORE;
+ *width = xpad * 2 + icon_width * RB_RATING_MAX_SCORE;
if (height)
- *height = (gint) GTK_CELL_RENDERER (cellrating)->ypad * 2 + icon_width;
+ *height = ypad * 2 + icon_width;
}
static void
@@ -265,6 +270,7 @@ rb_cell_renderer_rating_render (GtkCellRenderer *cell,
GtkCellRendererState flags)
{
+ gint xpad, ypad;
gboolean selected;
GdkRectangle pix_rect, draw_rect;
RBCellRendererRating *cellrating = (RBCellRendererRating *) cell;
@@ -280,8 +286,9 @@ rb_cell_renderer_rating_render (GtkCellRenderer *cell,
pix_rect.x += cell_area->x;
pix_rect.y += cell_area->y;
- pix_rect.width -= cell->xpad * 2;
- pix_rect.height -= cell->ypad * 2;
+ gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
+ pix_rect.width -= xpad * 2;
+ pix_rect.height -= ypad * 2;
if (gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect) == FALSE)
return;
diff --git a/widgets/rb-entry-view.c b/widgets/rb-entry-view.c
index 941e1b3..2d4c43e 100644
--- a/widgets/rb-entry-view.c
+++ b/widgets/rb-entry-view.c
@@ -1871,7 +1871,7 @@ rb_entry_view_constructed (GObject *object)
G_CALLBACK (rb_entry_view_pixbuf_clicked_cb),
view);
- gtk_widget_set_tooltip_text (GTK_WIDGET (column->button),
+ gtk_widget_set_tooltip_text (gtk_tree_view_column_get_widget (column),
_("Now Playing"));
}
diff --git a/widgets/rb-header.c b/widgets/rb-header.c
index 382bde0..5f6596a 100644
--- a/widgets/rb-header.c
+++ b/widgets/rb-header.c
@@ -304,7 +304,7 @@ rb_header_playing_song_changed_cb (RBShellPlayer *player, RhythmDBEntry *entry,
header->priv->duration = 0;
}
- header->priv->adjustment->upper = header->priv->duration;
+ gtk_adjustment_set_upper (header->priv->adjustment, header->priv->duration);
gtk_adjustment_changed (header->priv->adjustment);
rb_header_sync (header);
diff --git a/widgets/rb-library-browser.c b/widgets/rb-library-browser.c
index cfbb9c6..8786865 100644
--- a/widgets/rb-library-browser.c
+++ b/widgets/rb-library-browser.c
@@ -35,6 +35,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include "gseal-gtk-compat.h"
#include "rb-library-browser.h"
#include "rb-preferences.h"
#include "eel-gconf-extensions.h"
@@ -397,7 +398,7 @@ update_browser_property_visibilty (RhythmDBPropType prop,
{
gboolean old_vis, new_vis;
- old_vis = GTK_WIDGET_VISIBLE (view);
+ old_vis = gtk_widget_get_visible (GTK_WIDGET (view));
new_vis = (g_list_find (properties, (gpointer)prop) != NULL);
if (old_vis != new_vis) {
diff --git a/widgets/rb-query-creator.c b/widgets/rb-query-creator.c
index 766b97c..1e14b48 100644
--- a/widgets/rb-query-creator.c
+++ b/widgets/rb-query-creator.c
@@ -179,6 +179,7 @@ rb_query_creator_constructed (GObject *object)
RBQueryCreatorPrivate *priv;
RBQueryCreator *creator;
GtkWidget *mainbox;
+ GtkWidget *content_area;
GtkBuilder *builder;
RB_CHAIN_GOBJECT_METHOD (rb_query_creator_parent_class, constructed, object);
@@ -211,8 +212,10 @@ rb_query_creator_constructed (GObject *object)
else
gtk_window_set_title (GTK_WINDOW (creator), _("Edit Automatic Playlist"));
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (creator));
+
gtk_container_set_border_width (GTK_CONTAINER (creator), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (creator)->vbox), 2);
+ gtk_box_set_spacing (GTK_BOX (content_area), 2);
gtk_dialog_set_has_separator (GTK_DIALOG (creator), FALSE);
builder = rb_builder_load ("create-playlist.ui", creator);
@@ -243,7 +246,7 @@ rb_query_creator_constructed (GObject *object)
append_row (creator);
mainbox = GTK_WIDGET (gtk_builder_get_object (builder, "complex-playlist-creator"));
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (creator)->vbox), mainbox, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (content_area), mainbox, FALSE, FALSE, 0);
gtk_widget_show_all (GTK_WIDGET (creator));
g_object_unref (builder);
diff --git a/widgets/rb-rating-helper.c b/widgets/rb-rating-helper.c
index 1532257..b716caf 100644
--- a/widgets/rb-rating-helper.c
+++ b/widgets/rb-rating-helper.c
@@ -30,8 +30,10 @@
#include <math.h>
+#include <gtk/gtk.h>
#include <glib/gi18n.h>
+#include "gseal-gtk-compat.h"
#include "rb-cut-and-paste-code.h"
#include "rb-rating-helper.h"
#include "rb-stock-icons.h"
@@ -179,18 +181,19 @@ rb_rating_render_stars (GtkWidget *widget,
for (i = 0; i < RB_RATING_MAX_SCORE; i++) {
GdkPixbuf *buf;
GtkStateType state;
+ GtkStyle *style;
gint star_offset;
int offset;
if (selected == TRUE) {
offset = 0;
- if (GTK_WIDGET_HAS_FOCUS (widget))
+ if (gtk_widget_has_focus (widget))
state = GTK_STATE_SELECTED;
else
state = GTK_STATE_ACTIVE;
} else {
offset = 120;
- if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
+ if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE)
state = GTK_STATE_INSENSITIVE;
else
state = GTK_STATE_NORMAL;
@@ -207,10 +210,11 @@ rb_rating_render_stars (GtkWidget *widget,
return FALSE;
}
+ style = gtk_widget_get_style (widget);
buf = eel_create_colorized_pixbuf (buf,
- (widget->style->text[state].red + offset) >> 8,
- (widget->style->text[state].green + offset) >> 8,
- (widget->style->text[state].blue + offset) >> 8);
+ (style->text[state].red + offset) >> 8,
+ (style->text[state].green + offset) >> 8,
+ (style->text[state].blue + offset) >> 8);
if (buf == NULL) {
return FALSE;
}
diff --git a/widgets/rb-rating.c b/widgets/rb-rating.c
index 32fcc57..9851333 100644
--- a/widgets/rb-rating.c
+++ b/widgets/rb-rating.c
@@ -37,6 +37,8 @@
#include "rb-stock-icons.h"
#include "rb-cut-and-paste-code.h"
+#include "gseal-gtk-compat.h"
+
/* Offset at the beggining of the widget */
#define X_OFFSET 0
@@ -284,15 +286,21 @@ rb_rating_new ()
static void
rb_rating_realize (GtkWidget *widget)
{
+ GtkAllocation allocation;
+ GtkStyle *style;
GdkWindowAttr attributes;
+ GdkWindow *window;
int attributes_mask;
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED | GTK_CAN_FOCUS);
+ GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+ gtk_widget_set_can_focus (widget, TRUE);
+
+ gtk_widget_get_allocation (widget, &allocation);
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
+ attributes.x = allocation.x;
+ attributes.y = allocation.y;
+ attributes.width = allocation.width;
+ attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK;
@@ -300,12 +308,14 @@ rb_rating_realize (GtkWidget *widget)
attributes.colormap = gtk_widget_get_colormap (widget);
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- widget->style = gtk_style_attach (widget->style, widget->window);
- gdk_window_set_user_data (widget->window, widget);
+ window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+ gtk_widget_set_window (widget, window);
+ gdk_window_set_user_data (window, widget);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE);
+ style = gtk_style_attach (gtk_widget_get_style (widget), window);
+ gtk_widget_set_style (widget, style);
+ gtk_style_set_background (style, window, GTK_STATE_ACTIVE);
}
static void
@@ -326,6 +336,7 @@ static gboolean
rb_rating_expose (GtkWidget *widget,
GdkEventExpose *event)
{
+ GdkWindow *window;
gboolean ret;
RBRating *rating;
int x = 0;
@@ -335,24 +346,25 @@ rb_rating_expose (GtkWidget *widget,
int focus_width;
g_return_val_if_fail (RB_IS_RATING (widget), FALSE);
- if (GTK_WIDGET_DRAWABLE (widget) == FALSE) {
+ if (!gtk_widget_is_drawable (widget)) {
return FALSE;
}
ret = FALSE;
rating = RB_RATING (widget);
- gdk_drawable_get_size (widget->window, &width, &height);
+ window = gtk_widget_get_window (widget);
+ gdk_drawable_get_size (window, &width, &height);
gtk_widget_style_get (widget, "focus-line-width", &focus_width, NULL);
- if (GTK_WIDGET_HAS_FOCUS (widget)) {
+ if (gtk_widget_has_focus (widget)) {
x += focus_width;
y += focus_width;
width -= 2 * focus_width;
height -= 2 * focus_width;
}
- gtk_paint_flat_box (widget->style, widget->window,
+ gtk_paint_flat_box (gtk_widget_get_style (widget), window,
GTK_STATE_NORMAL, GTK_SHADOW_IN,
NULL, widget, "entry_bg", x, y,
width, height);
@@ -360,7 +372,7 @@ rb_rating_expose (GtkWidget *widget,
/* draw the stars */
if (rating->priv->pixbufs != NULL) {
ret = rb_rating_render_stars (widget,
- widget->window,
+ window,
rating->priv->pixbufs,
0, 0,
X_OFFSET, Y_OFFSET,
@@ -378,6 +390,7 @@ rb_rating_button_press_cb (GtkWidget *widget,
int mouse_x, mouse_y;
double new_rating;
RBRating *rating;
+ GtkAllocation allocation;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (RB_IS_RATING (widget), FALSE);
@@ -385,9 +398,10 @@ rb_rating_button_press_cb (GtkWidget *widget,
rating = RB_RATING (widget);
gtk_widget_get_pointer (widget, &mouse_x, &mouse_y);
+ gtk_widget_get_allocation (widget, &allocation);
new_rating = rb_rating_get_rating_from_widget (widget, mouse_x,
- widget->allocation.width,
+ allocation.width,
rating->priv->rating);
if (new_rating > -0.0001) {
diff --git a/widgets/rb-song-info.c b/widgets/rb-song-info.c
index d70de7b..875863b 100644
--- a/widgets/rb-song-info.c
+++ b/widgets/rb-song-info.c
@@ -331,7 +331,7 @@ rb_song_info_init (RBSongInfo *song_info)
gtk_container_set_border_width (GTK_CONTAINER (song_info), 5);
gtk_window_set_resizable (GTK_WINDOW (song_info), TRUE);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (song_info)->vbox), 2);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (song_info))), 2);
}
static void
@@ -440,6 +440,7 @@ rb_song_info_constructed (GObject *object)
RBShell *shell;
AtkObject *lobj, *robj;
GtkBuilder *builder;
+ GtkWidget *content_area;
RB_CHAIN_GOBJECT_METHOD (rb_song_info_parent_class, constructed, object);
@@ -470,13 +471,14 @@ rb_song_info_constructed (GObject *object)
song_info->priv->selected_entries = selected_entries;
}
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (song_info));
if (song_info->priv->current_entry) {
builder = rb_builder_load ("song-info.ui", song_info);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (song_info)->vbox),
+ gtk_container_add (GTK_CONTAINER (content_area),
GTK_WIDGET (gtk_builder_get_object (builder, "song_info_vbox")));
} else {
builder = rb_builder_load ("song-info-multiple.ui", song_info);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (song_info)->vbox),
+ gtk_container_add (GTK_CONTAINER (content_area),
GTK_WIDGET (gtk_builder_get_object (builder, "song_info_notebook")));
}
diff --git a/widgets/rb-uri-dialog.c b/widgets/rb-uri-dialog.c
index b287ab9..00f02e3 100644
--- a/widgets/rb-uri-dialog.c
+++ b/widgets/rb-uri-dialog.c
@@ -134,6 +134,7 @@ rb_uri_dialog_class_init (RBURIDialogClass *klass)
static void
rb_uri_dialog_init (RBURIDialog *dialog)
{
+ GtkWidget *content_area;
GtkBuilder *builder;
/* create the dialog and some buttons forward - close */
@@ -144,9 +145,11 @@ rb_uri_dialog_init (RBURIDialog *dialog)
G_CALLBACK (rb_uri_dialog_response_cb),
dialog, 0);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
+ gtk_box_set_spacing (GTK_BOX (content_area), 2);
dialog->priv->cancelbutton = gtk_dialog_add_button (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL,
@@ -158,7 +161,7 @@ rb_uri_dialog_init (RBURIDialog *dialog)
builder = rb_builder_load ("uri-new.ui", dialog);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
+ gtk_container_add (GTK_CONTAINER (content_area),
GTK_WIDGET (gtk_builder_get_object (builder, "newuri")));
/* get the widgets from the GtkBuilder */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]