summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Hertzfeld <andy@src.gnome.org>2001-03-31 19:41:46 +0000
committerAndy Hertzfeld <andy@src.gnome.org>2001-03-31 19:41:46 +0000
commit55cf0f30faf0b804cf272ff6e9d726d13a2e8b7d (patch)
tree156b744a820f05b3da754d158143f1d57f304f14
parenta55fbe5bd79bf9baba28fdcde3d9697881cd8e4b (diff)
downloadnautilus-post-1_0_8.tar.gz
completed initial implmentation of creating and editing local annotations.post-1_0_8
* libnautilus-extensions/nautilus-annotation.c: (save_local_annotations), (nautilus_annotation_add_annotation): * src/file-manager/fm-annotation-window.c: (annotation_clicked_callback): completed initial implmentation of creating and editing local annotations.
-rw-r--r--ChangeLog8
-rw-r--r--libnautilus-extensions/nautilus-annotation.c14
-rw-r--r--libnautilus-private/nautilus-annotation.c14
-rw-r--r--src/file-manager/fm-annotation-window.c14
4 files changed, 49 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 4ee3e582f..d222ae161 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-03-31 Andy Hertzfeld <`andy@eazel.com>
+
+ * libnautilus-extensions/nautilus-annotation.c:
+ (save_local_annotations), (nautilus_annotation_add_annotation):
+ * src/file-manager/fm-annotation-window.c:
+ (annotation_clicked_callback):
+ completed initial implmentation of creating and editing local annotations.
+
2001-03-30 Andy Hertzfeld <andy@eazel.com>
diff --git a/libnautilus-extensions/nautilus-annotation.c b/libnautilus-extensions/nautilus-annotation.c
index b05aeb04c..990073db7 100644
--- a/libnautilus-extensions/nautilus-annotation.c
+++ b/libnautilus-extensions/nautilus-annotation.c
@@ -679,6 +679,12 @@ has_local_annotation (const char *digest)
static void
save_local_annotations (xmlDocPtr document, const char *digest)
{
+ char *path;
+
+ path = get_annotation_path (digest);
+ xmlSaveFile (path, document);
+
+ g_free (path);
}
/* utility routine to add the passed-in xml node to the file associated with the passed-in
@@ -1036,6 +1042,8 @@ void nautilus_annotation_add_annotation (NautilusFile *file,
{
char *digest;
char *annotations;
+ char *info_str;
+ time_t date_stamp;
xmlDocPtr xml_document;
xmlNodePtr root_node, node;
@@ -1088,6 +1096,12 @@ void nautilus_annotation_add_annotation (NautilusFile *file,
save_local_annotations (xml_document, digest);
/* update the metadata date and count */
+
+ time (&date_stamp);
+ info_str = g_strdup_printf ("%lu:%d", date_stamp, 1); /* FIXME: hardwired to 1 for now */
+
+ nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_NOTES_INFO, NULL, info_str);
+ g_free (info_str);
/* issue file changed symbol to update the emblem */
nautilus_file_emit_changed (file);
diff --git a/libnautilus-private/nautilus-annotation.c b/libnautilus-private/nautilus-annotation.c
index b05aeb04c..990073db7 100644
--- a/libnautilus-private/nautilus-annotation.c
+++ b/libnautilus-private/nautilus-annotation.c
@@ -679,6 +679,12 @@ has_local_annotation (const char *digest)
static void
save_local_annotations (xmlDocPtr document, const char *digest)
{
+ char *path;
+
+ path = get_annotation_path (digest);
+ xmlSaveFile (path, document);
+
+ g_free (path);
}
/* utility routine to add the passed-in xml node to the file associated with the passed-in
@@ -1036,6 +1042,8 @@ void nautilus_annotation_add_annotation (NautilusFile *file,
{
char *digest;
char *annotations;
+ char *info_str;
+ time_t date_stamp;
xmlDocPtr xml_document;
xmlNodePtr root_node, node;
@@ -1088,6 +1096,12 @@ void nautilus_annotation_add_annotation (NautilusFile *file,
save_local_annotations (xml_document, digest);
/* update the metadata date and count */
+
+ time (&date_stamp);
+ info_str = g_strdup_printf ("%lu:%d", date_stamp, 1); /* FIXME: hardwired to 1 for now */
+
+ nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_NOTES_INFO, NULL, info_str);
+ g_free (info_str);
/* issue file changed symbol to update the emblem */
nautilus_file_emit_changed (file);
diff --git a/src/file-manager/fm-annotation-window.c b/src/file-manager/fm-annotation-window.c
index 355008988..0c7f19812 100644
--- a/src/file-manager/fm-annotation-window.c
+++ b/src/file-manager/fm-annotation-window.c
@@ -252,8 +252,20 @@ create_options_table (FMAnnotationWindow *window)
static void
annotation_clicked_callback (GtkWidget *dialog, int which_button, gpointer user_data)
{
+ char *notes_text;
+ FMAnnotationWindow *window;
+
+ window = FM_ANNOTATION_WINDOW (dialog);
+
if (which_button == GNOME_OK) {
- g_message ("OK button %d clicked", which_button);
+ notes_text = gtk_editable_get_chars (GTK_EDITABLE (window->details->text_field), 0 , -1);
+
+ /* type and access fields hard-wired for now */
+ nautilus_annotation_add_annotation (window->details->file,
+ "text",
+ notes_text,
+ "local");
+ g_free (notes_text);
}
gtk_widget_destroy (dialog);
}