Re: [Planner Dev] Gannt patch version 2



fmoraes nc rr com wrote:
Can someone try my latest patch for bug 128983? It uses expose only once
after the project has been loaded and it seems to work fine like this.
Anothing thing that needs trying is to change themes to see if it still
stays aligned.
Here's the patch just in case:

Index: planner-gantt-view.c
===================================================================
RCS file: /cvs/gnome/planner/src/planner-gantt-view.c,v
retrieving revision 1.28
diff -u -r1.28 planner-gantt-view.c
--- planner-gantt-view.c	23 Apr 2005 10:33:09 -0000	1.28
+++ planner-gantt-view.c	7 Apr 2006 02:24:51 -0000
@@ -49,6 +49,7 @@
	GtkUIManager          *ui_manager;
	GtkActionGroup        *actions;
	guint                  merged_id;
+	gulong                 expose_id;
};

static GtkWidget *   gantt_view_create_widget             (PlannerGanttView  *view);
@@ -86,6 +87,9 @@
							   gpointer           data);
static void          gantt_view_edit_columns_cb           (GtkAction         *action,
							   gpointer           data);
+static gboolean      gantt_view_expose_cb                 (GtkWidget         *widget,
+							   GdkEventExpose    *event,
+							   gpointer           user_data);
static void          gantt_view_update_row_height         (PlannerGanttView  *view);
static void          gantt_view_tree_style_set_cb         (GtkWidget         *tree,
							   GtkStyle          *prev_style,
@@ -404,7 +408,7 @@
			      PlannerGanttView *view)
{
	GtkTreeModel *model;
-
+	
	model = GTK_TREE_MODEL (planner_gantt_model_new (project));

	planner_task_tree_set_model (PLANNER_TASK_TREE (view->priv->tree),
@@ -412,7 +416,12 @@
	
	planner_gantt_chart_set_model (PLANNER_GANTT_CHART (view->priv->gantt),
				       model);
-	
+
+	view->priv->expose_id = g_signal_connect_after (view->priv->tree,
+							"expose_event",
+							G_CALLBACK (gantt_view_expose_cb),
+							view);
+
	g_object_unref (model);
}

@@ -853,12 +862,16 @@
	GList             *cols, *l;
	GtkTreeViewColumn *col;
	GtkRequisition     req;
+	GtkTreePath       *path;
+	GdkRectangle       rect;

	/* Get the row and header heights. */
	cols = gtk_tree_view_get_columns (tv);
	row_height = 0;
	header_height = 0;

+	path = gtk_tree_path_new_first ();
+
	for (l = cols; l; l = l->next) {
		col = l->data;

@@ -872,13 +885,37 @@
						    NULL,
						    &height);
		row_height = MAX (row_height, height);
+		
+		gtk_tree_view_get_background_area (tv,
+						   path,
+						   col,
+						   &rect);
+
+		row_height = MAX (row_height, rect.height);
	}
+	if (path)
+		gtk_tree_path_free (path);

	/* Sync with the gantt widget. */
	g_object_set (gantt,
		      "header_height", header_height,
		      "row_height", row_height,
		      NULL);
+}
+
+static gboolean
+gantt_view_expose_cb (GtkWidget      *widget,
+		      GdkEventExpose *event,
+		      gpointer        data)
+{
+	PlannerGanttView     *view = PLANNER_GANTT_VIEW (data);
+
+	gantt_view_update_row_height (view);
+
+	g_signal_handler_disconnect (view->priv->tree,
+				     view->priv->expose_id);
+	
+	return FALSE;
}

static gboolean





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