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 @@
0.5
0
0
- combo-entry1
PANGO_ELLIPSIZE_NONE
-1
False
@@ -162,6 +161,7 @@
0.5
0
0
+ lag_entry
PANGO_ELLIPSIZE_NONE
-1
False
@@ -178,45 +178,6 @@
-
- True
- False
- True
- False
- True
- False
-
-
-
- True
- True
- True
- True
- 0
-
- True
- *
- True
-
-
-
-
-
- True
- GTK_SELECTION_BROWSE
-
-
-
-
- 1
- 2
- 0
- 1
-
-
-
-
-
True
True
@@ -236,6 +197,23 @@
+
+
+
+ True
+ False
+ True
+ True
+
+
+ 1
+ 2
+ 0
+ 1
+ fill
+ fill
+
+
0
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;