summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Hertzfeld <andy@src.gnome.org>2001-04-05 01:22:51 +0000
committerAndy Hertzfeld <andy@src.gnome.org>2001-04-05 01:22:51 +0000
commit6d5a64fd438530181185530665ed2b7636e72443 (patch)
tree0c0f36470a632bcb65711dcfbf3dc6a515b39389
parentc1967c9298dbf9e5ce82ee18cd5d0090e016f205 (diff)
downloadnautilus-6d5a64fd438530181185530665ed2b7636e72443.tar.gz
if there is no annotation text, delete the annotation.
* libnautilus-extensions/nautilus-annotation.c: (nautilus_annotation_add_annotation): if there is no annotation text, delete the annotation. * libnautilus-extensions/nautilus-icon-canvas-item.c: (create_annotation): changed the annotation color/transparency to be more saturated, as specified by Arlo.
-rw-r--r--ChangeLog11
-rw-r--r--libnautilus-extensions/nautilus-annotation.c34
-rw-r--r--libnautilus-extensions/nautilus-icon-canvas-item.c2
-rw-r--r--libnautilus-private/nautilus-annotation.c34
-rw-r--r--libnautilus-private/nautilus-icon-canvas-item.c2
5 files changed, 77 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index c819e861e..5c930b269 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2001-04-04 Andy Hertzfeld <andy@eazel.com>
+ * libnautilus-extensions/nautilus-annotation.c:
+ (nautilus_annotation_add_annotation):
+ if there is no annotation text, delete the annotation.
+
+ * libnautilus-extensions/nautilus-icon-canvas-item.c:
+ (create_annotation):
+ changed the annotation color/transparency to be more saturated,
+ as specified by Arlo.
+
+2001-04-04 Andy Hertzfeld <andy@eazel.com>
+
* libnautilus-extensions/nautilus-canvas-note-item.c:
(update_item_bounding_box), (draw_item_aa_text),
(nautilus_canvas_note_item_update):
diff --git a/libnautilus-extensions/nautilus-annotation.c b/libnautilus-extensions/nautilus-annotation.c
index 990073db7..aa1a177be 100644
--- a/libnautilus-extensions/nautilus-annotation.c
+++ b/libnautilus-extensions/nautilus-annotation.c
@@ -1043,15 +1043,19 @@ void nautilus_annotation_add_annotation (NautilusFile *file,
char *digest;
char *annotations;
char *info_str;
+ char *annotation_path;
time_t date_stamp;
xmlDocPtr xml_document;
xmlNodePtr root_node, node;
+ gboolean has_annotation, has_new_annotation;
/* we can't handle directories yet, so just return. */
if (nautilus_file_is_directory (file)) {
return;
}
+ has_new_annotation = annotation_text != NULL && strlen (annotation_text) > 0;
+
/* fetch the local annotation, if one exists */
digest = nautilus_file_get_metadata (file, NAUTILUS_METADATA_KEY_FILE_DIGEST, NULL);
@@ -1066,9 +1070,35 @@ void nautilus_annotation_add_annotation (NautilusFile *file,
/* there's a digest, so we if we have the annotations for the file cached locally */
annotations = look_up_local_annotation (file, digest);
+ has_annotation = annotations != NULL && strlen (annotations) > 0;
+
+ /* handle the case of no annotation, by removing it if necessary */
+ if (!has_new_annotation) {
+ if (has_annotation) {
+ /* delete the annotation */
+ annotation_path = get_annotation_path (digest);
+ unlink (annotation_path);
+
+ /* set the info to indicate no notes available */
+ time (&date_stamp);
+ info_str = g_strdup_printf ("%lu:%d", date_stamp, 0);
+ nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_NOTES_INFO, NULL, info_str);
+ g_free (info_str);
+
+ nautilus_file_emit_changed (file);
+
+ g_free (annotation_path);
+ }
+
+ g_free (digest);
+ g_free (annotations);
+ return;
+ }
- /* no annotation exists, so create the initial xml document from scratch */
- if (annotations == NULL || strlen (annotations) == 0) {
+ /* there is a new annotation, bu tno current annotation exists, so create the
+ * initial xml document from scratch
+ */
+ if (!has_annotation) {
xml_document = xmlNewDoc ("1.0");
/* create the header node, with the digest attribute */
root_node = xmlNewDocNode (xml_document, NULL, "annotations", NULL);
diff --git a/libnautilus-extensions/nautilus-icon-canvas-item.c b/libnautilus-extensions/nautilus-icon-canvas-item.c
index 79b63b0a8..66f13046a 100644
--- a/libnautilus-extensions/nautilus-icon-canvas-item.c
+++ b/libnautilus-extensions/nautilus-icon-canvas-item.c
@@ -1883,7 +1883,7 @@ create_annotation (NautilusIconCanvasItem *icon_item, int emblem_index)
left = icon_rect.x0 + 8.0;
top = icon_rect.y0 + 8.0;
- fill_color = 0xDDDD99E0;
+ fill_color = 0xFFFF75E5;
outline_color = 0x000000FF;
canvas = GNOME_CANVAS_ITEM (icon_item)->canvas;
diff --git a/libnautilus-private/nautilus-annotation.c b/libnautilus-private/nautilus-annotation.c
index 990073db7..aa1a177be 100644
--- a/libnautilus-private/nautilus-annotation.c
+++ b/libnautilus-private/nautilus-annotation.c
@@ -1043,15 +1043,19 @@ void nautilus_annotation_add_annotation (NautilusFile *file,
char *digest;
char *annotations;
char *info_str;
+ char *annotation_path;
time_t date_stamp;
xmlDocPtr xml_document;
xmlNodePtr root_node, node;
+ gboolean has_annotation, has_new_annotation;
/* we can't handle directories yet, so just return. */
if (nautilus_file_is_directory (file)) {
return;
}
+ has_new_annotation = annotation_text != NULL && strlen (annotation_text) > 0;
+
/* fetch the local annotation, if one exists */
digest = nautilus_file_get_metadata (file, NAUTILUS_METADATA_KEY_FILE_DIGEST, NULL);
@@ -1066,9 +1070,35 @@ void nautilus_annotation_add_annotation (NautilusFile *file,
/* there's a digest, so we if we have the annotations for the file cached locally */
annotations = look_up_local_annotation (file, digest);
+ has_annotation = annotations != NULL && strlen (annotations) > 0;
+
+ /* handle the case of no annotation, by removing it if necessary */
+ if (!has_new_annotation) {
+ if (has_annotation) {
+ /* delete the annotation */
+ annotation_path = get_annotation_path (digest);
+ unlink (annotation_path);
+
+ /* set the info to indicate no notes available */
+ time (&date_stamp);
+ info_str = g_strdup_printf ("%lu:%d", date_stamp, 0);
+ nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_NOTES_INFO, NULL, info_str);
+ g_free (info_str);
+
+ nautilus_file_emit_changed (file);
+
+ g_free (annotation_path);
+ }
+
+ g_free (digest);
+ g_free (annotations);
+ return;
+ }
- /* no annotation exists, so create the initial xml document from scratch */
- if (annotations == NULL || strlen (annotations) == 0) {
+ /* there is a new annotation, bu tno current annotation exists, so create the
+ * initial xml document from scratch
+ */
+ if (!has_annotation) {
xml_document = xmlNewDoc ("1.0");
/* create the header node, with the digest attribute */
root_node = xmlNewDocNode (xml_document, NULL, "annotations", NULL);
diff --git a/libnautilus-private/nautilus-icon-canvas-item.c b/libnautilus-private/nautilus-icon-canvas-item.c
index 79b63b0a8..66f13046a 100644
--- a/libnautilus-private/nautilus-icon-canvas-item.c
+++ b/libnautilus-private/nautilus-icon-canvas-item.c
@@ -1883,7 +1883,7 @@ create_annotation (NautilusIconCanvasItem *icon_item, int emblem_index)
left = icon_rect.x0 + 8.0;
top = icon_rect.y0 + 8.0;
- fill_color = 0xDDDD99E0;
+ fill_color = 0xFFFF75E5;
outline_color = 0x000000FF;
canvas = GNOME_CANVAS_ITEM (icon_item)->canvas;