summaryrefslogtreecommitdiff
path: root/src/trg-file-parser.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2013-02-20 19:17:08 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2013-02-20 19:17:08 +0000
commit6feb984156f7e504a00ad8edfef84993ad1b3e74 (patch)
treea66d80c8e0f77def2b7e7d4002c090ef81866c48 /src/trg-file-parser.c
parent2ebc0a5cd92b753271316e0e00a5fddc51d0cbf0 (diff)
update year in copyright headers, fix the jumbled file lists (caused by unsorted files)
Diffstat (limited to 'src/trg-file-parser.c')
-rw-r--r--src/trg-file-parser.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/trg-file-parser.c b/src/trg-file-parser.c
index d59cabc..03c4f8d 100644
--- a/src/trg-file-parser.c
+++ b/src/trg-file-parser.c
@@ -1,6 +1,6 @@
/*
* transmission-remote-gtk - A GTK RPC client to Transmission
- * Copyright (C) 2011 Alan Fitton
+ * Copyright (C) 2011-2013 Alan Fitton
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -60,8 +60,7 @@ static trg_files_tree_node *trg_file_parser_node_insert(trg_files_tree_node
trg_files_tree_node *target_node = NULL;
if (li && !isFile) {
- trg_files_tree_node *lastPathNode =
- (trg_files_tree_node *) li->data;
+ trg_files_tree_node *lastPathNode = (trg_files_tree_node *) li->data;
if (!g_strcmp0(lastPathNode->name, path_el_node->val.s)) {
target_node = lastPathNode;
@@ -71,16 +70,18 @@ static trg_files_tree_node *trg_file_parser_node_insert(trg_files_tree_node
}
}
+ if (!target_node && lastIter && lastIter->childrenHash)
+ target_node = g_hash_table_lookup(lastIter->childrenHash, path_el_node->val.s);
+
if (!target_node) {
target_node = g_new0(trg_files_tree_node, 1);
target_node->name = g_strdup(path_el_node->val.s);
target_node->parent = lastIter;
if (lastIter)
- lastIter->children =
- g_list_append(lastIter->children, target_node);
+ trg_files_tree_node_add_child(lastIter, target_node);
else
- top->children = g_list_append(top->children, target_node);
+ trg_files_tree_node_add_child(top, target_node);
}
if (isFile) {