Replace macro with static function.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/symbol-tree@3173 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
1d69b53f57
commit
c0064114ca
@ -1,3 +1,9 @@
|
||||
2008-11-05 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
||||
* src/symbols.c:
|
||||
Replace macro with static function.
|
||||
|
||||
|
||||
2008-11-04 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
||||
* src/symbols.c:
|
||||
|
@ -1061,12 +1061,13 @@ static gint compare_top_level_names(const gchar *a, const gchar *b)
|
||||
}
|
||||
|
||||
|
||||
/* Whether iters can be sorted based on tag name and line, not scope.
|
||||
* If the scope was prepended, e.g. 'ScopeNameWithNoTag::TagName', this returns FALSE */
|
||||
#define tag_is_name_sortable(tag, iter) \
|
||||
((tag) && \
|
||||
(!NZV((tag)->atts.entry.scope) || \
|
||||
gtk_tree_store_iter_depth(GTK_TREE_STORE(model), (iter)) > 1))
|
||||
static gboolean tag_has_missing_parent(const TMTag *tag, GtkTreeStore *store,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
/* if the tag has a parent tag, it should be at depth >= 2 */
|
||||
return NZV(tag->atts.entry.scope) &&
|
||||
gtk_tree_store_iter_depth(store, iter) == 1;
|
||||
}
|
||||
|
||||
|
||||
static gint tree_sort_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b,
|
||||
@ -1078,8 +1079,10 @@ static gint tree_sort_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b,
|
||||
gtk_tree_model_get(model, a, SYMBOLS_COLUMN_TAG, &tag_a, -1);
|
||||
gtk_tree_model_get(model, b, SYMBOLS_COLUMN_TAG, &tag_b, -1);
|
||||
|
||||
if (tag_is_name_sortable(tag_a, a) &&
|
||||
tag_is_name_sortable(tag_b, b))
|
||||
/* Check if the iters can be sorted based on tag name and line, not tree item name.
|
||||
* Sort by tree name if the scope was prepended, e.g. 'ScopeNameWithNoTag::TagName'. */
|
||||
if (tag_a && !tag_has_missing_parent(tag_a, GTK_TREE_STORE(model), a) &&
|
||||
tag_b && !tag_has_missing_parent(tag_b, GTK_TREE_STORE(model), b))
|
||||
{
|
||||
return sort_by_name ? compare_symbol(tag_a, tag_b) :
|
||||
compare_symbol_lines(tag_a, tag_b);
|
||||
@ -1103,7 +1106,7 @@ static gint tree_sort_func(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b,
|
||||
|
||||
/* sort duplicate 'ScopeName::OverloadedTagName' items by line as well */
|
||||
if ((!sort_by_name || cmp == 0) && tag_a && tag_b)
|
||||
cmp = tag_a->atts.entry.line - tag_b->atts.entry.line;
|
||||
cmp = compare_symbol_lines(tag_a, tag_b);
|
||||
}
|
||||
g_free(astr);
|
||||
g_free(bstr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user