ca7c822
diff -ru planner-0.14.4.orig/data/glade/add-predecessor.glade planner-0.14.4/data/glade/add-predecessor.glade
33b94e4
--- planner-0.14.4.orig/data/glade/add-predecessor.glade	2010-01-25 10:27:21.000000000 +0000
33b94e4
+++ planner-0.14.4/data/glade/add-predecessor.glade	2010-01-25 09:46:24.000000000 +0000
ca7c822
@@ -88,7 +88,6 @@
ca7c822
 	      <property name="yalign">0.5</property>
ca7c822
 	      <property name="xpad">0</property>
ca7c822
 	      <property name="ypad">0</property>
ca7c822
-	      <property name="mnemonic_widget">combo-entry1</property>
ca7c822
 	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
ca7c822
 	      <property name="width_chars">-1</property>
ca7c822
 	      <property name="single_line_mode">False</property>
ca7c822
@@ -162,6 +161,7 @@
ca7c822
 	      <property name="yalign">0.5</property>
ca7c822
 	      <property name="xpad">0</property>
ca7c822
 	      <property name="ypad">0</property>
ca7c822
+	      <property name="mnemonic_widget">lag_entry</property>
ca7c822
 	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
ca7c822
 	      <property name="width_chars">-1</property>
ca7c822
 	      <property name="single_line_mode">False</property>
ca7c822
@@ -178,45 +178,6 @@
ca7c822
 	  </child>
ca7c822
 
ca7c822
 	  <child>
ca7c822
-	    <widget class="GtkCombo" id="predecessor_combo">
ca7c822
-	      <property name="visible">True</property>
ca7c822
-	      <property name="value_in_list">False</property>
ca7c822
-	      <property name="allow_empty">True</property>
ca7c822
-	      <property name="case_sensitive">False</property>
ca7c822
-	      <property name="enable_arrow_keys">True</property>
ca7c822
-	      <property name="enable_arrows_always">False</property>
ca7c822
-
ca7c822
-	      <child internal-child="entry">
ca7c822
-		<widget class="GtkEntry" id="combo-entry1">
ca7c822
-		  <property name="visible">True</property>
ca7c822
-		  <property name="can_focus">True</property>
ca7c822
-		  <property name="editable">True</property>
ca7c822
-		  <property name="visibility">True</property>
ca7c822
-		  <property name="max_length">0</property>
ca7c822
-		  <property name="text" translatable="yes"></property>
ca7c822
-		  <property name="has_frame">True</property>
ca7c822
-		  <property name="invisible_char">*</property>
ca7c822
-		  <property name="activates_default">True</property>
ca7c822
-		</widget>
ca7c822
-	      </child>
ca7c822
-
ca7c822
-	      <child internal-child="list">
ca7c822
-		<widget class="GtkList" id="combo-list1">
ca7c822
-		  <property name="visible">True</property>
ca7c822
-		  <property name="selection_mode">GTK_SELECTION_BROWSE</property>
ca7c822
-		</widget>
ca7c822
-	      </child>
ca7c822
-	    </widget>
ca7c822
-	    <packing>
ca7c822
-	      <property name="left_attach">1</property>
ca7c822
-	      <property name="right_attach">2</property>
ca7c822
-	      <property name="top_attach">0</property>
ca7c822
-	      <property name="bottom_attach">1</property>
ca7c822
-	      <property name="y_options"></property>
ca7c822
-	    </packing>
ca7c822
-	  </child>
ca7c822
-
ca7c822
-	  <child>
ca7c822
 	    <widget class="GtkEntry" id="lag_entry">
ca7c822
 	      <property name="visible">True</property>
ca7c822
 	      <property name="can_focus">True</property>
ca7c822
@@ -236,6 +197,23 @@
ca7c822
 	      <property name="y_options"></property>
ca7c822
 	    </packing>
ca7c822
 	  </child>
ca7c822
+
ca7c822
+	  <child>
ca7c822
+	    <widget class="GtkComboBoxEntry" id="predecessor_combo">
ca7c822
+	      <property name="visible">True</property>
ca7c822
+	      <property name="add_tearoffs">False</property>
ca7c822
+	      <property name="has_frame">True</property>
ca7c822
+	      <property name="focus_on_click">True</property>
ca7c822
+	    </widget>
ca7c822
+	    <packing>
ca7c822
+	      <property name="left_attach">1</property>
ca7c822
+	      <property name="right_attach">2</property>
ca7c822
+	      <property name="top_attach">0</property>
ca7c822
+	      <property name="bottom_attach">1</property>
ca7c822
+	      <property name="x_options">fill</property>
ca7c822
+	      <property name="y_options">fill</property>
ca7c822
+	    </packing>
ca7c822
+	  </child>
ca7c822
 	</widget>
ca7c822
 	<packing>
ca7c822
 	  <property name="padding">0</property>
