background: Make loading wallpapers seem faster
As the UI actually updates as the files are loaded.
This commit is contained in:
parent
c2e84e2c8a
commit
ce4f4d5627
1 changed files with 16 additions and 20 deletions
|
@ -38,6 +38,7 @@ struct _BgWallpapersSourcePrivate
|
||||||
{
|
{
|
||||||
GtkListStore *store;
|
GtkListStore *store;
|
||||||
GnomeDesktopThumbnailFactory *thumb_factory;
|
GnomeDesktopThumbnailFactory *thumb_factory;
|
||||||
|
CcBackgroundXml *xml;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,6 +78,11 @@ bg_wallpapers_source_dispose (GObject *object)
|
||||||
g_object_unref (priv->thumb_factory);
|
g_object_unref (priv->thumb_factory);
|
||||||
priv->thumb_factory = NULL;
|
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);
|
G_OBJECT_CLASS (bg_wallpapers_source_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
@ -135,27 +141,15 @@ list_load_cb (GObject *source_object,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
BgWallpapersSource *self = (BgWallpapersSource *) user_data;
|
cc_background_xml_load_list_finish (res);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static void
|
||||||
reload_wallpapers (BgWallpapersSource *self)
|
item_added (CcBackgroundXml *xml,
|
||||||
|
CcBackgroundItem *item,
|
||||||
|
BgWallpapersSource *self)
|
||||||
{
|
{
|
||||||
CcBackgroundXml *wp_xml;
|
load_wallpapers (NULL, item, self);
|
||||||
|
|
||||||
/* 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -167,8 +161,10 @@ bg_wallpapers_source_init (BgWallpapersSource *self)
|
||||||
|
|
||||||
priv->thumb_factory =
|
priv->thumb_factory =
|
||||||
gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL);
|
gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL);
|
||||||
|
priv->xml = cc_background_xml_new ();
|
||||||
reload_wallpapers (self);
|
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 *
|
BgWallpapersSource *
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue