diff options
author | Claudio Saavedra <csaavedra@igalia.com> | 2012-08-30 16:21:08 +0800 |
---|---|---|
committer | Claudio Saavedra <csaavedra@igalia.com> | 2012-09-01 02:34:02 +0800 |
commit | 2f7c4405bd300e90e7c46454473208bd486a69ab (patch) | |
tree | a3de4566fe3f805bfc837951c6ba0cf232474999 /lib | |
parent | 7263dad918cab2464f332cabfb7047bb5efc34a1 (diff) | |
download | gsoc2013-epiphany-2f7c4405bd300e90e7c46454473208bd486a69ab.tar gsoc2013-epiphany-2f7c4405bd300e90e7c46454473208bd486a69ab.tar.gz gsoc2013-epiphany-2f7c4405bd300e90e7c46454473208bd486a69ab.tar.bz2 gsoc2013-epiphany-2f7c4405bd300e90e7c46454473208bd486a69ab.tar.lz gsoc2013-epiphany-2f7c4405bd300e90e7c46454473208bd486a69ab.tar.xz gsoc2013-epiphany-2f7c4405bd300e90e7c46454473208bd486a69ab.tar.zst gsoc2013-epiphany-2f7c4405bd300e90e7c46454473208bd486a69ab.zip |
ephy-removable-pixbuf-renderer: use the pixbuf size to determine the position of the close x
Diffstat (limited to 'lib')
-rw-r--r-- | lib/widgets/ephy-removable-pixbuf-renderer.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/widgets/ephy-removable-pixbuf-renderer.c b/lib/widgets/ephy-removable-pixbuf-renderer.c index 48d8be0ff..8c113a0df 100644 --- a/lib/widgets/ephy-removable-pixbuf-renderer.c +++ b/lib/widgets/ephy-removable-pixbuf-renderer.c @@ -52,20 +52,32 @@ 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 = 0, h = 0; + 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); + if (pixbuf) { + w = gdk_pixbuf_get_width (pixbuf); + h = gdk_pixbuf_get_height (pixbuf); + g_object_unref (pixbuf); + } + + x_offset = (cell_area->width - w)/2 + 10; + y_offset = (cell_area->height - h)/2 + 9; + 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 + 5; + rectangle->y = cell_area->y + ypad + y_offset; rectangle->width = rectangle->height = icon_size; } |