Enlightenment CVS committal Author : moom Project : e17 Module : libs/etk
Dir : e17/libs/etk/src/bin Modified Files: etk_tree_test.c Log Message: * [Tree] A *quick* port of etk_tree_col_sort() from the old tree. For now, it is not connected to the col's header so clicking on it won't sort the col, but you can still call etk_tree_col_sort() manually =================================================================== RCS file: /cvs/e/e17/libs/etk/src/bin/etk_tree_test.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -3 -r1.42 -r1.43 --- etk_tree_test.c 22 Mar 2007 19:36:51 -0000 1.42 +++ etk_tree_test.c 2 Apr 2007 22:11:53 -0000 1.43 @@ -6,6 +6,7 @@ static void _etk_test_tree_key_down_cb(Etk_Object *object, Etk_Event_Key_Down *event, void *data); static void _etk_test_tree_row_clicked_cb(Etk_Object *object, Etk_Tree_Row *row, Etk_Event_Mouse_Up *event, void *data); static void _etk_test_tree_checkbox_toggled_cb(Etk_Object *object, Etk_Tree_Row *row, void *data); +static int _etk_test_tree_compare_cb(Etk_Tree_Col *col, Etk_Tree_Row *row1, Etk_Tree_Row *row2, void *data); /* Creates the window for the tree test */ void etk_test_tree_window_create(void *data) @@ -101,6 +102,7 @@ NULL); } etk_tree_thaw(ETK_TREE(tree)); + etk_tree_col_sort_full(col1, _etk_test_tree_compare_cb, NULL, ETK_FALSE); /* Finally we create the statusbar used to display the events on the tree */ statusbar = etk_statusbar_new(); @@ -189,4 +191,14 @@ sprintf(message, "Row \"%s\" has been %s", row_name, checked ? "checked" : "unchecked"); etk_statusbar_message_push(statusbar, message, 0); +} + +/* Used to sort the first column of the tree... */ +static int _etk_test_tree_compare_cb(Etk_Tree_Col *col, Etk_Tree_Row *row1, Etk_Tree_Row *row2, void *data) +{ + const char *str1, *str2; + + etk_tree_row_fields_get(row1, col, NULL, NULL, &str1, NULL); + etk_tree_row_fields_get(row2, col, NULL, NULL, &str2, NULL); + return strcmp(str1, str2); } ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs