summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2010-05-08 17:51:38 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2010-05-08 17:51:38 +0200
commit457650226a75249c3918cc0a892bfcf710ff4089 (patch)
tree536a2c5289724d7fd7e9ab1a1538f268262d8e84
parent94b6276d5cf43c4eef6a3cd05a2ec5e09d9987a0 (diff)
Fixed assigning non-toplevel tags to wallpapers.
-rw-r--r--window_main.c37
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;