Skip to content

Commit

Permalink
Use GPtrArray instead of GArray
Browse files Browse the repository at this point in the history
  • Loading branch information
konsolebox committed Jul 31, 2016
1 parent 6d99001 commit bf3d1df
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/notebook.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,27 +860,26 @@ static void move_tab(GeanyDocument *doc, gint pos)

void notebook_sort_tabs(NotebookTabSortMethod method)
{
GArray *docs;
GeanyDocument* doc;
GPtrArray *docs;
guint i;

docs = g_array_new(FALSE, TRUE, sizeof(GeanyDocument*));
docs = g_ptr_array_new();

foreach_document(i)
g_array_append_val(docs, documents[i]);
g_ptr_array_add(docs, documents[i]);

if (method == NOTEBOOK_TAB_SORT_BY_FILENAME)
g_array_sort(docs, compare_docs_by_filename);
g_ptr_array_sort(docs, compare_docs_by_filename);
else
g_array_sort(docs, compare_docs_by_pathname);
g_ptr_array_sort(docs, compare_docs_by_pathname);

for (i = 0; i < docs->len; ++i)
{
doc = g_array_index(docs, GeanyDocument*, i);
GeanyDocument* doc = g_ptr_array_index(docs, i);
move_tab(doc, i);
}

g_array_free(docs, TRUE);
g_ptr_array_free(docs, TRUE);
}


Expand Down

0 comments on commit bf3d1df

Please sign in to comment.