33b94e4
diff -ru planner-0.14.4.orig/src/planner-gantt-model.c planner-0.14.4/src/planner-gantt-model.c
33b94e4
--- planner-0.14.4.orig/src/planner-gantt-model.c	2010-01-25 09:50:30.000000000 +0000
33b94e4
+++ planner-0.14.4/src/planner-gantt-model.c	2010-01-25 10:14:59.000000000 +0000
33b94e4
@@ -1139,28 +1139,12 @@
33b94e4
 	return sibling->data;
33b94e4
 }
33b94e4
 
33b94e4
-static const gchar *
33b94e4
-value_cache_get_wbs (PlannerGanttModel *model,
33b94e4
-		     MrpTask           *task)
33b94e4
+gchar *get_wbs_from_task(MrpTask *task)
33b94e4
 {
33b94e4
-	ValueCache *cache;
33b94e4
-	MrpTask    *tmp_task;
33b94e4
+	gint        pos;
33b94e4
 	gchar      *str;
33b94e4
+	MrpTask    *tmp_task;
33b94e4
 	GString    *string;
33b94e4
-	gint        pos;
33b94e4
-
33b94e4
-	cache = value_cache_get (model, task);
33b94e4
-	if (!cache->wbs) {
33b94e4
-		goto update_cache;
33b94e4
-	}
33b94e4
-	
33b94e4
-	if (cache->wbs_stamp != model->priv->wbs_stamp) {
33b94e4
-		goto update_cache;
33b94e4
-	}
33b94e4
-
33b94e4
-	return cache->wbs;
33b94e4
-	
33b94e4
- update_cache:
33b94e4
 	string = g_string_sized_new (24);
33b94e4
 
33b94e4
 	pos = -1;
33b94e4
@@ -1182,10 +1166,29 @@
33b94e4
 		if (mrp_task_get_parent (tmp_task) == NULL)
33b94e4
 			break;
33b94e4
 	}
33b94e4
+        return g_string_free (string, FALSE);
33b94e4
+}
33b94e4
 
33b94e4
-	g_free (cache->wbs);
33b94e4
+static const gchar *
33b94e4
+value_cache_get_wbs (PlannerGanttModel *model,
33b94e4
+		     MrpTask           *task)
33b94e4
+{
33b94e4
+	ValueCache *cache;
33b94e4
+
33b94e4
+	cache = value_cache_get (model, task);
33b94e4
+	if (!cache->wbs) {
33b94e4
+		goto update_cache;
33b94e4
+	}
33b94e4
+	
33b94e4
+	if (cache->wbs_stamp != model->priv->wbs_stamp) {
33b94e4
+		goto update_cache;
33b94e4
+	}
33b94e4
 
33b94e4
-	cache->wbs = g_string_free (string, FALSE);
33b94e4
+	return cache->wbs;
33b94e4
+	
33b94e4
+ update_cache:
33b94e4
+	g_free (cache->wbs);
33b94e4
+	cache->wbs = get_wbs_from_task(task);
33b94e4
 	cache->wbs_stamp = model->priv->wbs_stamp;
33b94e4
 	
33b94e4
 	return cache->wbs;
ca7c822
diff -ru planner-0.14.4.orig/src/planner-task-dialog.c planner-0.14.4/src/planner-task-dialog.c
33b94e4
--- planner-0.14.4.orig/src/planner-task-dialog.c	2010-01-25 10:27:21.000000000 +0000
33b94e4
+++ planner-0.14.4/src/planner-task-dialog.c	2010-01-25 10:25:08.000000000 +0000
33b94e4
@@ -183,6 +183,7 @@
33b94e4
 								   GtkWidget               *dialog);
33b94e4
 static void            task_dialog_update_sensitivity             (DialogData              *data);
33b94e4
 static void            task_dialog_update_title                   (DialogData              *data);
33b94e4
+extern gchar *         get_wbs_from_task                          (MrpTask *task);
33b94e4
 
33b94e4
 
33b94e4
 
33b94e4
@@ -350,56 +351,56 @@
ca7c822
 #endif
ca7c822
 
ca7c822
 static void
