changeset 1366:ff3cd67235af

make the exif pane grow-only - this reduces sidebar jumping
author nadvornik
date Sun, 01 Mar 2009 21:35:18 +0000
parents 249bf204004a
children fe4da037be21
files src/bar_exif.c
diffstat 1 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/bar_exif.c	Sun Mar 01 21:06:55 2009 +0000
+++ b/src/bar_exif.c	Sun Mar 01 21:35:18 2009 +0000
@@ -26,6 +26,7 @@
 
 #include <math.h>
 
+#define MIN_HEIGHT 25
 /*
  *-------------------------------------------------------------------
  * EXIF widget
@@ -54,6 +55,8 @@
 	GtkWidget *widget;
 	GtkSizeGroup *size_group;
 
+	gint min_height;
+	
 	FileData *fd;
 };
 
@@ -257,6 +260,21 @@
 	g_free(ped);
 }
 
+static void bar_pane_exif_size_request(GtkWidget *pane, GtkRequisition *requisition, gpointer data)
+{
+	PaneExifData *ped = data;
+	if (requisition->height < ped->min_height)
+		{
+		requisition->height = ped->min_height;
+		}
+}
+
+static void bar_pane_exif_size_allocate(GtkWidget *pane, GtkAllocation *alloc, gpointer data)
+{
+	PaneExifData *ped = data;
+	ped->min_height = alloc->height;
+}
+
 GtkWidget *bar_pane_exif_new(const gchar *title, gboolean expanded, gboolean populate)
 {
 	PaneExifData *ped;
@@ -271,10 +289,14 @@
 	ped->size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
 	ped->vbox = gtk_vbox_new(FALSE, PREF_PAD_GAP);
 	ped->widget = ped->vbox;
+	ped->min_height = MIN_HEIGHT;
 	g_object_set_data(G_OBJECT(ped->widget), "pane_data", ped);
 	g_signal_connect_after(G_OBJECT(ped->widget), "destroy",
 			       G_CALLBACK(bar_pane_exif_destroy), ped);
-
+	g_signal_connect(G_OBJECT(ped->widget), "size-request",
+			 G_CALLBACK(bar_pane_exif_size_request), ped);
+	g_signal_connect(G_OBJECT(ped->widget), "size-allocate",
+			 G_CALLBACK(bar_pane_exif_size_allocate), ped);
 
 	if (populate)
 		{