gnome-settings-daemon r236 - in trunk: . data plugins plugins/housekeeping
- From: mjc svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-settings-daemon r236 - in trunk: . data plugins plugins/housekeeping
- Date: Fri, 28 Mar 2008 12:09:56 +0000 (GMT)
Author: mjc
Date: Fri Mar 28 12:09:56 2008
New Revision: 236
URL: http://svn.gnome.org/viewvc/gnome-settings-daemon?rev=236&view=rev
Log:
2008-03-28 Michael J. Chudobiak <mjc svn gnome org>
* configure.ac:
* data/gnome-settings-daemon.schemas.in:
* plugins/Makefile.am:
* plugins/housekeeping/Makefile.am:
* plugins/housekeeping/gsd-housekeeping-manager.c:
(thumb_data_free), (read_dir_for_purge), (purge_old_thumbnails),
(sort_file_mtime), (get_gconf_int_with_nonzero_default),
(purge_thumbnail_cache), (do_cleanup), (do_cleanup_once),
(do_cleanup_soon), (bindings_callback), (register_config_callback),
(gsd_housekeeping_manager_start), (gsd_housekeeping_manager_stop),
(gsd_housekeeping_manager_class_init),
(gsd_housekeeping_manager_init), (gsd_housekeeping_manager_new):
* plugins/housekeeping/gsd-housekeeping-manager.h:
* plugins/housekeeping/gsd-housekeeping-plugin.c:
(gsd_housekeeping_plugin_init), (gsd_housekeeping_plugin_finalize),
(impl_activate), (impl_deactivate),
(gsd_housekeeping_plugin_class_init):
* plugins/housekeeping/gsd-housekeeping-plugin.h:
* plugins/housekeeping/housekeeping.gnome-settings-plugin.in:
Added a new "housekeeping" plugin to set limits on the size and
age of the thumbnail cache (bug #523159).
Added:
trunk/plugins/housekeeping/
trunk/plugins/housekeeping/Makefile.am
trunk/plugins/housekeeping/gsd-housekeeping-manager.c
trunk/plugins/housekeeping/gsd-housekeeping-manager.h
trunk/plugins/housekeeping/gsd-housekeeping-plugin.c
trunk/plugins/housekeeping/gsd-housekeeping-plugin.h
trunk/plugins/housekeeping/housekeeping.gnome-settings-plugin.in
Modified:
trunk/ChangeLog
trunk/configure.ac
trunk/data/gnome-settings-daemon.schemas.in
trunk/plugins/Makefile.am
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Fri Mar 28 12:09:56 2008
@@ -409,6 +409,7 @@
plugins/clipboard/Makefile
plugins/dummy/Makefile
plugins/font/Makefile
+plugins/housekeeping/Makefile
plugins/keybindings/Makefile
plugins/keyboard/Makefile
plugins/media-keys/Makefile
Modified: trunk/data/gnome-settings-daemon.schemas.in
==============================================================================
--- trunk/data/gnome-settings-daemon.schemas.in (original)
+++ trunk/data/gnome-settings-daemon.schemas.in Fri Mar 28 12:09:56 2008
@@ -95,6 +95,29 @@
</schema>
<schema>
+ <key>/schemas/apps/gnome_settings_daemon/plugins/housekeeping/active</key>
+ <applyto>/apps/gnome_settings_daemon/plugins/housekeeping/active</applyto>
+ <owner>gnome-settings-daemon</owner>
+ <type>bool</type>
+ <default>TRUE</default>
+ <locale name="C">
+ <short>Enable housekeeping plugin</short>
+ <long>Set to True to enable the housekeeping plugin, to prune transient file caches.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/gnome_settings_daemon/plugins/housekeeping/priority</key>
+ <applyto>/apps/gnome_settings_daemon/plugins/housekeeping/priority</applyto>
+ <owner>gnome-settings-daemon</owner>
+ <type>int</type>
+ <default>300</default>
+ <locale name="C">
+ <short></short>
+ <long></long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/gnome_settings_daemon/plugins/keybindings/active</key>
<applyto>/apps/gnome_settings_daemon/plugins/keybindings/active</applyto>
<owner>gnome-settings-daemon</owner>
Modified: trunk/plugins/Makefile.am
==============================================================================
--- trunk/plugins/Makefile.am (original)
+++ trunk/plugins/Makefile.am Fri Mar 28 12:09:56 2008
@@ -6,6 +6,7 @@
clipboard \
dummy \
font \
+ housekeeping \
keybindings \
keyboard \
media-keys \
Added: trunk/plugins/housekeeping/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/plugins/housekeeping/Makefile.am Fri Mar 28 12:09:56 2008
@@ -0,0 +1,32 @@
+plugin_LTLIBRARIES = libhousekeeping.la
+
+libhousekeeping_la_SOURCES = \
+ gsd-housekeeping-manager.c \
+ gsd-housekeeping-manager.h \
+ gsd-housekeeping-plugin.c \
+ gsd-housekeeping-plugin.h
+
+libhousekeeping_la_CPPFLAGS = \
+ -I$(top_srcdir)/gnome-settings-daemon \
+ -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
+ $(AM_CPPFLAGS)
+
+libhousekeeping_la_CFLAGS = \
+ $(SETTINGS_PLUGIN_CFLAGS) \
+ $(AM_CFLAGS)
+
+libhousekeeping_la_LDFLAGS = $(GSD_PLUGIN_LDFLAGS)
+
+libhousekeeping_la_LIBADD = $(SETTINGS_PLUGIN_LIBS)
+
+plugin_in_files = housekeeping.gnome-settings-plugin.in
+
+plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin)
+
+EXTRA_DIST = $(plugin_in_files)
+
+CLEANFILES = $(plugin_DATA)
+
+DISTCLEANFILES = (plugin_DATA)
+
+ GSD_INTLTOOL_PLUGIN_RULE@
Added: trunk/plugins/housekeeping/gsd-housekeeping-manager.c
==============================================================================
--- (empty file)
+++ trunk/plugins/housekeeping/gsd-housekeeping-manager.c Fri Mar 28 12:09:56 2008
@@ -0,0 +1,367 @@
+/* -*- 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 <gconf/gconf-client.h>
+#include <gio/gio.h>
+#include <glib/gstdio.h>
+#include <string.h>
+
+#include "gnome-settings-profile.h"
+#include "gsd-housekeeping-manager.h"
+
+
+/* General */
+#define INTERVAL_ONCE_A_DAY 24*60*60
+#define INTERVAL_TWO_MINUTES 2*60
+
+
+/* Thumbnail cleaner */
+#define GCONF_THUMB_AGE "/desktop/gnome/thumbnail_cache/maximum_age"
+#define DEFAULT_MAX_AGE_IN_DAYS 60
+#define GCONF_THUMB_SIZE "/desktop/gnome/thumbnail_cache/maximum_size"
+#define DEFAULT_MAX_SIZE_IN_MB 64
+#define GCONF_THUMB_BINDING_DIR "/desktop/gnome/thumbnail_cache"
+
+
+struct GsdHousekeepingManagerPrivate {
+ gint long_term_cb;
+ gint short_term_cb;
+};
+
+
+#define GSD_HOUSEKEEPING_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_HOUSEKEEPING_MANAGER, GsdHousekeepingManagerPrivate))
+
+static void gsd_housekeeping_manager_class_init (GsdHousekeepingManagerClass *klass);
+static void gsd_housekeeping_manager_init (GsdHousekeepingManager *housekeeping_manager);
+
+G_DEFINE_TYPE (GsdHousekeepingManager, gsd_housekeeping_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)
+{
+ GFile *read_path;
+ GFileEnumerator *enum_dir;
+
+ read_path = g_file_new_for_path (path);
+ enum_dir = g_file_enumerate_children (read_path,
+ G_FILE_ATTRIBUTE_STANDARD_NAME ","
+ G_FILE_ATTRIBUTE_TIME_MODIFIED ","
+ G_FILE_ATTRIBUTE_STANDARD_SIZE,
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ NULL);
+
+ if (enum_dir != NULL) {
+ GFileInfo *info;
+ while ((info = g_file_enumerator_next_file (enum_dir, NULL, NULL)) != NULL) {
+ const char *name;
+ name = g_file_info_get_name (info);
+
+ if (strlen (name) == 36 && strcmp (name + 32, ".png") == 0) {
+ ThumbData *td;
+ GFile *entry;
+ char *entry_path;
+ GTimeVal mod_time;
+
+ entry = g_file_get_child (read_path, name);
+ entry_path = g_file_get_path (entry);
+ g_object_unref (entry);
+
+ g_file_info_get_modification_time (info, &mod_time);
+
+ td = g_new0 (ThumbData, 1);
+ td->path = entry_path;
+ td->mtime = mod_time.tv_sec;
+ td->size = g_file_info_get_size (info);
+
+ files = g_list_prepend (files, td);
+ }
+ g_object_unref (info);
+ }
+ g_object_unref (enum_dir);
+ }
+ g_object_unref (read_path);
+
+ return files;
+}
+
+
+static void
+purge_old_thumbnails (ThumbData *info, PurgeData *purge_data)
+{
+ if ((purge_data->now - info->mtime) > purge_data->max_age) {
+ g_unlink (info->path);
+ info->size = 0;
+ } else {
+ purge_data->total_size += info->size;
+ }
+}
+
+
+static int
+sort_file_mtime (ThumbData *file1, ThumbData *file2)
+{
+ return file1->mtime - file2->mtime;
+}
+
+
+static int
+get_gconf_int_with_nonzero_default (char *key, int default_value)
+{
+ /* If the key is unset, we use a non-zero default value.
+ A zero value corresponds to an extra-paranoid level
+ of cleaning - it deletes all files. We don't want that
+ as a default condition. */
+
+ GConfValue *value;
+ GConfClient *client;
+ int res;
+
+ client = gconf_client_get_default ();
+ value = gconf_client_get (client, key, NULL);
+
+ if (value == NULL) {
+ res = default_value;
+ } else {
+ res = gconf_value_get_int (value);
+ gconf_value_free (value);
+ }
+
+ g_object_unref (client);
+
+ return res;
+}
+
+
+static void
+purge_thumbnail_cache (void)
+{
+
+ char *path;
+ GList *files;
+ PurgeData purge_data;
+ GTimeVal current_time;
+
+ g_debug ("housekeeping: checking thumbnail cache size and freshness");
+
+ path = g_build_filename (g_get_home_dir (),
+ ".thumbnails",
+ "normal",
+ NULL);
+ files = read_dir_for_purge (path, NULL);
+ 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);
+
+ g_get_current_time (¤t_time);
+
+ purge_data.now = current_time.tv_sec;
+ purge_data.max_age = get_gconf_int_with_nonzero_default (GCONF_THUMB_AGE, DEFAULT_MAX_AGE_IN_DAYS) * 24 * 60 * 60;
+ purge_data.max_size = get_gconf_int_with_nonzero_default (GCONF_THUMB_SIZE, DEFAULT_MAX_SIZE_IN_MB) * 1024 * 1024;
+ purge_data.total_size = 0;
+
+ 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;
+ 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);
+}
+
+
+static gboolean
+do_cleanup (GsdHousekeepingManager *manager)
+{
+ purge_thumbnail_cache ();
+ return TRUE;
+}
+
+
+static gboolean
+do_cleanup_once (GsdHousekeepingManager *manager)
+{
+ do_cleanup (manager);
+ manager->priv->short_term_cb = 0;
+ return FALSE;
+}
+
+
+static void
+do_cleanup_soon (GsdHousekeepingManager *manager)
+{
+ if (manager->priv->short_term_cb == 0) {
+ g_debug ("housekeeping: will tidy up in 2 minutes");
+ manager->priv->short_term_cb = g_timeout_add_seconds (INTERVAL_TWO_MINUTES,
+ (GSourceFunc) do_cleanup_once,
+ manager);
+ }
+}
+
+
+static void
+bindings_callback (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ GsdHousekeepingManager *manager)
+{
+ do_cleanup_soon (manager);
+}
+
+
+static void
+register_config_callback (GsdHousekeepingManager *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_housekeeping_manager_start (GsdHousekeepingManager *manager,
+ GError **error)
+{
+ g_debug ("Starting housekeeping manager");
+ gnome_settings_profile_start (NULL);
+
+ register_config_callback (manager,
+ GCONF_THUMB_BINDING_DIR,
+ (GConfClientNotifyFunc) bindings_callback);
+
+ /* Clean once, a few minutes after start-up */
+ do_cleanup_soon (manager);
+
+ /* Clean periodically, on a daily basis. */
+ manager->priv->long_term_cb = g_timeout_add_seconds (INTERVAL_ONCE_A_DAY,
+ (GSourceFunc) do_cleanup,
+ manager);
+ gnome_settings_profile_end (NULL);
+
+ return TRUE;
+}
+
+
+void
+gsd_housekeeping_manager_stop (GsdHousekeepingManager *manager)
+{
+ g_debug ("Stopping housekeeping manager");
+
+ if (manager->priv->long_term_cb) {
+ g_source_remove (manager->priv->long_term_cb);
+ manager->priv->long_term_cb = 0;
+ }
+
+ if (manager->priv->short_term_cb) {
+ g_source_remove (manager->priv->short_term_cb);
+ manager->priv->short_term_cb = 0;
+ }
+
+}
+
+
+static void
+gsd_housekeeping_manager_class_init (GsdHousekeepingManagerClass *klass)
+{
+ g_type_class_add_private (klass, sizeof (GsdHousekeepingManagerPrivate));
+}
+
+
+static void
+gsd_housekeeping_manager_init (GsdHousekeepingManager *manager)
+{
+ manager->priv = GSD_HOUSEKEEPING_MANAGER_GET_PRIVATE (manager);
+
+}
+
+
+GsdHousekeepingManager *
+gsd_housekeeping_manager_new (void)
+{
+ if (manager_object != NULL) {
+ g_object_ref (manager_object);
+ } else {
+ manager_object = g_object_new (GSD_TYPE_HOUSEKEEPING_MANAGER, NULL);
+ g_object_add_weak_pointer (manager_object,
+ (gpointer *) &manager_object);
+ }
+
+ return GSD_HOUSEKEEPING_MANAGER (manager_object);
+}
Added: trunk/plugins/housekeeping/gsd-housekeeping-manager.h
==============================================================================
--- (empty file)
+++ trunk/plugins/housekeeping/gsd-housekeeping-manager.h Fri Mar 28 12:09:56 2008
@@ -0,0 +1,55 @@
+/* -*- 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_HOUSEKEEPING_MANAGER_H
+#define __GSD_HOUSEKEEPING_MANAGER_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GSD_TYPE_HOUSEKEEPING_MANAGER (gsd_housekeeping_manager_get_type ())
+#define GSD_HOUSEKEEPING_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_HOUSEKEEPING_MANAGER, GsdHousekeepingManager))
+#define GSD_HOUSEKEEPING_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_HOUSEKEEPING_MANAGER, GsdHousekeepingManagerClass))
+#define GSD_IS_HOUSEKEEPING_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_HOUSEKEEPING_MANAGER))
+#define GSD_IS_HOUSEKEEPING_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_HOUSEKEEPING_MANAGER))
+#define GSD_HOUSEKEEPING_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_HOUSEKEEPING_MANAGER, GsdHousekeepingManagerClass))
+
+typedef struct GsdHousekeepingManagerPrivate GsdHousekeepingManagerPrivate;
+
+typedef struct {
+ GObject parent;
+ GsdHousekeepingManagerPrivate *priv;
+} GsdHousekeepingManager;
+
+typedef struct {
+ GObjectClass parent_class;
+} GsdHousekeepingManagerClass;
+
+GType gsd_housekeeping_manager_get_type (void);
+
+GsdHousekeepingManager * gsd_housekeeping_manager_new (void);
+gboolean gsd_housekeeping_manager_start (GsdHousekeepingManager *manager,
+ GError **error);
+void gsd_housekeeping_manager_stop (GsdHousekeepingManager *manager);
+
+G_END_DECLS
+
+#endif /* __GSD_HOUSEKEEPING_MANAGER_H */
Added: trunk/plugins/housekeeping/gsd-housekeeping-plugin.c
==============================================================================
--- (empty file)
+++ trunk/plugins/housekeeping/gsd-housekeeping-plugin.c Fri Mar 28 12:09:56 2008
@@ -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-housekeeping-plugin.h"
+#include "gsd-housekeeping-manager.h"
+
+struct GsdHousekeepingPluginPrivate {
+ GsdHousekeepingManager *manager;
+};
+
+#define GSD_HOUSEKEEPING_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_HOUSEKEEPING_PLUGIN, GsdHousekeepingPluginPrivate))
+
+GNOME_SETTINGS_PLUGIN_REGISTER (GsdHousekeepingPlugin, gsd_housekeeping_plugin)
+
+static void
+gsd_housekeeping_plugin_init (GsdHousekeepingPlugin *plugin)
+{
+ plugin->priv = GSD_HOUSEKEEPING_PLUGIN_GET_PRIVATE (plugin);
+
+ g_debug ("GsdHousekeepingPlugin initializing");
+
+ plugin->priv->manager = gsd_housekeeping_manager_new ();
+}
+
+static void
+gsd_housekeeping_plugin_finalize (GObject *object)
+{
+ GsdHousekeepingPlugin *plugin;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (GSD_IS_HOUSEKEEPING_PLUGIN (object));
+
+ g_debug ("GsdHousekeepingPlugin finalizing");
+
+ plugin = GSD_HOUSEKEEPING_PLUGIN (object);
+
+ g_return_if_fail (plugin->priv != NULL);
+
+ if (plugin->priv->manager != NULL) {
+ g_object_unref (plugin->priv->manager);
+ }
+
+ G_OBJECT_CLASS (gsd_housekeeping_plugin_parent_class)->finalize (object);
+}
+
+static void
+impl_activate (GnomeSettingsPlugin *plugin)
+{
+ gboolean res;
+ GError *error;
+
+ g_debug ("Activating housekeeping plugin");
+
+ error = NULL;
+ res = gsd_housekeeping_manager_start (GSD_HOUSEKEEPING_PLUGIN (plugin)->priv->manager, &error);
+ if (! res) {
+ g_warning ("Unable to start housekeeping manager: %s", error->message);
+ g_error_free (error);
+ }
+}
+
+static void
+impl_deactivate (GnomeSettingsPlugin *plugin)
+{
+ g_debug ("Deactivating housekeeping plugin");
+}
+
+static void
+gsd_housekeeping_plugin_class_init (GsdHousekeepingPluginClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass);
+
+ object_class->finalize = gsd_housekeeping_plugin_finalize;
+
+ plugin_class->activate = impl_activate;
+ plugin_class->deactivate = impl_deactivate;
+
+ g_type_class_add_private (klass, sizeof (GsdHousekeepingPluginPrivate));
+}
Added: trunk/plugins/housekeeping/gsd-housekeeping-plugin.h
==============================================================================
--- (empty file)
+++ trunk/plugins/housekeeping/gsd-housekeeping-plugin.h Fri Mar 28 12:09:56 2008
@@ -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, 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_HOUSEKEEPING_PLUGIN_H__
+#define __GSD_HOUSEKEEPING_PLUGIN_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gmodule.h>
+
+#include "gnome-settings-plugin.h"
+
+G_BEGIN_DECLS
+
+#define GSD_TYPE_HOUSEKEEPING_PLUGIN (gsd_housekeeping_plugin_get_type ())
+#define GSD_HOUSEKEEPING_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_HOUSEKEEPING_PLUGIN, GsdHousekeepingPlugin))
+#define GSD_HOUSEKEEPING_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_HOUSEKEEPING_PLUGIN, GsdHousekeepingPluginClass))
+#define GSD_IS_HOUSEKEEPING_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_HOUSEKEEPING_PLUGIN))
+#define GSD_IS_HOUSEKEEPING_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_HOUSEKEEPING_PLUGIN))
+#define GSD_HOUSEKEEPING_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_HOUSEKEEPING_PLUGIN, GsdHousekeepingPluginClass))
+
+typedef struct GsdHousekeepingPluginPrivate GsdHousekeepingPluginPrivate;
+
+typedef struct {
+ GnomeSettingsPlugin parent;
+ GsdHousekeepingPluginPrivate *priv;
+} GsdHousekeepingPlugin;
+
+typedef struct {
+ GnomeSettingsPluginClass parent_class;
+} GsdHousekeepingPluginClass;
+
+GType gsd_housekeeping_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_HOUSEKEEPING_PLUGIN_H__ */
Added: trunk/plugins/housekeeping/housekeeping.gnome-settings-plugin.in
==============================================================================
--- (empty file)
+++ trunk/plugins/housekeeping/housekeeping.gnome-settings-plugin.in Fri Mar 28 12:09:56 2008
@@ -0,0 +1,8 @@
+[GNOME Settings Plugin]
+Module=housekeeping
+IAge=0
+_Name=Housekeeping
+_Description=Automatically prunes thumbnail caches and other transient files
+Authors=Michael J. Chudobiak
+Copyright=Copyright  2008 Michael J. Chudobiak
+Website=
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]