Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Günther Wagner
gnome-builder
Commits
6b55406a
Commit
6b55406a
authored
Jan 15, 2019
by
Daniel Buch Hansen
Committed by
Christian Hergert
Jan 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
project-tree: Use ide_tree_node_insert_sorted() for add_file()
parent
5d2dae9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
2 deletions
+25
-2
src/plugins/project-tree/gbp-project-tree-addin.c
src/plugins/project-tree/gbp-project-tree-addin.c
+25
-2
No files found.
src/plugins/project-tree/gbp-project-tree-addin.c
View file @
6b55406a
...
...
@@ -347,6 +347,30 @@ collect_files (GFile *file,
return
g_steal_pointer
(
&
list
);
}
static
int
node_compare
(
IdeTreeNode
*
node
,
IdeTreeNode
*
child
)
{
gint
cmp
;
const
gchar
*
child_name
,
*
node_name
;
g_autofree
gchar
*
collated_child
=
NULL
;
g_autofree
gchar
*
collated_node
=
NULL
;
g_assert
(
IDE_IS_TREE_NODE
(
node
));
g_assert
(
IDE_IS_TREE_NODE
(
child
));
child_name
=
ide_tree_node_get_display_name
(
child
);
node_name
=
ide_tree_node_get_display_name
(
node
);
collated_child
=
g_utf8_collate_key_for_filename
(
child_name
,
-
1
);
collated_node
=
g_utf8_collate_key_for_filename
(
node_name
,
-
1
);
cmp
=
g_strcmp0
(
collated_child
,
collated_node
);
return
cmp
>
0
?
cmp
:
0
;
}
static
void
gbp_project_tree_addin_add_file
(
GbpProjectTreeAddin
*
self
,
GFile
*
file
)
...
...
@@ -409,8 +433,7 @@ gbp_project_tree_addin_add_file (GbpProjectTreeAddin *self,
project_file
=
ide_project_file_new
(
directory
,
info
);
node
=
create_file_node
(
project_file
);
/* TODO: Sort item */
ide_tree_node_append
(
parent
,
node
);
ide_tree_node_insert_sorted
(
parent
,
node
,
node_compare
);
}
IDE_EXIT
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment