[evolution] Bug 602416 - Changing shell views emits many runtime warnings



commit 0cc56c014f68be35e3ac12ccc500ee3528cceea0
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Feb 6 20:48:27 2010 -0500

    Bug 602416 - Changing shell views emits many runtime warnings

 widgets/misc/e-calendar.c            |    3 +--
 widgets/table/e-table-click-to-add.c |    4 ++++
 widgets/table/e-table.c              |   22 ++++++++++++++++------
 widgets/table/e-table.h              |    1 +
 4 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/widgets/misc/e-calendar.c b/widgets/misc/e-calendar.c
index 384d4ce..9673db8 100644
--- a/widgets/misc/e-calendar.c
+++ b/widgets/misc/e-calendar.c
@@ -267,8 +267,7 @@ e_calendar_style_set		(GtkWidget	*widget,
 
 	/* Set the background of the canvas window to the normal color,
 	   or the arrow buttons are not displayed properly. */
-	parent = gtk_widget_get_parent (widget);
-	if (GTK_WIDGET_REALIZED (parent)) {
+	if (GTK_WIDGET_REALIZED (widget)) {
 		GtkStyle *style;
 		GdkWindow *window;
 
diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c
index e5c35fe..944e1dd 100644
--- a/widgets/table/e-table-click-to-add.c
+++ b/widgets/table/e-table-click-to-add.c
@@ -570,6 +570,10 @@ etcta_init (ETableClickToAdd *etcta)
 	etcta->text = NULL;
 	etcta->rect = NULL;
 
+	/* Pick some arbitrary defaults. */
+	etcta->width = 12;
+	etcta->height = 6;
+
 	etcta->selection = e_table_selection_model_new();
 	g_signal_connect(etcta->selection, "cursor_changed",
 			 G_CALLBACK (etcta_cursor_change), etcta);
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 14b3707..8d2f195 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -734,6 +734,8 @@ table_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc,
 	if (e_table->reflow_idle_id)
 		g_source_remove(e_table->reflow_idle_id);
 	table_canvas_reflow_idle(e_table);
+
+	e_table->size_allocated = TRUE;
 }
 
 static void
@@ -992,16 +994,24 @@ changed_idle (gpointer data)
 {
 	ETable *et = E_TABLE (data);
 
-	if (et->need_rebuild) {
+	/* Wait until we have a valid size allocation. */
+	if (et->need_rebuild && et->size_allocated) {
+		GtkWidget *widget;
+		GtkAllocation allocation;
+
 		if (et->group)
 			gtk_object_destroy (GTK_OBJECT (et->group));
 		et_build_groups(et);
-		g_object_set (et->canvas_vbox,
-			      "width", (gdouble) GTK_WIDGET (et->table_canvas)->allocation.width,
-			      NULL);
 
-		if (GTK_WIDGET_REALIZED(et->table_canvas))
-			table_canvas_size_allocate (GTK_WIDGET(et->table_canvas), &GTK_WIDGET(et->table_canvas)->allocation, et);
+		widget = GTK_WIDGET (et->table_canvas);
+		gtk_widget_get_allocation (widget, &allocation);
+
+		g_object_set (
+			et->canvas_vbox,
+			"width", (gdouble) allocation.width,
+			NULL);
+
+		table_canvas_size_allocate (widget, &allocation, et);
 	}
 
 	et->need_rebuild = 0;
diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h
index bb82ef1..e1537ba 100644
--- a/widgets/table/e-table.h
+++ b/widgets/table/e-table.h
@@ -106,6 +106,7 @@ typedef struct {
 
 	gint rebuild_idle_id;
 	guint need_rebuild:1;
+	guint size_allocated:1;
 
 	/*
 	 * Configuration settings



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