diff options
-rw-r--r-- | window_main.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/window_main.c b/window_main.c index 11d1987..8d756d7 100644 --- a/window_main.c +++ b/window_main.c @@ -490,6 +490,25 @@ gboolean on_thumbview_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean return FALSE; } +void display_from_tagview_recursive(GtkTreeModel *model, GArray *tagarray, GtkTreeIter *_iter) { + GtkTreeIter iter = *_iter; + GtkTreeIter child; + struct tag_t *tag; + + do { + if(gtk_tree_model_iter_children(GTK_TREE_MODEL(model), &child, &iter)) { + display_from_tagview_recursive(model, tagarray, &child); + } + + if(!tag_model_get_checked(model, &iter)) + continue; + + tag_model_get_tag_record(GTK_TREE_MODEL(model), &iter, &tag); + + g_array_append_val(tagarray, tag->id); + } while(gtk_tree_model_iter_next(model, &iter)); +} + /** * Load wallpapers from the currently selected tags. */ @@ -498,7 +517,6 @@ void display_from_tagview() { GtkTreeModel *model, *old_model; GtkListStore *liststore; GArray *tagarray, *wallarray; - struct tag_t *tag; model = gtk_tree_view_get_model(GTK_TREE_VIEW(tagview)); @@ -507,14 +525,7 @@ void display_from_tagview() { tagarray = g_array_new(FALSE, FALSE, sizeof(guint64)); - do { - if(!tag_model_get_checked(model, &iter)) - continue; - - tag_model_get_tag_record(GTK_TREE_MODEL(model), &iter, &tag); - - g_array_append_val(tagarray, tag->id); - } while(gtk_tree_model_iter_next(model, &iter)); + display_from_tagview_recursive(model, tagarray, &iter); if(!db_get_walls_by_tags(tagarray, &wallarray)) { g_array_free(tagarray, TRUE); |