[epiphany/in-tab-overview: 46/56] ephy-removable-pixbuf-renderer: use the pixbuf size to determine the position of the close x
- From: Xan Lopez <xan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/in-tab-overview: 46/56] ephy-removable-pixbuf-renderer: use the pixbuf size to determine the position of the close x
- Date: Fri, 31 Aug 2012 12:54:27 +0000 (UTC)
commit be0ee87c214ce9400789878b993bf8c323daaf61
Author: Claudio Saavedra <csaavedra igalia com>
Date: Thu Aug 30 12:36:18 2012 +0300
ephy-removable-pixbuf-renderer: use the pixbuf size to determine the position of the close x
This is cleaner than hardcoding it.
lib/widgets/ephy-removable-pixbuf-renderer.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/lib/widgets/ephy-removable-pixbuf-renderer.c b/lib/widgets/ephy-removable-pixbuf-renderer.c
index 8076439..8250356 100644
--- a/lib/widgets/ephy-removable-pixbuf-renderer.c
+++ b/lib/widgets/ephy-removable-pixbuf-renderer.c
@@ -52,20 +52,30 @@ get_icon_rectangle (GtkWidget *widget,
GdkRectangle *rectangle)
{
GtkTextDirection direction;
- gint x_offset, xpad, ypad;
+ gint x_offset, y_offset, xpad, ypad;
gint icon_size;
+ gint w, h;
+ GdkPixbuf *pixbuf;
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
direction = gtk_widget_get_direction (widget);
icon_size = gdk_pixbuf_get_width (icon);
+ g_object_get (cell, "pixbuf", &pixbuf, NULL);
+ w = gdk_pixbuf_get_width (pixbuf);
+ h = gdk_pixbuf_get_height (pixbuf);
+ g_object_unref (pixbuf);
+
+ x_offset = (cell_area->width - w)/2 + 5;
+ y_offset = (cell_area->height - h)/2 + 5;
+
if (direction == GTK_TEXT_DIR_RTL)
- x_offset = xpad + 10;
+ x_offset += xpad;
else
- x_offset = cell_area->width - icon_size - xpad - 10;
+ x_offset = cell_area->width - icon_size - xpad - x_offset;
rectangle->x = cell_area->x + x_offset;
- rectangle->y = cell_area->y + ypad + 15;
+ rectangle->y = cell_area->y + ypad + y_offset;
rectangle->width = rectangle->height = icon_size;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]