Commit b8d91370 authored by Federico Mena Quintero's avatar Federico Mena Quintero Committed by Federico Mena Quintero

Utility functions to initialize the thumbnail factory in an idle handler....

Utility functions to initialize the thumbnail factory in an idle handler. We'll do this after the main loop starts up, so that we can initialize the thumbnail factory (an expensive operation) before the user clicks on the Computer button for the first time.
Signed-off-by: 's avatarFederico Mena Quintero <federico@gnu.org>

svn path=/trunk/; revision=436
parent a54b5ce4
......@@ -571,6 +571,45 @@ libslab_spawn_command (const gchar *cmd)
g_strfreev (argv);
}
static guint thumbnail_factory_idle_id;
static GnomeThumbnailFactory *thumbnail_factory;
static void
create_thumbnail_factory (void)
{
g_assert (thumbnail_factory == NULL);
thumbnail_factory = gnome_thumbnail_factory_new (GNOME_THUMBNAIL_SIZE_NORMAL);
}
static gboolean
init_thumbnail_factory_idle_cb (gpointer data)
{
create_thumbnail_factory ();
thumbnail_factory_idle_id = 0;
return FALSE;
}
void
libslab_thumbnail_factory_preinit (void)
{
thumbnail_factory_idle_id = g_idle_add (init_thumbnail_factory_idle_cb, NULL);
}
GnomeThumbnailFactory *
libslab_thumbnail_factory_get (void)
{
if (thumbnail_factory_idle_id != 0) {
g_source_remove (thumbnail_factory_idle_id);
thumbnail_factory_idle_id = 0;
create_thumbnail_factory ();
}
g_assert (thumbnail_factory != NULL);
return thumbnail_factory;
}
void
libslab_checkpoint_init (const char *checkpoint_config_file_basename,
const char *checkpoint_file_basename)
......
......@@ -5,6 +5,7 @@
#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
#include <libgnome/gnome-desktop-item.h>
#include <libgnomeui/gnome-thumbnail.h>
G_BEGIN_DECLS
......@@ -27,6 +28,9 @@ gboolean libslab_desktop_item_is_lockscreen (const gchar *uri);
gchar *libslab_string_replace_once (const gchar *string, const gchar *key, const gchar *value);
void libslab_spawn_command (const gchar *cmd);
void libslab_thumbnail_factory_preinit (void);
GnomeThumbnailFactory *libslab_thumbnail_factory_get (void);
void libslab_checkpoint_init (const char *checkpoint_config_file_basename, const char *checkpoint_file_basename);
void libslab_checkpoint (const char *format, ...);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment