notes emblem is a reserved name, and does not show up in lists.

2003-03-18  Alexander Larsson  <alexl@redhat.com>

	* libnautilus-private/nautilus-emblem-utils.c:
	(is_reserved_keyword), (nautilus_emblem_should_show_in_list):
	notes emblem is a reserved name, and does not show up in lists.

	* libnautilus-private/nautilus-file.h:
	Added notes emblem name

	* libnautilus-private/nautilus-file.c: (file_has_note),
	(get_automatic_emblems_as_integer),
	(prepend_automatic_emblem_names):
	Implement automatic notes emblem.
This commit is contained in:
Alexander Larsson 2003-03-18 18:12:14 +00:00 committed by Alexander Larsson
parent 2a15d316a7
commit e8c0ad97c2
4 changed files with 41 additions and 0 deletions

View file

@ -1,3 +1,17 @@
2003-03-18 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-emblem-utils.c:
(is_reserved_keyword), (nautilus_emblem_should_show_in_list):
notes emblem is a reserved name, and does not show up in lists.
* libnautilus-private/nautilus-file.h:
Added notes emblem name
* libnautilus-private/nautilus-file.c: (file_has_note),
(get_automatic_emblems_as_integer),
(prepend_automatic_emblem_names):
Implement automatic notes emblem.
2003-03-18 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-icon-container.c (handle_icon_button_press):

View file

@ -43,6 +43,7 @@
#define EMBLEM_NAME_SYMLINK "emblem-symbolic-link"
#define EMBLEM_NAME_NOREAD "emblem-noread"
#define EMBLEM_NAME_NOWRITE "emblem-nowrite"
#define EMBLEM_NAME_NOTE "emblem-note"
GList *
nautilus_emblem_list_availible (void)
@ -94,6 +95,9 @@ is_reserved_keyword (const char *keyword)
if (eel_strcasecmp (keyword, NAUTILUS_FILE_EMBLEM_NAME_SYMBOLIC_LINK) == 0) {
return TRUE;
}
if (eel_strcasecmp (keyword, NAUTILUS_FILE_EMBLEM_NAME_NOTE) == 0) {
return TRUE;
}
availible = nautilus_emblem_list_availible ();
icon_name = nautilus_emblem_get_icon_name_from_keyword (keyword);
@ -121,6 +125,9 @@ nautilus_emblem_should_show_in_list (const char *emblem)
if (strcmp (emblem, EMBLEM_NAME_NOWRITE) == 0) {
return FALSE;
}
if (strcmp (emblem, EMBLEM_NAME_NOTE) == 0) {
return FALSE;
}
return TRUE;
}

View file

@ -1668,6 +1668,19 @@ compare_by_directory_name (NautilusFile *file_1, NautilusFile *file_2)
return compare;
}
static gboolean
file_has_note (NautilusFile *file)
{
char *note;
gboolean res;
note = nautilus_file_get_metadata (file, NAUTILUS_METADATA_KEY_ANNOTATION, NULL);
res = note != NULL && note[0] != 0;
g_free (note);
return res;
}
static int
get_automatic_emblems_as_integer (NautilusFile *file)
{
@ -1681,6 +1694,8 @@ get_automatic_emblems_as_integer (NautilusFile *file)
integer <<= 1;
integer |= !nautilus_file_can_write (file);
integer <<= 1;
integer |= file_has_note (file);
integer <<= 1;
#if TRASH_IS_FAST_ENOUGH
integer |= nautilus_file_is_in_trash (file);
#endif
@ -1700,6 +1715,10 @@ prepend_automatic_emblem_names (NautilusFile *file,
(names, g_strdup (NAUTILUS_FILE_EMBLEM_NAME_TRASH));
}
#endif
if (file_has_note (file)) {
names = g_list_prepend
(names, g_strdup (NAUTILUS_FILE_EMBLEM_NAME_NOTE));
}
if (!nautilus_file_can_write (file)) {
names = g_list_prepend
(names, g_strdup (NAUTILUS_FILE_EMBLEM_NAME_CANT_WRITE));

View file

@ -71,6 +71,7 @@ typedef enum {
#define NAUTILUS_FILE_EMBLEM_NAME_CANT_READ "noread"
#define NAUTILUS_FILE_EMBLEM_NAME_CANT_WRITE "nowrite"
#define NAUTILUS_FILE_EMBLEM_NAME_TRASH "trash"
#define NAUTILUS_FILE_EMBLEM_NAME_NOTE "note"
typedef void (*NautilusFileCallback) (NautilusFile *file,
gpointer callback_data);