ca7c822
-task_dialog_task_combo_select_child_cb (GtkList   *list,
ca7c822
-					GtkWidget *item,
ca7c822
-					GtkCombo  *combo)
ca7c822
-{
ca7c822
-	MrpTask *task;
ca7c822
-
ca7c822
-	task = g_object_get_data (G_OBJECT (item), "task");
ca7c822
-	g_object_set_data (G_OBJECT (combo), "selected_task", task);
ca7c822
-}
ca7c822
-
ca7c822
-static void
ca7c822
-task_dialog_setup_task_combo (GtkCombo *combo,
ca7c822
+task_dialog_setup_task_combo (GtkComboBoxEntry *combo,
ca7c822
 			      GList    *tasks)
ca7c822
 {
ca7c822
-	GList       *strings;
ca7c822
-	GList       *children;
ca7c822
-	GList       *l;
ca7c822
-	const gchar *name;
ca7c822
+	GtkListStore *store;
ca7c822
+	GtkTreeIter iter;
ca7c822
+	GtkCellRenderer *renderer;
ca7c822
+	GList        *l;
ca7c822
+	const gchar  *name;
ca7c822
 	
ca7c822
 	if (tasks == NULL) {
ca7c822
 		return;
ca7c822
 	}
ca7c822
 	
ca7c822
-	strings = NULL;
6d35314
+	store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
ca7c822
 	for (l = tasks; l; l = l->next) {
33b94e4
+		GString *scratch;
33b94e4
+		gchar *wbs;
33b94e4
+
ddc8ac9
+		gtk_list_store_append (store, &iter);
33b94e4
+		scratch = g_string_new( NULL);
33b94e4
+
33b94e4
+		wbs = get_wbs_from_task (l->data);
33b94e4
+		if (wbs != NULL && wbs[0] != 0)
33b94e4
+			g_string_append_printf (scratch, "%s ", wbs);
33b94e4
+		g_free(wbs);
33b94e4
+
ca7c822
 		name = mrp_task_get_name (l->data);
33b94e4
-		if (name == NULL || name[0] == 0) {
ca7c822
-			strings = g_list_prepend (strings,
ca7c822
-						  _("(No name)"));
33b94e4
+		if (name != NULL && name[0] != 0)
33b94e4
+			g_string_append (scratch, name);
33b94e4
+
33b94e4
+		if (scratch->len == 0) {
ca7c822
+			gtk_list_store_set (store, &iter,
6d35314
+			                    0, _("(No name)"),
6d35314
+			                    1, l->data,
6d35314
+			                    -1);
ca7c822
 		} else {
ca7c822
-			strings = g_list_prepend (strings, (gchar*) name);
ca7c822
+			gtk_list_store_set (store, &iter,
33b94e4
+			                    0, scratch->str,
6d35314
+			                    1, l->data,
6d35314
+			                    -1);
ca7c822
 		}
33b94e4
+		g_string_free(scratch, TRUE);
ca7c822
 	}
ca7c822
 
ca7c822
-	strings = g_list_reverse (strings);
ca7c822
-	gtk_combo_set_popdown_strings (combo, strings);
ca7c822
-	g_list_free (strings);
ca7c822
-	
ca7c822
-	g_object_set_data (G_OBJECT (combo), "selected_task", tasks->data);
ca7c822
-	
ca7c822
-	children = GTK_LIST (combo->list)->children;
ca7c822
-	for (l = children; l; l = l->next) {
ca7c822
-		g_object_set_data (G_OBJECT (l->data), "task", tasks->data);
ca7c822
-		tasks = tasks->next;
ca7c822
-	}
ca7c822
-	
ca7c822
-	g_signal_connect (combo->list,
ca7c822
-			  "select-child",
ca7c822
-			  G_CALLBACK (task_dialog_task_combo_select_child_cb),
ca7c822
-			  combo);
ca7c822
+	gtk_combo_box_set_model (GTK_COMBO_BOX (combo), 
6d35314
+	                         GTK_TREE_MODEL (store));
ca7c822
+
ca7c822
+	gtk_combo_box_entry_set_text_column (combo, 0);
ca7c822
+
ca7c822
+	gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
ca7c822
 }
ca7c822
 
ca7c822
 static gboolean
33b94e4
@@ -1906,7 +1907,7 @@
ca7c822
 	
ca7c822
 	tasks = mrp_project_get_all_tasks (project);
ca7c822
 	tasks = g_list_remove (tasks, task);
ca7c822
-	task_dialog_setup_task_combo (GTK_COMBO (w), tasks);
ca7c822
+	task_dialog_setup_task_combo (GTK_COMBO_BOX_ENTRY (w), tasks);
ca7c822
 	
ca7c822
 	w = glade_xml_get_widget (glade, "type_optionmenu");
ca7c822
 	g_object_set_data (G_OBJECT (dialog), "type_optionmenu", w);
33b94e4
@@ -1947,10 +1948,11 @@
ca7c822
 	GtkWidget     *w;
ca7c822
 	GError        *error = NULL;
ca7c822
 	MrpTask       *task_main;
ca7c822
-	MrpTask       *new_task_pred; 
ca7c822
+	MrpTask       *new_task_pred=NULL; 
ca7c822
 	MrpProject    *project; 
ca7c822
 	gint           lag;
ca7c822
 	gint           pred_type; 
ca7c822
+	GtkTreeIter    iter;
ca7c822
 	const gchar   *str;
ca7c822
 	
ca7c822
 	main_window = g_object_get_data (G_OBJECT (dialog), "main_window");
33b94e4
@@ -1970,7 +1972,11 @@
ca7c822
 	/* Predecessor task. */
ca7c822
 	w = g_object_get_data (G_OBJECT (dialog), "predecessor_combo");
ca7c822
 
ca7c822
-	new_task_pred = g_object_get_data (G_OBJECT (w), "selected_task");
ca7c822
+	if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (w), &iter)) {
ca7c822
+		gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (w)),
ca7c822
+				    &iter, 1, &new_task_pred, -1);
ca7c822
+	}
ca7c822
+
ca7c822
 	if (new_task_pred == NULL) {
ca7c822
 		g_warning (_("Can't add new predecessor. No task selected!"));
ca7c822
                 return;