=== modified file 'libnautilus-private/nautilus-file-operations.c'
--- libnautilus-private/nautilus-file-operations.c	2012-02-02 12:48:30 +0000
+++ libnautilus-private/nautilus-file-operations.c	2012-02-06 12:04:38 +0000
@@ -64,6 +64,8 @@
 #include "nautilus-file-utilities.h"
 #include "nautilus-file-conflict-dialog.h"
 
+#include <zeitgeist.h>
+
 /* TODO: TESTING!!! */
 
 typedef struct {
@@ -189,6 +191,103 @@
 #define MERGE_ALL _("Merge _All")
 #define COPY_FORCE _("Copy _Anyway")
 
+#define ZEITGEIST_NAUTILUS_ACTOR "application://nautilus.desktop"
+
+static void
+send_event_to_zeitgeist (ZeitgeistEvent *event)
+{
+    ZeitgeistLog *log = zeitgeist_log_get_default ();
+    zeitgeist_log_insert_events_no_reply (log, event, NULL);
+}
+
+typedef struct {
+    const char *event_interpretation;
+    //char *event_origin;
+    GFile *file;
+    gchar *original_uri; // for MOVE_EVENT
+} _ZeitgeistFileEventData;
+
+static void
+_log_zeitgeist_event_for_file_cb (GObject *source_object,
+        GAsyncResult *res, gpointer user_data)
+{
+    _ZeitgeistFileEventData *data;
+    GError *error;
+    GFileInfo *info;
+    gchar *uri;
+    gchar *origin;
+    const gchar *display_name;
+    const gchar *mimetype;
+    
+    data = user_data;
+
+    info = g_file_query_info_finish (G_FILE (source_object), res, &error);
+
+    if (info) {
+        uri = g_file_get_uri (data->file);
+        origin = g_path_get_dirname (uri);
+        display_name = g_file_info_get_display_name (info);
+        mimetype = g_file_info_get_content_type (info);
+    } else {
+        g_warning ("Error getting info: %s\n", error->message);
+        g_error_free (error);
+        g_object_unref (data->file);
+        g_free (data->original_uri);
+        g_free (data);
+        return; // skip this event
+    }
+
+    ZeitgeistSubject *subject = zeitgeist_subject_new_full (
+        (data->original_uri) ? (data->original_uri) : uri,
+        NULL, // subject interpretation - auto-guess
+        NULL, // suject manifestation - auto-guess
+        mimetype,
+        origin,
+        display_name,
+        NULL // storage - auto-guess
+    );
+
+    if (data->original_uri)
+        zeitgeist_subject_set_current_uri (subject, uri);
+
+    g_free (uri);
+    g_free (origin);
+    g_object_unref (info);
+
+    if (subject) {
+        ZeitgeistEvent *event = zeitgeist_event_new_full (
+            data->event_interpretation,
+            ZEITGEIST_ZG_USER_ACTIVITY,
+            ZEITGEIST_NAUTILUS_ACTOR,
+            subject, NULL);
+        send_event_to_zeitgeist (event);
+    }
+
+    g_object_unref (data->file);
+    g_free (data->original_uri);
+    g_free (data);
+}
+
+static void
+log_zeitgeist_event_for_file_no_reply (const char *event_interpretation,
+    GFile *file, gchar *original_uri)
+{
+    _ZeitgeistFileEventData *data;
+    data = g_new0 (_ZeitgeistFileEventData, 1);
+
+    data->event_interpretation = event_interpretation;
+    data->original_uri = original_uri;
+    data->file = file;
+
+    g_file_query_info_async (file,
+        G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME ","
+            G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+        G_FILE_QUERY_INFO_NONE,
+        G_PRIORITY_DEFAULT,
+        NULL,
+        _log_zeitgeist_event_for_file_cb, data);
+}
+
 static void
 mark_desktop_file_trusted (CommonJob *common,
 			   GCancellable *cancellable,
@@ -1835,6 +1934,35 @@
 
 	job = user_data;
 
+	// Send event to Zeitgeist for deletions/trash
+    GList *file_iter = job->files;
+	while (file_iter != NULL) {
+		gchar *uri = g_file_get_uri (file_iter->data);
+		gchar *origin = g_path_get_dirname (uri);
+        gchar *parse_name = g_file_get_parse_name (file_iter->data);
+		gchar *display_name = g_path_get_basename (parse_name);
+		ZeitgeistEvent *event = zeitgeist_event_new_full (
+			ZEITGEIST_ZG_DELETE_EVENT,
+			ZEITGEIST_ZG_USER_ACTIVITY,
+			ZEITGEIST_NAUTILUS_ACTOR,
+			zeitgeist_subject_new_full (
+				uri,
+				NULL, // subject interpretation - auto-guess
+				NULL, // suject manifestation - auto-guess
+				NULL, // mime-type
+				origin,
+				display_name,
+				NULL // storage - auto-guess
+			), NULL);
+		send_event_to_zeitgeist (event);
+		g_free (uri);
+		g_free (origin);
+        g_free (parse_name);
+		g_free (display_name);
+        file_iter = g_list_next (file_iter);
+	}
+	// ---
+
 	g_list_free_full (job->files, g_object_unref);
 
 	if (job->done_callback) {
@@ -4433,6 +4561,22 @@
 		job->done_callback (job->debuting_files, job->done_callback_data);
 	}
 
+	// Send event to Zeitgeist
+	GHashTableIter iter;
+	GFile *file;
+	gboolean done;
+	g_hash_table_iter_init (&iter, job->debuting_files);
+	while (g_hash_table_iter_next (&iter, (void **) &file, (void **) &done)) {
+		if (done) { // operation was completed successfully for this file
+            g_object_ref (file);
+            // FIXME: Set event origin to the original file URI, if we
+            //        can somehow figure out which one it is.
+            log_zeitgeist_event_for_file_no_reply (
+                ZEITGEIST_ZG_CREATE_EVENT, file, NULL);
+		}
+	}
+	// ---
+
 	g_list_free_full (job->files, g_object_unref);
 	if (job->destination) {
 		g_object_unref (job->destination);
@@ -4978,6 +5122,19 @@
 		job->done_callback (job->debuting_files, job->done_callback_data);
 	}
 
+	// Send event to Zeitgeist for moved files (not renaming)
+    GList *file_iter = job->files;
+	while (file_iter != NULL) {
+        char *basename = g_file_get_basename (file_iter->data);
+        GFile *new_file = g_file_get_child (job->destination, basename);
+        g_free (basename);
+
+        log_zeitgeist_event_for_file_no_reply (ZEITGEIST_ZG_MOVE_EVENT,
+            new_file, g_file_get_uri (file_iter->data));
+        file_iter = g_list_next (file_iter);
+	}
+	// ---
+
 	g_list_free_full (job->files, g_object_unref);
 	g_object_unref (job->destination);
 	g_hash_table_unref (job->debuting_files);
@@ -5295,6 +5452,22 @@
 		job->done_callback (job->debuting_files, job->done_callback_data);
 	}
 
+	// Send event to Zeitgeist
+	GHashTableIter iter;
+	GFile *file;
+	gboolean done;
+	g_hash_table_iter_init (&iter, job->debuting_files);
+	while (g_hash_table_iter_next (&iter, (void **) &file, (void **) &done)) {
+		if (done) { // operation was completed successfully for this file
+            g_object_ref (file);
+            // FIXME: Set event origin to the original file URI, if we
+            //        can somehow figure out which one it is.
+            log_zeitgeist_event_for_file_no_reply (
+                ZEITGEIST_ZG_CREATE_EVENT, file, NULL);
+		}
+	}
+	// ---
+
 	g_list_free_full (job->files, g_object_unref);
 	g_object_unref (job->destination);
 	g_hash_table_unref (job->debuting_files);
@@ -5726,6 +5899,14 @@
 		job->done_callback (job->created_file, job->done_callback_data);
 	}
 
