gnome-main-menu r436 - trunk/libslab
- From: federico svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-main-menu r436 - trunk/libslab
- Date: Sat, 5 Apr 2008 00:45:57 +0100 (BST)
Author: federico
Date: Sat Apr 5 00:45:57 2008
New Revision: 436
URL: http://svn.gnome.org/viewvc/gnome-main-menu?rev=436&view=rev
Log:
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: Federico Mena Quintero <federico gnu org>
Modified:
trunk/libslab/libslab-utils.c
trunk/libslab/libslab-utils.h
Modified: trunk/libslab/libslab-utils.c
==============================================================================
--- trunk/libslab/libslab-utils.c (original)
+++ trunk/libslab/libslab-utils.c Sat Apr 5 00:45:57 2008
@@ -571,6 +571,45 @@
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)
Modified: trunk/libslab/libslab-utils.h
==============================================================================
--- trunk/libslab/libslab-utils.h (original)
+++ trunk/libslab/libslab-utils.h Sat Apr 5 00:45:57 2008
@@ -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 @@
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, ...);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]