summaryrefslogtreecommitdiff
path: root/test-display.c
diff options
context:
space:
mode:
authorDom Lachowicz <doml@src.gnome.org>2008-02-24 16:28:34 +0000
committerDom Lachowicz <doml@src.gnome.org>2008-02-24 16:28:34 +0000
commitbdef75012b011da92d4c534753abd1d872755d25 (patch)
tree893e020808fd16127d8b7d1ff3357533df4924b0 /test-display.c
parent68fa4f8c1f5ef457335cbc645144b0116ba7d755 (diff)
downloadlibrsvg-bdef75012b011da92d4c534753abd1d872755d25.tar.gz
bump version; adjust for frame borders
svn path=/trunk/; revision=1157
Diffstat (limited to 'test-display.c')
-rw-r--r--test-display.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/test-display.c b/test-display.c
index 9a30dc9f..60df032f 100644
--- a/test-display.c
+++ b/test-display.c
@@ -505,15 +505,24 @@ static void
populate_window (GtkWidget * win, ViewerCbInfo * info, int xid, gint win_width, gint win_height)
{
GtkWidget *vbox;
- GtkWidget *toolbar;
GtkWidget *scroll;
- GtkToolItem *toolitem;
gint img_width, img_height;
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (win), vbox);
+ /* create a new image */
+ info->image = gtk_image_new_from_pixbuf (info->pixbuf);
+
+ /* pack the window with the image */
+ img_width = gdk_pixbuf_get_width (info->pixbuf);
+ img_height = gdk_pixbuf_get_height (info->pixbuf);
+
if (xid <= 0) {
+ GtkWidget *toolbar;
+ GtkToolItem *toolitem;
+ GtkRequisition requisition;
+
toolbar = gtk_toolbar_new ();
gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, FALSE, 0);
@@ -524,14 +533,18 @@ populate_window (GtkWidget * win, ViewerCbInfo * info, int xid, gint win_width,
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_ZOOM_OUT);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, 1);
g_signal_connect (G_OBJECT (toolitem), "clicked", G_CALLBACK (zoom_out), info);
- }
- /* create a new image */
- info->image = gtk_image_new_from_pixbuf (info->pixbuf);
+ gtk_widget_size_request(toolbar, &requisition);
+
+ g_print("w: %d | h: %d\n", requisition.width, requisition.height);
+
+ /* HACK: adjust for frame width & height + packing borders */
+ img_height += requisition.height + 30;
+ win_height += requisition.height + 30;
+ img_width += 20;
+ win_width += 20;
+ }
- /* pack the window with the image */
- img_width = gdk_pixbuf_get_width (info->pixbuf);
- img_height = gdk_pixbuf_get_height (info->pixbuf);
if ((xid > 0 && (img_width > win_width || img_height > win_height))
|| (xid <= 0)) {
gtk_window_set_default_size (GTK_WINDOW (win), MIN (img_width, win_width),