+	// Send event to Zeitgeist
+    if (job->created_file) {
+        g_object_ref (job->created_file);
+        log_zeitgeist_event_for_file_no_reply (
+            ZEITGEIST_ZG_CREATE_EVENT, job->created_file, NULL);
+    }
+    // ---
+
 	g_object_unref (job->dest_dir);
 	if (job->src) {
 		g_object_unref (job->src);

=== modified file 'libnautilus-private/nautilus-file.c'
--- libnautilus-private/nautilus-file.c	2012-02-02 12:48:30 +0000
+++ libnautilus-private/nautilus-file.c	2012-02-06 11:41:04 +0000
@@ -88,6 +88,9 @@
 #define DEBUG_REF_PRINTF printf
 #endif
 
+#include <zeitgeist.h>
+#define ZEITGEIST_NAUTILUS_ACTOR "application://nautilus.desktop"
+
 /* Files that start with these characters sort after files that don't. */
 #define SORT_LAST_CHAR1 '.'
 #define SORT_LAST_CHAR2 '#'
@@ -1721,10 +1724,34 @@
 		old_name = g_strdup (eel_ref_str_peek (op->file->details->name));
 		
 		update_info_and_name (op->file, new_info);
-		
+
 		g_free (old_name);
 		
 		new_uri = nautilus_file_get_uri (op->file);
+
+		// Send event to Zeitgeist
+		ZeitgeistLog *log = zeitgeist_log_get_default ();
+		gchar *origin = g_path_get_dirname (new_uri);
+		ZeitgeistSubject *subject = zeitgeist_subject_new_full (
+			old_uri,
+			NULL, // subject interpretation - auto-guess
+			NULL, // subject manifestation - auto-guess
+			g_file_info_get_content_type (new_info), // const char*
+			origin,
+			new_name,
+			NULL // storage - auto-guess
+		);
+        zeitgeist_subject_set_current_uri (subject, new_uri);
+		g_free (origin);
+		// FIXME: zeitgeist_subject_set_current_uri ();
+		ZeitgeistEvent *event = zeitgeist_event_new_full (
+			ZEITGEIST_ZG_MOVE_EVENT,
+			ZEITGEIST_ZG_USER_ACTIVITY,
+			ZEITGEIST_NAUTILUS_ACTOR,
+			subject, NULL);
+		zeitgeist_log_insert_events_no_reply (log, event, NULL);
+		// ---
+		
 		nautilus_directory_moved (old_uri, new_uri);
 		g_free (new_uri);
 		g_free (old_uri);

