widget-factory: Skip xml files in background selection dialog
authorTimm Bäder <mail@baedert.org>
Sun, 29 Sep 2019 06:39:12 +0000 (08:39 +0200)
committerTimm Bäder <mail@baedert.org>
Wed, 9 Oct 2019 14:57:22 +0000 (16:57 +0200)
The default contains a xml file for an animated background, so don't try
loading it as a pixbuf.

demos/widget-factory/widget-factory.c

index 5be2f97dacaa768c7adde16e331c0467c570d85a..4af47abf0d655d2fac80894f3f15597e69986ab7 100644 (file)
@@ -1003,6 +1003,9 @@ populate_flowbox (GtkWidget *flowbox)
 
   while ((name = g_dir_read_name (dir)) != NULL)
     {
+      if (g_str_has_suffix (name, ".xml"))
+        continue;
+
       filename = g_build_filename (location, name, NULL);
       file = g_file_new_for_path (filename);
       stream = G_INPUT_STREAM (g_file_read (file, NULL, &error));
@@ -1017,7 +1020,7 @@ populate_flowbox (GtkWidget *flowbox)
           bd = g_new (BackgroundData, 1);
           bd->flowbox = flowbox;
           bd->filename = filename;
-          gdk_pixbuf_new_from_stream_at_scale_async (stream, 110, 110, TRUE, NULL, 
+          gdk_pixbuf_new_from_stream_at_scale_async (stream, 110, 110, TRUE, NULL,
                                                      background_loaded_cb, bd);
         }