[Xfce4-commits] <ristretto:ristretto-0.0> Improve positioning of the thumbnails
Stephan Arts
noreply at xfce.org
Sun Oct 23 19:17:50 CEST 2011
Updating branch refs/heads/ristretto-0.0
to dd00ffe411a25a8655cb4ee92d60b99edbd96445 (commit)
from 8bb5f1ca12914363b49a947867ef905d45045640 (commit)
commit dd00ffe411a25a8655cb4ee92d60b99edbd96445
Author: Stephan Arts <stephan at xfce.org>
Date: Sun Jun 7 10:49:11 2009 +0200
Improve positioning of the thumbnails
src/thumbnail.c | 29 ++++++++++++++++++++++-------
src/thumbnail_bar.c | 6 +++---
2 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/src/thumbnail.c b/src/thumbnail.c
index 04f5cd2..910a72d 100644
--- a/src/thumbnail.c
+++ b/src/thumbnail.c
@@ -169,7 +169,6 @@ rstto_thumbnail_expose(GtkWidget *widget, GdkEventExpose *event)
if (thumb->priv->image)
{
thumb_pixbuf = rstto_image_get_thumbnail (thumb->priv->image);
- g_object_ref (thumb_pixbuf);
}
if (thumb_pixbuf == NULL)
@@ -180,11 +179,15 @@ rstto_thumbnail_expose(GtkWidget *widget, GdkEventExpose *event)
0,
NULL);
}
+ else
+ {
+ g_object_ref (thumb_pixbuf);
+ }
if (thumb_pixbuf)
{
- guint height = gdk_pixbuf_get_height (thumb->priv->pixbuf);
- guint width = gdk_pixbuf_get_width (thumb->priv->pixbuf);
+ guint height = gdk_pixbuf_get_height (thumb->priv->pixbuf) - 10;
+ guint width = gdk_pixbuf_get_width (thumb->priv->pixbuf) - 10;
if (gdk_pixbuf_get_width (thumb_pixbuf) > gdk_pixbuf_get_height (thumb_pixbuf))
{
@@ -197,9 +200,9 @@ rstto_thumbnail_expose(GtkWidget *widget, GdkEventExpose *event)
gdk_pixbuf_fill (thumb->priv->pixbuf, 0x00000000);
gdk_pixbuf_scale (thumb_pixbuf, thumb->priv->pixbuf,
- ((widget->allocation.width - width) / 2)+2, ((widget->allocation.height - height) / 2)+2,
- width - 4,
- height - 4,
+ ((widget->allocation.width - width) / 2), ((widget->allocation.height - height) / 2),
+ width,
+ height,
0, 0,
(gdouble)width / ((gdouble)gdk_pixbuf_get_width (thumb_pixbuf)),
(gdouble)height / ((gdouble)gdk_pixbuf_get_height (thumb_pixbuf)),
@@ -234,7 +237,7 @@ rstto_thumbnail_paint(RsttoThumbnail *thumb)
gtk_paint_box(widget->style,
widget->window,
state,
- state == GTK_STATE_PRELIGHT?GTK_SHADOW_OUT:GTK_SHADOW_IN,
+ GTK_SHADOW_ETCHED_IN,
NULL,
widget,
NULL,
@@ -253,6 +256,18 @@ rstto_thumbnail_paint(RsttoThumbnail *thumb)
GDK_RGB_DITHER_NORMAL,
0, 0);
}
+
+ /*
+ gtk_paint_focus (widget->style,
+ widget->window,
+ state,
+ NULL,
+ widget,
+ NULL,
+ widget->allocation.x+3, widget->allocation.y+3,
+ widget->allocation.width-6, widget->allocation.height-6);
+ */
+
}
}
diff --git a/src/thumbnail_bar.c b/src/thumbnail_bar.c
index f53f4dd..8b74f9f 100644
--- a/src/thumbnail_bar.c
+++ b/src/thumbnail_bar.c
@@ -275,7 +275,7 @@ rstto_thumbnail_bar_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
{
gtk_widget_get_child_requisition(GTK_WIDGET(iter->data), &child_requisition);
child_allocation.height = allocation->height - (border_width * 2);
- child_allocation.width = child_requisition.width;
+ child_allocation.width = child_allocation.height;
if ((child_allocation.x < (allocation->x + allocation->width)) &&
((child_allocation.x + child_allocation.width) > allocation->x + border_width))
@@ -286,7 +286,7 @@ rstto_thumbnail_bar_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
else
gtk_widget_set_child_visible(GTK_WIDGET(iter->data), FALSE);
- child_allocation.x += child_requisition.width + spacing;
+ child_allocation.x += child_allocation.width + spacing;
iter = g_list_next(iter);
}
break;
@@ -324,7 +324,7 @@ rstto_thumbnail_bar_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
gtk_widget_set_child_visible(GTK_WIDGET(iter->data), FALSE);
gtk_widget_size_allocate(GTK_WIDGET(iter->data), &child_allocation);
- child_allocation.y += child_requisition.height + spacing;
+ child_allocation.y += child_allocation.height + spacing;
iter = g_list_next(iter);
}
break;
More information about the Xfce4-commits
mailing list