aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2009-10-27 08:43:27 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2009-10-27 08:43:27 +0000
commit343c25f80f52c1465c19d39deb190ea8291542e8 (patch)
treee915716cca868db20e726e723b0fcf5a7a5f2a8a
parent656e9f2d63b7c7fe1e6b48b962ea0932d53dc3c9 (diff)
reimplemented addressbook_move_nodes_up().
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2297 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog4
-rw-r--r--src/addressbook.c53
2 files changed, 45 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 09106644..ff962118 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2009-10-27
+ * src/addressbook.c: reimplemented addressbook_move_nodes_up().
+
+2009-10-27
+
* src/addressbook.c
src/addressitem.h: reimplemented the list view of address book UI
with GtkTreeView.
diff --git a/src/addressbook.c b/src/addressbook.c
index 212da148..cca8b841 100644
--- a/src/addressbook.c
+++ b/src/addressbook.c
@@ -2077,20 +2077,49 @@ static void addressbook_tree_remove_children(GtkTreeModel *model,
}
}
-static void addressbook_move_nodes_up(GtkTreeIter *iter)
+static void addressbook_move_nodes_recursive(GtkTreeIter *iter,
+ GtkTreeIter *parent)
{
-#if 0
- GtkCTreeNode *parent, *child;
- GtkCTreeRow *currRow;
- currRow = GTK_CTREE_ROW( node );
- if( currRow ) {
- parent = currRow->parent;
- while( (child = currRow->children) ) {
- gtk_ctree_move( ctree, child, parent, node );
- }
- gtk_ctree_sort_node( ctree, parent );
+ GtkTreeView *treeview = GTK_TREE_VIEW(addrbook.treeview);
+ GtkTreeModel *model;
+ GtkTreeIter child, new_iter;
+ gboolean valid;
+
+ model = gtk_tree_view_get_model(treeview);
+
+ valid = gtk_tree_model_iter_children(model, &child, iter);
+ while (valid) {
+ gchar *name = NULL;
+ AddressObject *obj;
+ GdkPixbuf *pixbuf;
+ GdkPixbuf *pixbuf_open;
+
+ gtk_tree_model_get(model, &child, COL_FOLDER_NAME, &name,
+ COL_OBJ, &obj, COL_PIXBUF, &pixbuf,
+ COL_PIXBUF_OPEN, &pixbuf_open, -1);
+ gtk_tree_store_append(GTK_TREE_STORE(model), &new_iter, parent);
+ gtk_tree_store_set(GTK_TREE_STORE(model), &new_iter,
+ COL_FOLDER_NAME, name,
+ COL_OBJ, obj,
+ COL_PIXBUF, pixbuf,
+ COL_PIXBUF_OPEN, pixbuf_open, -1);
+ g_free(name);
+ addressbook_move_nodes_recursive(&child, &new_iter);
+ valid = gtk_tree_model_iter_next(model, &child);
}
-#endif
+}
+
+static void addressbook_move_nodes_up(GtkTreeIter *iter)
+{
+ GtkTreeView *treeview = GTK_TREE_VIEW(addrbook.treeview);
+ GtkTreeModel *model;
+ GtkTreeIter parent;
+
+ model = gtk_tree_view_get_model(treeview);
+ if (!gtk_tree_model_iter_parent(model, &parent, iter))
+ return;
+
+ addressbook_move_nodes_recursive(iter, &parent);
}
static void addressbook_edit_address_cb(gpointer data, guint action, GtkWidget *widget)