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