summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2010-01-04 03:29:10 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2010-01-04 03:29:10 +0100
commit3e664405587c5cf44fa05dc4a5864ce08243c1dc (patch)
treec63aa0c0261679bb5977d3ef017d47690a7c5977
parentdf3ba8d1b835e059ec9abe1e27a764060b5e9386 (diff)
Clear old liststore when adding a new one to the thumbview.
-rw-r--r--thumbnails.c3
-rw-r--r--window_main.c16
2 files changed, 16 insertions, 3 deletions
diff --git a/thumbnails.c b/thumbnails.c
index 92f2460..0359308 100644
--- a/thumbnails.c
+++ b/thumbnails.c
@@ -156,7 +156,8 @@ gpointer add_thumbs_thread(gpointer data) {
path = gtk_tree_model_get_path(GTK_TREE_MODEL(liststore), &iter);
- gtk_tree_model_row_changed(GTK_TREE_MODEL(liststore), path, &iter);
+ if(path)
+ gtk_tree_model_row_changed(GTK_TREE_MODEL(liststore), path, &iter);
g_object_unref(pb);
}
diff --git a/window_main.c b/window_main.c
index 54e885e..8a72ed5 100644
--- a/window_main.c
+++ b/window_main.c
@@ -291,7 +291,7 @@ static void start_thumb_thread(GtkListStore *liststore) {
* Load wallpapers from the currently selected folder.
*/
static void display_from_foldtree(GtkTreeSelection *treeselection) {
- GtkTreeModel *model;
+ GtkTreeModel *model, *old_model;
GtkTreeIter iter;
struct directory_t *dir;
GArray *array;
@@ -308,9 +308,15 @@ static void display_from_foldtree(GtkTreeSelection *treeselection) {
liststore = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_UINT64);
fill_wall_list(liststore, array);
+
+ old_model = gtk_icon_view_get_model(thumbview);
+
gtk_icon_view_set_model(thumbview, GTK_TREE_MODEL(liststore));
start_thumb_thread(liststore);
+
+ if(old_model)
+ gtk_list_store_clear(GTK_LIST_STORE(old_model));
}
}
@@ -349,7 +355,7 @@ void on_thumbview_selection_changed(GtkIconView *iconview, gpointer user_data) {
*/
void display_from_tagview() {
GtkTreeIter iter;
- GtkTreeModel *model;
+ GtkTreeModel *model, *old_model;
GtkListStore *liststore;
GValue value = {0};
gboolean active;
@@ -386,9 +392,15 @@ void display_from_tagview() {
liststore = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_UINT64);
fill_wall_list(liststore, wallarray);
+
+ old_model = gtk_icon_view_get_model(thumbview);
+
gtk_icon_view_set_model(thumbview, GTK_TREE_MODEL(liststore));
start_thumb_thread(liststore);
+
+ if(old_model)
+ gtk_list_store_clear(GTK_LIST_STORE(old_model));
}
void on_main_tagview_cell_toggled(GtkCellRendererToggle *cell_renderer, gchar *path_string, gpointer user_data) {