Re: predecessor task list with simple text hierarchy
"ビカス ヤダワ (v ikas yadav)" <[email protected]> Tue, 16 Dec 2008 16:55:51 +0530
| Newsgroups | gmane.comp.gnome.apps.planner.devel |
|---|---|
| Message-ID | <[email protected]> |
The error what comes when I click [Add] button in the predecessor tab of task properties dialog: src/.libs/planner: symbol lookup error: src/.libs/planner: undefined symbol: mrp_task_get_name_tree attached file: patch1.patch To get it tested/running, i moved mrp_task_get_name_tree into planner-task-dialog.c itself. 2008/12/16 ビカス ヤダワ (vikas yadav) <[email protected]> > > > 2008/12/16 Maurice van der Pot <griffon26-bCGDfOjggl9Wk0Htik3J/[email protected]> > >> On Mon, Dec 15, 2008 at 10:30:33AM +0530, ビカス ヤダワ (vikas yadav) wrote: >> > Awaiting suggestion/comments. >> >> Have you considered replacing the current GtkCombo (which has been >> deprecated according to >> http://library.gnome.org/devel/gtk/stable/GtkCombo.html#GtkCombo-struct) >> with a GtkComboBox? >> >> An advantage would be that this new GtkComboBox supports the model-view >> pattern and can therefore use a tree model for its values, which would >> look something like this: >> >> http://www.kksou.com/php-gtk2/articles/setup-combobox-with-multi-level-options---Part-1---display-as-tree-structure.php >> >> It could be a non-trivial thing to do, but I really like the way it >> looks. What do you think? >> > > Its great to use. I was searching for something treelike in glade designer > but could not identify. My gtk vocabulary is nill. :p > > >> I'll have to look into the problems you were having with adding a >> function to mrp-task.c. Can you put a patch online that will show >> the problem when I compile it? >> > > Ill prepare a patch and send it in some time. > > Thanks, > Vikas > > _______________________________________________ Planner-dev-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/planner-dev-list
patch1.patch
(text/x-patch, 2.4 KB)
Index: libplanner/mrp-task.c
===================================================================
--- libplanner/mrp-task.c (revision 940)
+++ libplanner/mrp-task.c (working copy)
@@ -921,6 +921,61 @@
}
/**
+ * mrp_task_get_name_tree:
+ * @task: an #MrpTask
+ *
+ * Retrives the name of @task along with the parent names
+ * seperated by > backet.
+ *
+ * Return value: the full tree name
+ **/
+gchar *
+mrp_task_get_name_tree (MrpTask *task)
+{
+ MrpTask *current = task;
+ gchar *mbuf = (gchar *) g_malloc(255);
+ gchar root[3];
+ gchar* name;
+ MrpTask *parent;
+ //init
+ root[0] = mbuf[0] = 0;
+ do
+ {
+ gchar *localbuf = (gchar *) g_malloc(255);
+ name = (gchar*) mrp_task_get_name (current);
+
+ parent = (MrpTask *) mrp_task_get_parent(current);
+
+ int flen = strlen(name) + strlen(root) + strlen(mbuf);
+ if(flen<255 && strlen(name)>0)
+ {
+ sprintf( localbuf ,"%s%s%s" , ( gchar* ) name
+ , root
+ , ( gchar* ) mbuf);
+ }
+ else
+ {
+ g_warning("nametreemaker: task name was longer than sizeof(localbuf)");
+ break;
+ }
+
+ g_warning(localbuf);
+
+ strncpy(mbuf,localbuf,255);
+
+ g_free(localbuf);
+
+ //set root indicator for possible next iteration
+ strncpy(root,"> ",3);
+
+ current = parent;
+
+ } while(parent != NULL);
+
+ return mbuf;
+}
+
+/**
* mrp_task_set_name:
* @task: an #MrpResource
* @name: new name of @task
Index: libplanner/mrp-task.h
===================================================================
--- libplanner/mrp-task.h (revision 940)
+++ libplanner/mrp-task.h (working copy)
@@ -89,6 +89,7 @@
const gchar *mrp_task_get_name (MrpTask *task);
void mrp_task_set_name (MrpTask *task,
const gchar *name);
+gchar *mrp_task_get_name_tree (MrpTask *task);
MrpRelation *mrp_task_add_predecessor (MrpTask *task,
MrpTask *predecessor,
MrpRelationType type,
Index: src/planner-task-dialog.c
===================================================================
--- src/planner-task-dialog.c (revision 940)
+++ src/planner-task-dialog.c (working copy)
@@ -375,7 +375,8 @@
strings = NULL;
for (l = tasks; l; l = l->next) {
- name = mrp_task_get_name (l->data);
+ //name = mrp_task_get_name (l->data);
+ name = mrp_task_get_name_tree (l->data);
if (name == NULL || name[0] == 0) {
strings = g_list_prepend (strings,
_("(No name)"));