[evolution-patches] fix for #51214 and #57211



This patch is a bit of a hack with a couple of magic numbers but I can't
find a public way to get the treeview header heights if the widget isn't
realized so I'm not sure there is a better way right now.  If the magic
numbers are off all that happens is a slight offset to it isn't too
severe.  The row height bit is correct.

--Larry
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2447
diff -u -p -r1.2447 ChangeLog
--- ChangeLog	16 Jul 2004 02:28:21 -0000	1.2447
+++ ChangeLog	17 Jul 2004 05:51:20 -0000
@@ -1,3 +1,9 @@
+2004-07-16  Larry Ewing  <lewing ximian com>
+
+	* gui/e-meeting-time-sel.c (e_meeting_time_selector_style_set):
+	fix the row heights and tweek the offsets so that things come out
+	OK.
+
 2004-07-14  JP Rosevear  <jpr novell com>
  
  	Fixes #61572
@@ -8676,4 +8682,4 @@
 	to double-check the event can be deleted.
 	(purging_query_done_cb, purging_eval_error_cb): needed callbacks to
 	finish the query.
-	(gnome_calendar_destroy): free new memb
\ No newline at end of file
+	(gnome_calendar_destroy): free new memb
Index: gui/e-meeting-time-sel.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-meeting-time-sel.c,v
retrieving revision 1.61
diff -u -p -r1.61 e-meeting-time-sel.c
--- gui/e-meeting-time-sel.c	23 Jun 2004 00:19:54 -0000	1.61
+++ gui/e-meeting-time-sel.c	17 Jul 2004 05:51:20 -0000
@@ -839,6 +839,20 @@ e_meeting_time_selector_unrealize (GtkWi
 		(*GTK_WIDGET_CLASS (parent_class)->unrealize)(widget);
 }
 
+static int
+get_cell_height (GtkTreeView *tree)
+{
+	GtkTreeViewColumn *column;
+	int height = -1;
+
+	column = gtk_tree_view_get_column (tree, 0);
+	gtk_tree_view_column_cell_get_size (column, NULL,
+					    NULL, NULL,
+					    NULL, &height);
+	
+	return height;
+}
+
 static void
 e_meeting_time_selector_style_set (GtkWidget *widget,
 				   GtkStyle  *previous_style)
@@ -878,7 +892,7 @@ e_meeting_time_selector_style_set (GtkWi
 		max_hour_width = MAX (max_hour_width, mts->hour_widths[hour]);
 	}
               
-	pango_layout_get_pixel_size (layout, NULL, &mts->row_height);
+	mts->row_height = get_cell_height (GTK_TREE_VIEW (mts->list_view));
 	mts->col_width = max_hour_width + 6;
 
 	e_meeting_time_selector_save_position (mts, &saved_time);
@@ -886,18 +900,20 @@ e_meeting_time_selector_style_set (GtkWi
 	e_meeting_time_selector_restore_position (mts, &saved_time);
               
 	gtk_widget_set_usize (mts->display_top, -1, mts->row_height * 3 + 4);
+ 
+	/*
+	 * FIXME: I can't find a way to get the treeview header heights
+	 * other than the below but it isn't nice to realize that widget here
+	 *
+
+	gtk_widget_realize (mts->list_view);
+	gdk_window_get_position (gtk_tree_view_get_bin_window (GTK_TREE_VIEW (mts->list_view)),
+				 NULL, &maxheight);
+	gtk_widget_set_usize (mts->attendees_vbox_spacer, 1, mts->row_height * 3 - maxheight);
 
-	/* Calculate header height */
-	if (GTK_WIDGET_REALIZED (mts->list_view)) {
-		path = gtk_tree_path_new ();
-		gtk_tree_path_append_index (path, 0);
-		gtk_tree_view_get_cell_area (GTK_TREE_VIEW (mts->list_view), path, NULL, &cell_area);
-		gtk_tree_path_free (path);
-		maxheight = cell_area.y;
-	} else 
-		maxheight = 10;
+	*/	
 
-	gtk_widget_set_usize (mts->attendees_vbox_spacer, 1, mts->row_height * 3 - maxheight);
+	gtk_widget_set_usize (mts->attendees_vbox_spacer, 1, mts->row_height * 2 - 4);
 
 	GTK_LAYOUT (mts->display_main)->hadjustment->step_increment = mts->col_width;
 	GTK_LAYOUT (mts->display_main)->vadjustment->step_increment = mts->row_height;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]