diff options
-rw-r--r-- | window_main.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/window_main.c b/window_main.c index d327177..11d1987 100644 --- a/window_main.c +++ b/window_main.c @@ -804,30 +804,41 @@ inline static void update_wall_tags(GArray *wallarray, guint64 tagid, gboolean a } /** - * Update tags for wallpapers. + * Recursive call for update_tags. */ -static void update_tags(GArray *wallarray, GtkTreeModel *model) { - GtkTreeIter iter; +static void update_tags_recursive(GArray *wallarray, GtkTreeModel *model, GtkTreeIter *_iter) { + GtkTreeIter iter = *_iter, child; gboolean active; struct tag_t *tag; - /* No tags available. */ - if(!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) { - return; - } - do { /* Don't update inconsistent tags. */ - if(tag_model_get_inconsistent(GTK_TREE_MODEL(model), &iter)) - continue; + if(!tag_model_get_inconsistent(GTK_TREE_MODEL(model), &iter)) { + active = tag_model_get_checked(GTK_TREE_MODEL(model), &iter); + tag_model_get_tag_record(GTK_TREE_MODEL(model), &iter, &tag); - active = tag_model_get_checked(GTK_TREE_MODEL(model), &iter); - tag_model_get_tag_record(GTK_TREE_MODEL(model), &iter, &tag); + update_wall_tags(wallarray, tag->id, active); + } + + if(gtk_tree_model_iter_children(GTK_TREE_MODEL(model), &child, &iter)) { + update_tags_recursive(wallarray, model, &child); + } - update_wall_tags(wallarray, tag->id, active); } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter)); } +/** + * Update tags for wallpapers. + */ +static void update_tags(GArray *wallarray, GtkTreeModel *model) { + GtkTreeIter iter; + + if(gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) { + update_tags_recursive(wallarray, model, &iter); + } + +} + void on_tags_activate(GtkMenuItem *menuitem, gpointer user_data) { struct tagdialog_data_t *data; GArray *array; |