summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2010-05-08 23:09:19 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2010-05-08 23:09:19 +0200
commitc7536ae1e25670a5c3ebeb824fa2e9ab6d83e2a8 (patch)
treefcd073c3e51e17a3feb11fdf0475a95ca831bfe2
parentb5d882f64b8c496584c4ab16f5d0f275feebef10 (diff)
Fixed main window tag view not checking child tags.
-rw-r--r--window_main.c29
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);