[gnome-control-center] background: Make loading wallpapers seem faster
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] background: Make loading wallpapers seem faster
- Date: Sat, 12 Feb 2011 03:14:33 +0000 (UTC)
commit ce4f4d562725f4e29209cdecf08227f4bae5531c
Author: Bastien Nocera <hadess hadess net>
Date: Sat Feb 12 02:37:48 2011 +0000
background: Make loading wallpapers seem faster
As the UI actually updates as the files are loaded.
panels/background/bg-wallpapers-source.c | 36 +++++++++++++----------------
1 files changed, 16 insertions(+), 20 deletions(-)
---
diff --git a/panels/background/bg-wallpapers-source.c b/panels/background/bg-wallpapers-source.c
index c202f9b..211b1d4 100644
--- a/panels/background/bg-wallpapers-source.c
+++ b/panels/background/bg-wallpapers-source.c
@@ -38,6 +38,7 @@ struct _BgWallpapersSourcePrivate
{
GtkListStore *store;
GnomeDesktopThumbnailFactory *thumb_factory;
+ CcBackgroundXml *xml;
};
@@ -77,6 +78,11 @@ bg_wallpapers_source_dispose (GObject *object)
g_object_unref (priv->thumb_factory);
priv->thumb_factory = NULL;
}
+ if (priv->xml)
+ {
+ g_object_unref (priv->xml);
+ priv->xml = NULL;
+ }
G_OBJECT_CLASS (bg_wallpapers_source_parent_class)->dispose (object);
}
@@ -135,27 +141,15 @@ list_load_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- BgWallpapersSource *self = (BgWallpapersSource *) user_data;
- const GHashTable *ht;
-
- ht = cc_background_xml_load_list_finish (res);
- g_hash_table_foreach ((GHashTable *) ht,
- (GHFunc) load_wallpapers,
- self);
-
- g_object_unref (source_object);
+ cc_background_xml_load_list_finish (res);
}
-static gboolean
-reload_wallpapers (BgWallpapersSource *self)
+static void
+item_added (CcBackgroundXml *xml,
+ CcBackgroundItem *item,
+ BgWallpapersSource *self)
{
- CcBackgroundXml *wp_xml;
-
- /* set up wallpaper source */
- wp_xml = cc_background_xml_new ();
- cc_background_xml_load_list_async (wp_xml, NULL, list_load_cb, self);
-
- return FALSE;
+ load_wallpapers (NULL, item, self);
}
static void
@@ -167,8 +161,10 @@ bg_wallpapers_source_init (BgWallpapersSource *self)
priv->thumb_factory =
gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL);
-
- reload_wallpapers (self);
+ priv->xml = cc_background_xml_new ();
+ g_signal_connect (G_OBJECT (priv->xml), "added",
+ G_CALLBACK (item_added), self);
+ cc_background_xml_load_list_async (priv->xml, NULL, list_load_cb, self);
}
BgWallpapersSource *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]