Author: post
Date: 2010-12-29 21:11:56 +0100 (Wed, 29 Dec 2010)
New Revision: 3720
Added:
trunk/librawstudio/rs-io-job-tagging.c
trunk/librawstudio/rs-io-job-tagging.h
Modified:
trunk/librawstudio/Makefile.am
trunk/librawstudio/rawstudio.h
trunk/librawstudio/rs-io.c
trunk/librawstudio/rs-io.h
Log:
Add Async job for restoring tags to database.
Modified: trunk/librawstudio/Makefile.am
===================================================================
--- trunk/librawstudio/Makefile.am 2010-12-29 20:08:32 UTC (rev 3719)
+++ trunk/librawstudio/Makefile.am 2010-12-29 20:11:56 UTC (rev 3720)
@@ -16,6 +16,7 @@
rs-io-job-checksum.h \
rs-io-job-metadata.h \
rs-io-job-prefetch.h \
+ rs-io-job-tagging.h \
rs-io.h \
rs-plugin.h \
rs-rawfile.h \
@@ -63,6 +64,7 @@
rs-io-job-checksum.c rs-io-job-checksum.h \
rs-io-job-metadata.c rs-io-job-metadata.h \
rs-io-job-prefetch.c rs-io-job-prefetch.h \
+ rs-io-job-tagging.c rs-io-job-tagging.h \
rs-io.c rs-io.h \
rs-plugin.c rs-plugin.h \
rs-rawfile.c rs-rawfile.h \
Modified: trunk/librawstudio/rawstudio.h
===================================================================
--- trunk/librawstudio/rawstudio.h 2010-12-29 20:08:32 UTC (rev 3719)
+++ trunk/librawstudio/rawstudio.h 2010-12-29 20:11:56 UTC (rev 3720)
@@ -33,6 +33,7 @@
#include "rs-io-job-checksum.h"
#include "rs-io-job-metadata.h"
#include "rs-io-job-prefetch.h"
+#include "rs-io-job-tagging.h"
#include "rs-io.h"
#include "rs-rawfile.h"
#include "rs-settings.h"
@@ -46,6 +47,7 @@
#include "rs-metadata.h"
#include "rs-lens.h"
#include "rs-lens-db.h"
+#include "rs-library.h"
#include "rs-filetypes.h"
#include "rs-plugin.h"
#include "rs-filter-param.h"
Added: trunk/librawstudio/rs-io-job-tagging.c
===================================================================
--- trunk/librawstudio/rs-io-job-tagging.c (rev 0)
+++ trunk/librawstudio/rs-io-job-tagging.c 2010-12-29 20:11:56 UTC (rev
3720)
@@ -0,0 +1,76 @@
+/*
+ * * Copyright (C) 2006-2010 Anders Brander <[email protected]>,
+ * * Anders Kvist <[email protected]> and Klaus Post <[email protected]>
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
+ */
+
+#include "rs-io-job-tagging.h"
+#include "rawstudio.h"
+
+typedef struct {
+ RSIoJob parent;
+ gboolean dispose_has_run;
+
+ gchar *path;
+} RSIoJobTagging;
+
+G_DEFINE_TYPE(RSIoJobTagging, rs_io_job_tagging, RS_TYPE_IO_JOB)
+
+static void
+execute(RSIoJob *job)
+{
+ RSIoJobTagging *tagging = RS_IO_JOB_TAGGING(job);
+
+ rs_library_restore_tags(tagging->path);
+}
+
+static void
+rs_io_job_tagging_dispose(GObject *object)
+{
+ RSIoJobTagging *tagging = RS_IO_JOB_TAGGING(object);
+ if (!tagging->dispose_has_run)
+ {
+ tagging->dispose_has_run = TRUE;
+
+ g_free(tagging->path);
+ }
+ G_OBJECT_CLASS(rs_io_job_tagging_parent_class)->dispose(object);
+}
+
+static void
+rs_io_job_tagging_class_init(RSIoJobTaggingClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
+ RSIoJobClass *job_class = RS_IO_JOB_CLASS(klass);
+
+ object_class->dispose = rs_io_job_tagging_dispose;
+ job_class->execute = execute;
+}
+
+static void
+rs_io_job_tagging_init(RSIoJobTagging *tagging)
+{
+}
+
+RSIoJob *
+rs_io_job_tagging_new(const gchar *path)
+{
+ RSIoJobTagging *tagging = g_object_new (RS_TYPE_IO_JOB_TAGGING, NULL);
+
+ tagging->path = g_strdup(path);
+
+ return RS_IO_JOB(tagging);
+}
Added: trunk/librawstudio/rs-io-job-tagging.h
===================================================================
--- trunk/librawstudio/rs-io-job-tagging.h (rev 0)
+++ trunk/librawstudio/rs-io-job-tagging.h 2010-12-29 20:11:56 UTC (rev
3720)
@@ -0,0 +1,46 @@
+/*
+ * * Copyright (C) 2006-2010 Anders Brander <[email protected]>,
+ * * Anders Kvist <[email protected]> and Klaus Post <[email protected]>
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
+ */
+
+#ifndef RS_IO_JOB_TAGGING_H
+#define RS_IO_JOB_TAGGING_H
+
+#include "rs-types.h"
+#include "rs-io-job.h"
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define RS_TYPE_IO_JOB_TAGGING rs_io_job_tagging_get_type()
+#define RS_IO_JOB_TAGGING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
RS_TYPE_IO_JOB_TAGGING, RSIoJobTagging))
+#define RS_IO_JOB_TAGGING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
RS_TYPE_IO_JOB_TAGGING, RSIoJobTaggingClass))
+#define RS_IS_IO_JOB_TAGGING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
RS_TYPE_IO_JOB_TAGGING))
+#define RS_IS_IO_JOB_TAGGING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
RS_TYPE_IO_JOB_TAGGING))
+#define RS_IO_JOB_TAGGING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
RS_TYPE_IO_JOB_TAGGING, RSIoJobTaggingClass))
+
+typedef struct {
+ RSIoJobClass parent_class;
+} RSIoJobTaggingClass;
+
+GType rs_io_job_tagging_get_type(void);
+
+RSIoJob *rs_io_job_tagging_new(const gchar *path);
+
+G_END_DECLS
+
+#endif /* RS_IO_JOB_TAGGING_H */
Modified: trunk/librawstudio/rs-io.c
===================================================================
--- trunk/librawstudio/rs-io.c 2010-12-29 20:08:32 UTC (rev 3719)
+++ trunk/librawstudio/rs-io.c 2010-12-29 20:11:56 UTC (rev 3720)
@@ -154,6 +154,23 @@
}
/**
+ * Restore tags of a new directory
+ * @param path Absolute path to a directory to restore tags to
+ * @param idle_class A user defined variable, this can be used with
rs_io_idle_cancel_class() to cancel a batch of queued reads
+ * @return A pointer to a RSIoJob, this can be used with rs_io_idle_cancel()
+ */
+const RSIoJob *
+rs_io_idle_restore_tags(const gchar *path, gint idle_class)
+{
+ init();
+
+ RSIoJob *job = rs_io_job_tagging_new(path);
+ rs_io_idle_add_job(job, idle_class, 50, NULL);
+
+ return job;
+}
+
+/**
* Cancel a complete class of idle requests
* @param idle_class The class identifier
*/
Modified: trunk/librawstudio/rs-io.h
===================================================================
--- trunk/librawstudio/rs-io.h 2010-12-29 20:08:32 UTC (rev 3719)
+++ trunk/librawstudio/rs-io.h 2010-12-29 20:11:56 UTC (rev 3720)
@@ -64,6 +64,15 @@
rs_io_idle_read_checksum(const gchar *path, gint idle_class, RSGotChecksumCB
callback, gpointer user_data);
/**
+ * Restore tags of a new directory
+ * @param path Absolute path to a directory to restore tags to
+ * @param idle_class A user defined variable, this can be used with
rs_io_idle_cancel_class() to cancel a batch of queued reads
+ * @return A pointer to a RSIoJob, this can be used with rs_io_idle_cancel()
+ */
+const RSIoJob *
+rs_io_idle_restore_tags(const gchar *path, gint idle_class);
+
+/**
* Cancel a complete class of idle requests
* @param idle_class The class identifier
*/
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit