[rhythmbox] Finish adding GSEAL compatibility (bug #595425)



commit 4001029dc53418721822d0d5ab410164b08499bc
Author: Javier Jardón <jjardon gnome org>
Date:   Mon Mar 29 23:17:50 2010 +1000

    Finish adding GSEAL compatibility (bug #595425)

 lib/gseal-gtk-compat.h                             |    4 ++
 plugins/audiocd/rb-audiocd-source.c                |    3 +-
 .../rb-disc-recorder-plugin.c                      |    6 ++-
 plugins/power-manager/rb-power-manager-plugin.c    |    2 +-
 plugins/status-icon/rb-status-icon-plugin.c        |    2 +-
 plugins/visualizer/rb-vis-widget.c                 |    4 +-
 plugins/visualizer/rb-visualizer-plugin.c          |    6 ++--
 shell/rb-missing-plugins.c                         |    2 +-
 shell/rb-shell.c                                   |    4 +-
 widgets/rb-entry-view.c                            |    4 +-
 widgets/rb-rating.c                                |    2 +-
 widgets/rb-segmented-bar.c                         |   39 +++++++++++---------
 12 files changed, 45 insertions(+), 33 deletions(-)
---
diff --git a/lib/gseal-gtk-compat.h b/lib/gseal-gtk-compat.h
index 86113c4..83c5bf1 100644
--- a/lib/gseal-gtk-compat.h
+++ b/lib/gseal-gtk-compat.h
@@ -23,6 +23,10 @@
 
 G_BEGIN_DECLS
 
+#if !GTK_CHECK_VERSION (2, 19, 5)
+#define gtk_widget_get_realized(widget)				GTK_WIDGET_REALIZED(widget)
+#define gtk_widget_set_realized(widget)				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))
diff --git a/plugins/audiocd/rb-audiocd-source.c b/plugins/audiocd/rb-audiocd-source.c
index b8b2a40..f169389 100644
--- a/plugins/audiocd/rb-audiocd-source.c
+++ b/plugins/audiocd/rb-audiocd-source.c
@@ -329,7 +329,8 @@ rb_audiocd_source_constructed (GObject *object)
 	gtk_tree_view_column_set_fixed_width (extract, toggle_width + 5);
 
 	rb_entry_view_insert_column_custom (entry_view, extract, "", "Extract", NULL, NULL, NULL, 1);
-	gtk_widget_set_tooltip_text (GTK_WIDGET (extract->button), _("Select tracks to be extracted"));
+	gtk_widget_set_tooltip_text (gtk_tree_view_column_get_widget (extract),
+	                             _("Select tracks to be extracted"));
 
 	/* hide the 'album' column */
 	gtk_tree_view_column_set_visible (rb_entry_view_get_column (entry_view, RB_ENTRY_VIEW_COL_ALBUM), FALSE);
diff --git a/plugins/brasero-disc-recorder/rb-disc-recorder-plugin.c b/plugins/brasero-disc-recorder/rb-disc-recorder-plugin.c
index 3998e1f..62a10e7 100644
--- a/plugins/brasero-disc-recorder/rb-disc-recorder-plugin.c
+++ b/plugins/brasero-disc-recorder/rb-disc-recorder-plugin.c
@@ -159,6 +159,7 @@ rb_disc_recorder_plugin_start_burning (RBDiscRecorderPlugin *pi,
 {
 	GtkWidget *main_window;
 	GdkScreen *screen;
+	GdkWindow *window;
 	GPtrArray *array;
 	char **args, *xid_str;
 	GError *error = NULL;
@@ -174,9 +175,10 @@ rb_disc_recorder_plugin_start_burning (RBDiscRecorderPlugin *pi,
 
 	main_window = gtk_widget_get_toplevel (GTK_WIDGET (pi->selected_source));
 	screen = gtk_widget_get_screen (main_window);
-	if (main_window && main_window->window) {
+	window = gtk_widget_get_window (main_window);
+	if (window) {
 		int xid;
-		xid = gdk_x11_drawable_get_xid (GDK_DRAWABLE (GTK_WIDGET (main_window)->window));
+		xid = gdk_x11_drawable_get_xid (GDK_DRAWABLE (window));
 		xid_str = g_strdup_printf ("%d", xid);
 		g_ptr_array_add (array, "-x");
 		g_ptr_array_add (array, xid_str);
diff --git a/plugins/power-manager/rb-power-manager-plugin.c b/plugins/power-manager/rb-power-manager-plugin.c
index b6912e9..5979b0b 100644
--- a/plugins/power-manager/rb-power-manager-plugin.c
+++ b/plugins/power-manager/rb-power-manager-plugin.c
@@ -187,7 +187,7 @@ inhibit (RBGPMPlugin *plugin)
 	rb_debug ("inhibiting");
 	g_object_ref (plugin);
 	g_object_get (plugin->shell, "window", &window, NULL);
-	xid = GDK_WINDOW_XWINDOW (GTK_WIDGET (window)->window);
+	xid = GDK_WINDOW_XWINDOW (gtk_widget_get_window (GTK_WIDGET (window)));
 	dbus_g_proxy_begin_call (plugin->proxy, "Inhibit",
 				 (DBusGProxyCallNotify) inhibit_cb,
 				 plugin,
diff --git a/plugins/status-icon/rb-status-icon-plugin.c b/plugins/status-icon/rb-status-icon-plugin.c
index bc6f59f..85e69f1 100644
--- a/plugins/status-icon/rb-status-icon-plugin.c
+++ b/plugins/status-icon/rb-status-icon-plugin.c
@@ -978,7 +978,7 @@ close_to_tray (RBStatusIconPlugin *plugin)
 	/* set the window's icon geometry to match the icon */
 	rb_tray_icon_get_geom (plugin->priv->tray_icon,
 			       &x, &y, &width, &height);
-	if (GTK_WIDGET_REALIZED (window))
+	if (gtk_widget_get_realized (GTK_WIDGET (window)))
 		set_icon_geometry (gtk_widget_get_window (GTK_WIDGET (window)),
 				   x, y, width, height);
 
diff --git a/plugins/visualizer/rb-vis-widget.c b/plugins/visualizer/rb-vis-widget.c
index 746a19e..0835f6a 100644
--- a/plugins/visualizer/rb-vis-widget.c
+++ b/plugins/visualizer/rb-vis-widget.c
@@ -94,7 +94,7 @@ rb_vis_widget_realize (GtkWidget *widget)
 	gtk_widget_set_style (widget, style);
 	gtk_style_set_background (style, window, GTK_STATE_NORMAL);
 
-	GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+	gtk_widget_set_realized (widget, TRUE);
 }
 
 static void
@@ -104,7 +104,7 @@ rb_vis_widget_size_allocate (GtkWidget *widget,
 	RBVisWidget *rbvw = RB_VIS_WIDGET (widget);
 	gtk_widget_set_allocation (widget, allocation);
 
-	if (!GTK_WIDGET_REALIZED (widget))
+	if (!gtk_widget_get_realized (widget))
 		return;
 
 	rb_debug ("handling size allocate event ([%d,%d] - [%d,%d])",
diff --git a/plugins/visualizer/rb-visualizer-plugin.c b/plugins/visualizer/rb-visualizer-plugin.c
index c9b3847..86cfa01 100644
--- a/plugins/visualizer/rb-visualizer-plugin.c
+++ b/plugins/visualizer/rb-visualizer-plugin.c
@@ -824,7 +824,7 @@ actually_hide_controls (RBVisualizerPlugin *plugin)
 		 */
 		gtk_widget_grab_focus (plugin->vis_widget);
 
-		if (GTK_WIDGET_REALIZED (plugin->vis_widget)) {
+		if (gtk_widget_get_realized (plugin->vis_widget)) {
 			GdkWindow *window;
 			GdkCursor *cursor;
 
@@ -886,7 +886,7 @@ show_controls (RBVisualizerPlugin *plugin, gboolean play_controls_only)
 		case FULLSCREEN:
 			gtk_widget_show (plugin->play_control_widget);
 			gtk_widget_show (plugin->disable_button);
-			if (GTK_WIDGET_REALIZED (plugin->vis_widget)) {
+			if (gtk_widget_get_realized (plugin->vis_widget)) {
 				gdk_window_set_cursor (gtk_widget_get_window (plugin->vis_widget),
 						       NULL);
 			}
@@ -1024,7 +1024,7 @@ resize_vis_window (RBVisualizerPlugin *plugin, int quality, gboolean resize_down
 	float ratio;
 	gboolean update = FALSE;
 
-	if (GTK_WIDGET_REALIZED (plugin->vis_window) == FALSE) {
+	if (gtk_widget_get_realized (plugin->vis_window) == FALSE) {
 		rb_debug ("window isn't realized yet; trying in size-request instead");
 		if (plugin->vis_window_size_request_id == 0) {
 			plugin->vis_window_size_request_id =
diff --git a/shell/rb-missing-plugins.c b/shell/rb-missing-plugins.c
index 44fc33e..9526437 100644
--- a/shell/rb-missing-plugins.c
+++ b/shell/rb-missing-plugins.c
@@ -208,7 +208,7 @@ missing_plugins_event (RBShell *shell, RBPluginInstallContext *ctx)
 	install_ctx = gst_install_plugins_context_new ();
 
 	g_object_get (shell, "window", &window, NULL);
-	if (window != NULL && GTK_WIDGET_REALIZED (window)) {
+	if (gtk_widget_get_realized (GTK_WIDGET (window))) {
 #ifdef GDK_WINDOWING_X11
 		gulong xid = 0;
 		xid = gdk_x11_drawable_get_xid (gtk_widget_get_window (GTK_WIDGET (window)));
diff --git a/shell/rb-shell.c b/shell/rb-shell.c
index 6774774..9469429 100644
--- a/shell/rb-shell.c
+++ b/shell/rb-shell.c
@@ -1637,7 +1637,7 @@ rb_shell_get_visibility (RBShell *shell)
 {
 	GdkWindowState state;
 
-	if (!GTK_WIDGET_REALIZED (shell->priv->window))
+	if (!gtk_widget_get_realized (shell->priv->window))
 		return FALSE;
 	if (shell->priv->iconified)
 		return FALSE;
@@ -1673,7 +1673,7 @@ rb_shell_set_visibility (RBShell *shell,
 		gtk_widget_show (GTK_WIDGET (shell->priv->window));
 		gtk_window_deiconify (GTK_WINDOW (shell->priv->window));
 
-		if (GTK_WIDGET_REALIZED (GTK_WIDGET (shell->priv->window)))
+		if (gtk_widget_get_realized (GTK_WIDGET (shell->priv->window)))
 			rb_shell_present (shell, gtk_get_current_event_time (), NULL);
 		else
 			gtk_widget_show_all (GTK_WIDGET (shell->priv->window));
diff --git a/widgets/rb-entry-view.c b/widgets/rb-entry-view.c
index ba59640..73a50c6 100644
--- a/widgets/rb-entry-view.c
+++ b/widgets/rb-entry-view.c
@@ -2310,7 +2310,7 @@ rb_entry_view_scroll_to_iter (RBEntryView *view,
 	 * view to the playing entry before the view has ever been displayed.
 	 * This will result in gtk+ warnings, so we avoid it in this case.
 	 */
-	if (!GTK_WIDGET_REALIZED (view))
+	if (!gtk_widget_get_realized (GTK_WIDGET (view)))
 		return;
 
 	path = gtk_tree_model_get_path (GTK_TREE_MODEL (view->priv->model), iter);
@@ -2382,7 +2382,7 @@ rb_entry_view_entry_is_visible (RBEntryView *view,
 
 	g_return_if_fail (entry != NULL);
 
-	if (!GTK_WIDGET_REALIZED (view))
+	if (!gtk_widget_get_realized (GTK_WIDGET (view)))
 		return;
 
 	*realized = TRUE;
diff --git a/widgets/rb-rating.c b/widgets/rb-rating.c
index 391a142..88f00c8 100644
--- a/widgets/rb-rating.c
+++ b/widgets/rb-rating.c
@@ -309,7 +309,7 @@ rb_rating_realize (GtkWidget *widget)
 	GdkWindow *window;
 	int attributes_mask;
 
-	GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+	gtk_widget_set_realized (widget, TRUE);
 
 	gtk_widget_get_allocation (widget, &allocation);
 
diff --git a/widgets/rb-segmented-bar.c b/widgets/rb-segmented-bar.c
index 0385f75..c9a9a6e 100644
--- a/widgets/rb-segmented-bar.c
+++ b/widgets/rb-segmented-bar.c
@@ -135,7 +135,7 @@ rb_segmented_bar_init (RBSegmentedBar *bar)
 	priv->segment_box_size = 12;
 	priv->segment_box_spacing = 6;
 	priv->value_formatter = rb_segmented_bar_default_value_formatter;
-	GTK_WIDGET_SET_FLAGS (GTK_WIDGET (bar), GTK_NO_WINDOW);
+	gtk_widget_set_has_window (GTK_WIDGET (bar), FALSE);
 }
 
 static void
@@ -389,6 +389,7 @@ rb_segmented_bar_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
 { 
 	gint real_height;
 	RBSegmentedBarPrivate *priv = RB_SEGMENTED_BAR_GET_PRIVATE (widget);
+	GtkAllocation new_allocation;
 
 	g_return_if_fail(RB_IS_SEGMENTED_BAR(widget)); 
 	g_return_if_fail(allocation != NULL); 
@@ -398,15 +399,16 @@ rb_segmented_bar_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
 	} else {
 		real_height = priv->bar_height;
 	}
-	widget->allocation = *allocation; 
+	gtk_widget_set_allocation (widget, allocation);
 	if (priv->show_labels) {
 		compute_layout_size (RB_SEGMENTED_BAR (widget));
-		widget->allocation.height = MAX (priv->bar_height + priv->bar_label_spacing + priv->layout_height,
-						 real_height);
+		new_allocation.height = MAX (priv->bar_height + priv->bar_label_spacing + priv->layout_height,
+		                         real_height);
 	} else {
-		widget->allocation.height = real_height;
+		new_allocation.height = real_height;
 	}
-	widget->allocation.width = priv->layout_width + 2*(priv->h_padding);
+	new_allocation.width = priv->layout_width + 2*(priv->h_padding);
+	gtk_widget_set_allocation (widget, &new_allocation);
 	GTK_WIDGET_CLASS(rb_segmented_bar_parent_class)->size_allocate(widget, allocation); 
 }
 
@@ -643,6 +645,7 @@ static void rb_segmented_bar_render_labels (RBSegmentedBar *bar,
 					    cairo_t *context)
 {
 	RBSegmentedBarPrivate *priv;
+	GtkStyle *style;
 	PangoLayout *layout;
 	Color text_color;
 	GdkColor *gdk_color;
@@ -654,7 +657,8 @@ static void rb_segmented_bar_render_labels (RBSegmentedBar *bar,
 	if (priv->segments == NULL) {
 		return;
 	}
-	gdk_color = &GTK_WIDGET (bar)->style->fg[GTK_WIDGET_STATE (GTK_WIDGET (bar))];
+	style = gtk_widget_get_style (GTK_WIDGET (bar));
+	gdk_color = &style->fg[gtk_widget_get_state (GTK_WIDGET (bar))];
 	text_color.red = gdk_color->red / 65535.0;
 	text_color.green = gdk_color->green / 65535.0;
 	text_color.blue = gdk_color->blue / 65535.0;
@@ -724,33 +728,34 @@ rb_segmented_bar_expose (GtkWidget *widget,
 {
 	RBSegmentedBar *bar;
 	RBSegmentedBarPrivate *priv;
+	GtkAllocation allocation;
 	cairo_t *context;
 	cairo_pattern_t *bar_pattern;
 
 	g_return_val_if_fail (RB_IS_SEGMENTED_BAR (widget), FALSE);
-	if (GTK_WIDGET_DRAWABLE (widget) == FALSE) {
+	if (gtk_widget_is_drawable (widget) == FALSE) {
 		return FALSE;
 	}
 
 	bar = RB_SEGMENTED_BAR (widget);
 	priv = RB_SEGMENTED_BAR_GET_PRIVATE (bar);
 
-	context = gdk_cairo_create (GDK_DRAWABLE (widget->window));
+	context = gdk_cairo_create (GDK_DRAWABLE (gtk_widget_get_window (widget)));
 	
 	if (priv->reflect) {
 		cairo_push_group (context);
 	}
 
 	cairo_set_operator (context, CAIRO_OPERATOR_OVER);
-	cairo_translate (context, widget->allocation.x + priv->h_padding,
-			 widget->allocation.y);
+	gtk_widget_get_allocation (widget, &allocation);
+	cairo_translate (context, allocation.x + priv->h_padding, allocation.y);
 	cairo_rectangle (context, 0, 0,
-			 widget->allocation.width - priv->h_padding,
+			 allocation.width - priv->h_padding,
 			 MAX (2*priv->bar_height, priv->bar_height + priv->bar_label_spacing + priv->layout_height));
 	cairo_clip (context);
 
 	bar_pattern = rb_segmented_bar_render (bar, 
-					       widget->allocation.width - 2*priv->h_padding,
+					       allocation.width - 2*priv->h_padding,
 					       priv->bar_height);
 
 	cairo_save (context);
@@ -765,7 +770,7 @@ rb_segmented_bar_expose (GtkWidget *widget,
 		cairo_save (context);
 
 		cairo_rectangle (context, 0, priv->bar_height,
-				 widget->allocation.width - priv->h_padding,
+				 allocation.width - priv->h_padding,
 				 priv->bar_height);
 		cairo_clip (context);
 		cairo_matrix_init_scale (&matrix, 1, -1);
@@ -792,11 +797,11 @@ rb_segmented_bar_expose (GtkWidget *widget,
 	if (priv->show_labels) {
 		if (priv->reflect) {
 			cairo_translate (context,
-					 widget->allocation.x + (widget->allocation.width - priv->layout_width)/2,
-					 widget->allocation.y + priv->bar_height + priv->bar_label_spacing);
+					 allocation.x + (allocation.width - priv->layout_width)/2,
+					 allocation.y + priv->bar_height + priv->bar_label_spacing);
 		} else {
 			cairo_translate (context,
-					 -priv->h_padding + (widget->allocation.width - priv->layout_width)/2,
+					 -priv->h_padding + (allocation.width - priv->layout_width)/2,
 					 priv->bar_height + priv->bar_label_spacing);
 		}
 		rb_segmented_bar_render_labels (bar, context);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]