[tracker/urho-sync] Start save of backup over DBus after queue's commit
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/urho-sync] Start save of backup over DBus after queue's commit
- Date: Mon, 24 Aug 2009 14:15:34 +0000 (UTC)
commit 28e0498331c6fe0914528cd17f035339931bfa53
Author: Philip Van Hoof <philip codeminded be>
Date: Mon Aug 24 16:14:44 2009 +0200
Start save of backup over DBus after queue's commit
src/tracker-store/tracker-backup.c | 39 ++++++++++++++++++++++++-----------
1 files changed, 27 insertions(+), 12 deletions(-)
---
diff --git a/src/tracker-store/tracker-backup.c b/src/tracker-store/tracker-backup.c
index 4430e4e..007e5a3 100644
--- a/src/tracker-store/tracker-backup.c
+++ b/src/tracker-store/tracker-backup.c
@@ -36,6 +36,7 @@ typedef struct {
DBusGMethodInvocation *context;
guint request_id;
gboolean play_journal;
+ GFile *destination, *journal;
} TrackerDBusMethodInfo;
G_DEFINE_TYPE (TrackerBackup, tracker_backup, G_TYPE_OBJECT)
@@ -59,7 +60,17 @@ tracker_backup_new (void)
static void
destroy_method_info (gpointer user_data)
{
- g_slice_free (TrackerDBusMethodInfo, user_data);
+ TrackerDBusMethodInfo *info = user_data;
+
+ if (info->destination) {
+ g_object_unref (info->destination);
+ }
+
+ if (info->journal) {
+ g_object_unref (info->journal);
+ }
+
+ g_free (info);
}
static void
@@ -84,6 +95,16 @@ backup_callback (GError *error, gpointer user_data)
tracker_dbus_request_success (info->request_id);
}
+static void
+on_batch_commit (gpointer user_data)
+{
+ TrackerDBusMethodInfo *info = user_data;
+
+ tracker_data_backup_save (info->destination, info->journal,
+ backup_callback,
+ info, destroy_method_info);
+}
+
void
tracker_backup_save (TrackerBackup *object,
const gchar *destination_uri,
@@ -93,7 +114,6 @@ tracker_backup_save (TrackerBackup *object,
{
guint request_id;
TrackerDBusMethodInfo *info;
- GFile *destination, *journal;
request_id = tracker_dbus_get_next_request_id ();
@@ -101,21 +121,16 @@ tracker_backup_save (TrackerBackup *object,
"DBus request to save backup into '%s'",
destination_uri);
- destination = g_file_new_for_uri (destination_uri);
- journal = g_file_new_for_uri (journal_uri);
- info = g_slice_new (TrackerDBusMethodInfo);
+ info = g_new0 (TrackerDBusMethodInfo, 1);
info->request_id = request_id;
info->context = context;
info->play_journal = FALSE;
+ info->destination = g_file_new_for_uri (destination_uri);
+ info->journal = g_file_new_for_uri (journal_uri);
- tracker_data_backup_save (destination, journal,
- backup_callback,
- info, destroy_method_info);
-
- g_object_unref (destination);
- g_object_unref (journal);
+ tracker_store_queue_commit (on_batch_commit, info, NULL);
}
void
@@ -138,7 +153,7 @@ tracker_backup_restore (TrackerBackup *object,
destination = g_file_new_for_uri (backup_uri);
journal = g_file_new_for_uri (journal_uri);
- info = g_slice_new (TrackerDBusMethodInfo);
+ info = g_new0 (TrackerDBusMethodInfo, 1);
info->request_id = request_id;
info->context = context;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]