Index: plugins/Makefile.am
===================================================================
--- plugins/Makefile.am	(revision 225)
+++ plugins/Makefile.am	(working copy)
@@ -3,6 +3,7 @@
 SUBDIRS =		\
 	a11y-keyboard	\
 	background	\
+	clean-thumbs	\
 	clipboard	\
 	dummy		\
 	font		\
Index: configure.ac
===================================================================
--- configure.ac	(revision 225)
+++ configure.ac	(working copy)
@@ -393,6 +393,7 @@
 plugins/a11y-keyboard/Makefile
 plugins/background/Makefile
 plugins/background/libbackground/Makefile
+plugins/clean-thumbs/Makefile
 plugins/clipboard/Makefile
 plugins/dummy/Makefile
 plugins/font/Makefile
Index: data/Makefile.am
===================================================================
--- data/Makefile.am	(revision 225)
+++ data/Makefile.am	(working copy)
@@ -8,6 +8,7 @@
 	apps_gnome_settings_daemon_keybindings.schemas.in	\
 	apps_gnome_settings_daemon_screensaver.schemas.in	\
 	desktop_gnome_font_rendering.schemas.in			\
+	desktop_gnome_clean_thumbs.schemas.in			\
 	$(NULL)
 
 schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
Index: data/desktop_gnome_clean_thumbs.schemas.in
===================================================================
--- data/desktop_gnome_clean_thumbs.schemas.in	(revision 0)
+++ data/desktop_gnome_clean_thumbs.schemas.in	(revision 0)
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<gconfschemafile>
+  <schemalist>
+
+    <schema>
+      <key>/schemas/desktop/gnome/thumbnail_cache/max_age</key>
+      <applyto>/desktop/gnome/thumbnail_cache/max_age</applyto>
+      <owner>gnome</owner>
+      <type>int</type>
+      <default>60</default>
+      <locale name="C">
+        <short></short>
+        <long>Maximum age for thumbnails in the cache, in days.</long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/desktop/gnome/thumbnail_cache/max_size</key>
+      <applyto>/desktop/gnome/thumbnail_cache/max_size</applyto>
+      <owner>gnome</owner>
+      <type>int</type>
+      <default>64</default>
+      <locale name="C">
+        <short></short>
+        <long>Maximum size of the thumbnail cache, in megabytes.</long>
+      </locale>
+    </schema>
+
+  </schemalist>
+</gconfschemafile>
--- /dev/null	2008-03-04 05:29:36.991071511 -0500
+++ plugins/clean-thumbs/clean-thumbs.gnome-settings-plugin.in	2008-03-23 06:27:52.000000000 -0400
@@ -0,0 +1,8 @@
+[GNOME Settings Plugin]
+Module=clean-thumbs
+IAge=0
+_Name=Clean Thumbs
+_Description=A tool to keep the thumbnail cache small and fresh.
+Authors=Michael J. Chudobiak
+Copyright=Copyright © 2008 Michael J. Chudobiak
+Website=
--- /dev/null	2008-03-04 05:29:36.991071511 -0500
+++ plugins/clean-thumbs/Makefile.am	2008-03-23 06:49:28.000000000 -0400
@@ -0,0 +1,49 @@
+NULL =
+
+plugin_LTLIBRARIES = 			\
+	libclean_thumbs.la		\
+	$(NULL)
+
+libclean_thumbs_la_SOURCES = 		\
+	gsd-clean-thumbs-plugin.h	\
+	gsd-clean-thumbs-plugin.c	\
+	gsd-clean-thumbs-manager.h	\
+	gsd-clean-thumbs-manager.c	\
+	$(NULL)
+
+libclean_thumbs_la_CPPFLAGS = 		\
+	-I$(top_srcdir)/gnome-settings-daemon		\
+	-DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
+	$(AM_CPPFLAGS)
+
+libclean_thumbs_la_CFLAGS = 		\
+	$(SETTINGS_PLUGIN_CFLAGS)	\
+	$(AM_CFLAGS)
+
+libclean_thumbs_la_LDFLAGS = 	\
+	$(GSD_PLUGIN_LDFLAGS)	\
+	$(NULL)
+
+libclean_thumbs_la_LIBADD  =	\
+	$(SETTINGS_PLUGIN_LIBS)	\
+	$(NULL)
+
+plugin_in_files = 		\
+	clean-thumbs.gnome-settings-plugin.in	\
+	$(NULL)
+
+plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin)
+
+EXTRA_DIST = 			\
+	$(plugin_in_files)	\
+	$(NULL)
+
+CLEANFILES = 			\
+	$(plugin_DATA)		\
+	$(NULL)
+
+DISTCLEANFILES =		\
+	$(plugin_DATA)		\
+	$(NULL)
+
+@GSD_INTLTOOL_PLUGIN_RULE@
--- /dev/null	2008-03-04 05:29:36.991071511 -0500
+++ plugins/clean-thumbs/gsd-clean-thumbs-manager.c	2008-03-23 09:43:00.000000000 -0400
@@ -0,0 +1,445 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Michael J. Chudobiak <mjc@avtechpulse.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <dirent.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <locale.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#include <gdk/gdk.h>
+#include <gdk/gdkx.h>
+#include <gtk/gtk.h>
+
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
+#include "gsd-clean-thumbs-manager.h"
+
+#define GSD_CLEAN_THUMBS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_CLEAN_THUMBS_MANAGER, GsdCleanThumbsManagerPrivate))
+
+#define GCONF_BINDING_DIR "/desktop/gnome/thumbnail_cache"
+#define GCONF_AGE_KEY "/desktop/gnome/thumbnail_cache/max_age"
+#define DEFAULT_MAX_AGE_IN_DAYS 60
+#define GCONF_SIZE_KEY "/desktop/gnome/thumbnail_cache/max_size"
+#define DEFAULT_MAX_SIZE_IN_MB 64
+#define ONCE_A_DAY 24*60*60*1000
+
+
+struct GsdCleanThumbsManagerPrivate
+{
+        gint idle_cb;
+	gint timeout_cb;
+};
+
+enum {
+        PROP_0,
+};
+
+static void     gsd_clean_thumbs_manager_class_init  (GsdCleanThumbsManagerClass *klass);
+static void     gsd_clean_thumbs_manager_init        (GsdCleanThumbsManager      *clean_thumbs_manager);
+static void     gsd_clean_thumbs_manager_finalize    (GObject             	 *object);
+
+G_DEFINE_TYPE (GsdCleanThumbsManager, gsd_clean_thumbs_manager, G_TYPE_OBJECT)
+
+static gpointer manager_object = NULL;
+
+
+typedef struct {
+        time_t now;
+        time_t max_age;
+        glong  total_size;
+        glong  max_size;
+} PurgeData;
+
+
+typedef struct {
+        time_t  mtime;
+        char   *path;
+        glong   size;
+} ThumbData;
+
+
+static void
+thumb_data_free (gpointer data)
+{
+        ThumbData *info = data;
+
+        if (info) {
+                g_free (info->path);
+                g_free (info);
+        }
+}
+
+
+static GList *
+read_dir_for_purge (const char *path, GList *files)
+{
+        DIR *dir;
+        struct dirent *dirent;
+
+        dir = opendir (path);
+
+        if (dir) {
+                while ((dirent = readdir (dir)) != NULL) {
+                        if (strlen (dirent->d_name) == 36 &&
+                                        strcmp (dirent->d_name + 32, ".png") == 0) {
+                                struct stat statbuf;
+                                char       *full_path;
+
+                                full_path = g_build_filename (path, dirent->d_name, NULL);
+                                if (g_stat (full_path, &statbuf) == 0) {
+                                        ThumbData *info;
+                                        info = g_new0 (ThumbData, 1);
+                                        info->path = g_strdup (full_path);
+                                        info->mtime = statbuf.st_mtime;
+                                        info->size = statbuf.st_size;
+                                        files = g_list_prepend (files, info);
+                                }
+                                g_free (full_path);
+                        }
+                }
+                closedir (dir);
+        }
+
+        return files;
+}
+
+
+static void
+purge_old_thumbnails (ThumbData *info, PurgeData *purge_data)
+{
+        if ((purge_data->now - info->mtime) > purge_data->max_age) {
+                info->size = 0;
+                g_unlink (info->path);
+        } else {
+                purge_data->total_size += info->size;
+        }
+}
+
+
+static int
+sort_file_mtime (ThumbData *file1, ThumbData *file2)
+{
+        if (file1->mtime < file2->mtime) return -1;
+        if (file1->mtime > file2->mtime) return 1;
+        return 0;
+}
+
+
+static int
+get_gconf_int_with_nonzero_default (char *key, int default_value)
+{
+        GConfValue  *value;
+        GConfClient *client;
+        int          res;
+
+        client = gconf_client_get_default ();
+        value = gconf_client_get (client, key, NULL);
+
+        if (value == NULL) {
+                res = default_value;
+                gconf_client_set_int (client, key, default_value, NULL);
+        } else {
+                res = gconf_value_get_int (value);
+                gconf_value_free (value);
+        }
+
+        g_object_unref (client);
+
+        return res;
+}
+
+
+static gboolean
+purge_cache (gpointer data) {
+
+        char      *path;
+        GList     *files = NULL;
+        PurgeData *purge_data;
+
+	GsdCleanThumbsManager *manager = data;
+
+        path = g_build_filename (g_get_home_dir (),
+                                 ".thumbnails",
+                                 "normal",
+                                 NULL);
+        files = read_dir_for_purge (path, files);
+        g_free (path);
+
+        path = g_build_filename (g_get_home_dir (),
+                                 ".thumbnails",
+                                 "large",
+                                 NULL);
+        files = read_dir_for_purge (path, files);
+        g_free (path);
+
+        path = g_build_filename (g_get_home_dir (),
+                                 ".thumbnails",
+                                 "fail",
+				 "gnome-thumbnail-factory",
+                                 NULL);
+        files = read_dir_for_purge (path, files);
+        g_free (path);
+
+        purge_data = g_new0 (PurgeData, 1);
+        time (&purge_data->now);
+        purge_data->max_age = get_gconf_int_with_nonzero_default (GCONF_AGE_KEY, DEFAULT_MAX_AGE_IN_DAYS) * 24 * 60 * 60;
+        purge_data->max_size = get_gconf_int_with_nonzero_default (GCONF_SIZE_KEY, DEFAULT_MAX_SIZE_IN_MB) * 1024 * 1024;
+
+        if (purge_data->max_age >= 0)
+                g_list_foreach (files, (GFunc) purge_old_thumbnails, purge_data);
+
+        if ((purge_data->total_size > purge_data->max_size) && (purge_data->max_size >= 0)) {
+                GList *scan = NULL;
+                files = g_list_sort (files, (GCompareFunc) sort_file_mtime);
+                for (scan = files; scan && (purge_data->total_size > purge_data->max_size); scan = scan->next) {
+                        ThumbData *info = scan->data;
+                        g_unlink (info->path);
+                        purge_data->total_size -= info->size;
+                }
+        }
+
+        g_list_foreach (files, (GFunc) thumb_data_free, NULL);
+        g_list_free (files);
+        g_free (purge_data);
+
+	/* Terminate idle callback */
+	manager->priv->idle_cb = 0;
+	return FALSE;
+}
+
+
+static gboolean
+purge_cache_when_idle (gpointer data)
+{
+	GsdCleanThumbsManager *manager = data;
+
+	/* Thumbnail cache cleaning is not urgent, so try to 
+	   schedule it in an idle moment */
+	if (!manager->priv->idle_cb)
+		manager->priv->idle_cb = gtk_idle_add ((GtkFunction) purge_cache, data);
+
+	/* continue timeout callbacks */
+	return TRUE;
+}
+
+
+static void
+bindings_callback (GConfClient           *client,
+                   guint                  cnxn_id,
+                   GConfEntry            *entry,
+                   GsdCleanThumbsManager *manager)
+{
+	purge_cache (manager);
+}
+
+
+static void
+register_config_callback (GsdCleanThumbsManager   *manager,
+                          const char              *path,
+                          GConfClientNotifyFunc    func)
+{
+        GConfClient *client;
+
+        client = gconf_client_get_default ();
+
+        gconf_client_add_dir (client, path, GCONF_CLIENT_PRELOAD_NONE, NULL);
+        gconf_client_notify_add (client, path, func, manager, NULL, NULL);
+
+        g_object_unref (client);
+}
+
+
+gboolean
+gsd_clean_thumbs_manager_start (GsdCleanThumbsManager *manager,
+				GError               **error)
+{
+        g_debug ("Starting clean_thumbs manager");
+
+	register_config_callback (manager,
+                                  GCONF_BINDING_DIR,
+                                  (GConfClientNotifyFunc) bindings_callback);
+
+	manager->priv->idle_cb = 0;
+	manager->priv->timeout_cb = 0;
+
+	/* Clean once on start-up */
+	purge_cache_when_idle (manager);
+
+	/* Clean once a day */
+	manager->priv->timeout_cb = g_timeout_add (ONCE_A_DAY, 
+						   (GtkFunction) purge_cache_when_idle,
+						   manager);
+        return TRUE;
+}
+
+
+void
+gsd_clean_thumbs_manager_stop (GsdCleanThumbsManager *manager)
+{
+        g_debug ("Stopping clean_thumbs manager");
+
+	if (manager->priv->idle_cb) {
+		gtk_idle_remove (manager->priv->idle_cb);
+		manager->priv->idle_cb = 0;
+	}	
+
+	if (manager->priv->timeout_cb) {
+		g_source_remove (manager->priv->timeout_cb);
+		manager->priv->timeout_cb = 0;
+	}
+}
+
+
+static void
+gsd_clean_thumbs_manager_set_property (GObject        *object,
+				       guint           prop_id,
+				       const GValue   *value,
+				       GParamSpec     *pspec)
+{
+        GsdCleanThumbsManager *self;
+
+        self = GSD_CLEAN_THUMBS_MANAGER (object);
+
+        switch (prop_id) {
+        default:
+                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+                break;
+        }
+}
+
+
+static void
+gsd_clean_thumbs_manager_get_property (GObject        *object,
+				       guint           prop_id,
+				       GValue         *value,
+				       GParamSpec     *pspec)
+{
+        GsdCleanThumbsManager *self;
+
+        self = GSD_CLEAN_THUMBS_MANAGER (object);
+
+        switch (prop_id) {
+        default:
+                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+                break;
+        }
+}
+
+
+static GObject *
+gsd_clean_thumbs_manager_constructor (GType                  type,
+				      guint                  n_construct_properties,
+				      GObjectConstructParam *construct_properties)
+{
+        GsdCleanThumbsManager      *clean_thumbs_manager;
+        GsdCleanThumbsManagerClass *klass;
+
+        klass = GSD_CLEAN_THUMBS_MANAGER_CLASS (g_type_class_peek (GSD_TYPE_CLEAN_THUMBS_MANAGER));
+
+        clean_thumbs_manager = GSD_CLEAN_THUMBS_MANAGER (G_OBJECT_CLASS (gsd_clean_thumbs_manager_parent_class)->constructor (type,
+                                                                                                      n_construct_properties,
+                                                                                                      construct_properties));
+
+        return G_OBJECT (clean_thumbs_manager);
+}
+
+
+static void
+gsd_clean_thumbs_manager_dispose (GObject *object)
+{
+        GsdCleanThumbsManager *clean_thumbs_manager;
+
+        clean_thumbs_manager = GSD_CLEAN_THUMBS_MANAGER (object);
+
+        G_OBJECT_CLASS (gsd_clean_thumbs_manager_parent_class)->dispose (object);
+}
+
+
+static void
+gsd_clean_thumbs_manager_class_init (GsdCleanThumbsManagerClass *klass)
+{
+        GObjectClass   *object_class = G_OBJECT_CLASS (klass);
+
+        object_class->get_property = gsd_clean_thumbs_manager_get_property;
+        object_class->set_property = gsd_clean_thumbs_manager_set_property;
+        object_class->constructor = gsd_clean_thumbs_manager_constructor;
+        object_class->dispose = gsd_clean_thumbs_manager_dispose;
+        object_class->finalize = gsd_clean_thumbs_manager_finalize;
+
+        g_type_class_add_private (klass, sizeof (GsdCleanThumbsManagerPrivate));
+}
+
+
+static void
+gsd_clean_thumbs_manager_init (GsdCleanThumbsManager *manager)
+{
+        manager->priv = GSD_CLEAN_THUMBS_MANAGER_GET_PRIVATE (manager);
+
+}
+
+
+static void
+gsd_clean_thumbs_manager_finalize (GObject *object)
+{
+        GsdCleanThumbsManager *clean_thumbs_manager;
+
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (GSD_IS_CLEAN_THUMBS_MANAGER (object));
+
+        clean_thumbs_manager = GSD_CLEAN_THUMBS_MANAGER (object);
+
+        g_return_if_fail (clean_thumbs_manager->priv != NULL);
+
+        G_OBJECT_CLASS (gsd_clean_thumbs_manager_parent_class)->finalize (object);
+}
+
+
+GsdCleanThumbsManager *
+gsd_clean_thumbs_manager_new (void)
+{
+        if (manager_object != NULL) {
+                g_object_ref (manager_object);
+        } else {
+                manager_object = g_object_new (GSD_TYPE_CLEAN_THUMBS_MANAGER, NULL);
+                g_object_add_weak_pointer (manager_object,
+                                           (gpointer *) &manager_object);
+        }
+
+        return GSD_CLEAN_THUMBS_MANAGER (manager_object);
+}
--- /dev/null	2008-03-04 05:29:36.991071511 -0500
+++ plugins/clean-thumbs/gsd-clean-thumbs-manager.h	2008-03-23 06:32:46.000000000 -0400
@@ -0,0 +1,57 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Michael J. Chudobiak <mjc@avtechpulse.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef __GSD_CLEAN_THUMBS_MANAGER_H
+#define __GSD_CLEAN_THUMBS_MANAGER_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GSD_TYPE_CLEAN_THUMBS_MANAGER         (gsd_clean_thumbs_manager_get_type ())
+#define GSD_CLEAN_THUMBS_MANAGER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_CLEAN_THUMBS_MANAGER, GsdCleanThumbsManager))
+#define GSD_CLEAN_THUMBS_MANAGER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_CLEAN_THUMBS_MANAGER, GsdCleanThumbsManagerClass))
+#define GSD_IS_CLEAN_THUMBS_MANAGER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_CLEAN_THUMBS_MANAGER))
+#define GSD_IS_CLEAN_THUMBS_MANAGER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_CLEAN_THUMBS_MANAGER))
+#define GSD_CLEAN_THUMBS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_CLEAN_THUMBS_MANAGER, GsdCleanThumbsManagerClass))
+
+typedef struct GsdCleanThumbsManagerPrivate GsdCleanThumbsManagerPrivate;
+
+typedef struct
+{
+        GObject                     parent;
+        GsdCleanThumbsManagerPrivate *priv;
+} GsdCleanThumbsManager;
+
+typedef struct
+{
+        GObjectClass   parent_class;
+} GsdCleanThumbsManagerClass;
+
+GType                   gsd_clean_thumbs_manager_get_type	(void);
+
+GsdCleanThumbsManager * gsd_clean_thumbs_manager_new		(void);
+gboolean                gsd_clean_thumbs_manager_start		(GsdCleanThumbsManager *manager,
+								 GError         **error);
+void                    gsd_clean_thumbs_manager_stop		(GsdCleanThumbsManager *manager);
+
+G_END_DECLS
+
+#endif /* __GSD_CLEAN_THUMBS_MANAGER_H */
--- /dev/null	2008-03-04 05:29:36.991071511 -0500
+++ plugins/clean-thumbs/gsd-clean-thumbs-plugin.c	2008-03-23 06:41:20.000000000 -0400
@@ -0,0 +1,103 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Michael J. Chudobiak <mjc@avtechpulse.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+
+#include <glib/gi18n-lib.h>
+#include <gmodule.h>
+
+#include "gnome-settings-plugin.h"
+#include "gsd-clean-thumbs-plugin.h"
+#include "gsd-clean-thumbs-manager.h"
+
+struct GsdCleanThumbsPluginPrivate {
+        GsdCleanThumbsManager *manager;
+};
+
+#define GSD_CLEAN_THUMBS_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_CLEAN_THUMBS_PLUGIN, GsdCleanThumbsPluginPrivate))
+
+GNOME_SETTINGS_PLUGIN_REGISTER (GsdCleanThumbsPlugin, gsd_clean_thumbs_plugin)
+
+static void
+gsd_clean_thumbs_plugin_init (GsdCleanThumbsPlugin *plugin)
+{
+        plugin->priv = GSD_CLEAN_THUMBS_PLUGIN_GET_PRIVATE (plugin);
+
+        g_debug ("GsdCleanThumbsPlugin initializing");
+
+        plugin->priv->manager = gsd_clean_thumbs_manager_new ();
+}
+
+static void
+gsd_clean_thumbs_plugin_finalize (GObject *object)
+{
+        GsdCleanThumbsPlugin *plugin;
+
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (GSD_IS_CLEAN_THUMBS_PLUGIN (object));
+
+        g_debug ("GsdCleanThumbsPlugin finalizing");
+
+        plugin = GSD_CLEAN_THUMBS_PLUGIN (object);
+
+        g_return_if_fail (plugin->priv != NULL);
+
+        if (plugin->priv->manager != NULL) {
+                g_object_unref (plugin->priv->manager);
+        }
+
+        G_OBJECT_CLASS (gsd_clean_thumbs_plugin_parent_class)->finalize (object);
+}
+
+static void
+impl_activate (GnomeSettingsPlugin *plugin)
+{
+        gboolean res;
+        GError  *error;
+
+        g_debug ("Activating clean thumbs plugin");
+
+        error = NULL;
+        res = gsd_clean_thumbs_manager_start (GSD_CLEAN_THUMBS_PLUGIN (plugin)->priv->manager, &error);
+        if (! res) {
+                g_warning ("Unable to start clean thumbs manager: %s", error->message);
+                g_error_free (error);
+        }
+}
+
+static void
+impl_deactivate (GnomeSettingsPlugin *plugin)
+{
+        g_debug ("Deactivating clean thumbs plugin");
+}
+
+static void
+gsd_clean_thumbs_plugin_class_init (GsdCleanThumbsPluginClass *klass)
+{
+        GObjectClass           *object_class = G_OBJECT_CLASS (klass);
+        GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass);
+
+        object_class->finalize = gsd_clean_thumbs_plugin_finalize;
+
+        plugin_class->activate = impl_activate;
+        plugin_class->deactivate = impl_deactivate;
+
+        g_type_class_add_private (klass, sizeof (GsdCleanThumbsPluginPrivate));
+}
--- /dev/null	2008-03-04 05:29:36.991071511 -0500
+++ plugins/clean-thumbs/gsd-clean-thumbs-plugin.h	2008-03-23 06:32:08.000000000 -0400
@@ -0,0 +1,59 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Michael J. Chudobiak <mjc@avtechpulse.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef __GSD_CLEAN_THUMBS_PLUGIN_H__
+#define __GSD_CLEAN_THUMBS_PLUGIN_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gmodule.h>
+
+#include "gnome-settings-plugin.h"
+
+G_BEGIN_DECLS
+
+#define GSD_TYPE_CLEAN_THUMBS_PLUGIN                (gsd_clean_thumbs_plugin_get_type ())
+#define GSD_CLEAN_THUMBS_PLUGIN(o)                  (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_CLEAN_THUMBS_PLUGIN, GsdCleanThumbsPlugin))
+#define GSD_CLEAN_THUMBS_PLUGIN_CLASS(k)            (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_CLEAN_THUMBS_PLUGIN, GsdCleanThumbsPluginClass))
+#define GSD_IS_CLEAN_THUMBS_PLUGIN(o)               (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_CLEAN_THUMBS_PLUGIN))
+#define GSD_IS_CLEAN_THUMBS_PLUGIN_CLASS(k)         (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_CLEAN_THUMBS_PLUGIN))
+#define GSD_CLEAN_THUMBS_PLUGIN_GET_CLASS(o)        (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_CLEAN_THUMBS_PLUGIN, GsdCleanThumbsPluginClass))
+
+typedef struct GsdCleanThumbsPluginPrivate GsdCleanThumbsPluginPrivate;
+
+typedef struct
+{
+        GnomeSettingsPlugin		 parent;
+        GsdCleanThumbsPluginPrivate	*priv;
+} GsdCleanThumbsPlugin;
+
+typedef struct
+{
+        GnomeSettingsPluginClass parent_class;
+} GsdCleanThumbsPluginClass;
+
+GType   gsd_clean_thumbs_plugin_get_type		(void) G_GNUC_CONST;
+
+/* All the plugins must implement this function */
+G_MODULE_EXPORT GType register_gnome_settings_plugin	(GTypeModule *module);
+
+G_END_DECLS
+
+#endif /* __GSD_CLEAN_THUMBS_PLUGIN_H__ */
