Commit 0280cc18 authored by John Sullivan's avatar John Sullivan
Browse files

Fixed bug 1743 (Deleting a file in search results should cause

	it to update appropriately).

	The fix for this involved fixing bugs in nautilus_file_is_in_trash
	and making emblems behave more flexibly. We now have the ability
	to exclude certain emblems when displaying a file, so that
	the trash emblem shows up in search results but not regular
	list view. A happy side effect of the way this works is that
	the trash emblem now shows up in the sidebar for items (including
	directories) that are anywhere in the trash.

	* libnautilus-extensions/nautilus-file.h: Publicized names
	of emblems NautilusFile adds based on file state, so that
	file-displaying code could choose to exclude some of them.
	This included changing their names to start with NAUTILUS_
	* libnautilus-extensions/nautilus-file.c:
	(compare_emblem_names): updated for emblem name changes.
	(nautilus_file_get_emblem_names): updated for name changes.
	Also, always include EMBLEM_NAME_TRASH for files in trash,
	not just when the file is a search result. Soon we will be
	able to eliminate nautilus_file_is_search_result entirely.
	(nautilus_file_is_in_trash): Fixed several problems here.
	Don't bother checking for NULL; use _get_uri not
	_get_activation_uri so the test works at any point in the
	life of a NautilusFile; free the uri string; initialize
	trash_dir_uri so we don't try to unref an uninitialized
	variable in some cases.

	* libnautilus-extensions/nautilus-icon-factory.h,
	* libnautilus-extensions/nautilus-icon-factory.c:
	(nautilus_icon_factory_get_emblem_icons_for_file): Added
	parameter for emblem names to exclude when creating icons.

	* libnautilus-extensions/nautilus-string-list.c:
	(nautilus_string_list_new_from_string_list),
	(nautilus_string_list_free), (nautilus_string_list_contains):
	Made these functions allow NULL, as GList does.
	(nautilus_self_check_string_list): Added tests of NULL handling.

	* src/file-manager/fm-directory-view.h:
	(get_emblem_names_to_exclude): New function pointer for subclasses
	to override.
	(fm_directory_view_get_emblem_names_to_exclude): New function for
	subclasses to call.
	* src/file-manager/fm-directory-view.c:
	(real_get_emblem_names_to_exclude): New function, returns list
	containing NAUTILUS_FILE_EMBLEM_NAME_TRASH, so directory views by
	default don't show the trash emblem.
	(fm_directory_view_initialize_class): Wire up
	get_emblem_names_to_exclude.
	(fm_directory_view_get_emblem_names_to_exclude): New function,
	returns result of possibly overridden function pointer.

	* src/file-manager/fm-icon-view.c: (get_icon_images_callback):
	Use fm_directory_view_get_emblem_names_to_exclude when getting
	emblems for each icon.

	* src/file-manager/fm-list-view.c:
	(fm_list_view_get_emblem_pixbufs_for_file):
	Use fm_directory_view_get_emblem_names_to_exclude when getting
	emblems for each icon.

	* src/file-manager/fm-search-list-view.c:
	(fm_search_list_view_initialize_class): Override
	get_emblem_names_to_exclude with our real_get_emblem_names_to_exclude.
	(real_get_emblem_names_to_exclude): New function, returns NULL, so
	all emblems including the trash emblem will be displayed.

	* src/nautilus-sidebar-title.c: (update_emblems):
	Pass NULL for emblems-to-exclude when getting emblems for sidebar.
parent 845abc02
2000-08-11 John Sullivan <sullivan@eazel.com>
Fixed bug 1743 (Deleting a file in search results should cause
it to update appropriately).
The fix for this involved fixing bugs in nautilus_file_is_in_trash
and making emblems behave more flexibly. We now have the ability
to exclude certain emblems when displaying a file, so that
the trash emblem shows up in search results but not regular
list view. A happy side effect of the way this works is that
the trash emblem now shows up in the sidebar for items (including
directories) that are anywhere in the trash.
* libnautilus-extensions/nautilus-file.h: Publicized names
of emblems NautilusFile adds based on file state, so that
file-displaying code could choose to exclude some of them.
This included changing their names to start with NAUTILUS_
* libnautilus-extensions/nautilus-file.c:
(compare_emblem_names): updated for emblem name changes.
(nautilus_file_get_emblem_names): updated for name changes.
Also, always include EMBLEM_NAME_TRASH for files in trash,
not just when the file is a search result. Soon we will be
able to eliminate nautilus_file_is_search_result entirely.
(nautilus_file_is_in_trash): Fixed several problems here.
Don't bother checking for NULL; use _get_uri not
_get_activation_uri so the test works at any point in the
life of a NautilusFile; free the uri string; initialize
trash_dir_uri so we don't try to unref an uninitialized
variable in some cases.
* libnautilus-extensions/nautilus-icon-factory.h,
* libnautilus-extensions/nautilus-icon-factory.c:
(nautilus_icon_factory_get_emblem_icons_for_file): Added
parameter for emblem names to exclude when creating icons.
* libnautilus-extensions/nautilus-string-list.c:
(nautilus_string_list_new_from_string_list),
(nautilus_string_list_free), (nautilus_string_list_contains):
Made these functions allow NULL, as GList does.
(nautilus_self_check_string_list): Added tests of NULL handling.
* src/file-manager/fm-directory-view.h:
(get_emblem_names_to_exclude): New function pointer for subclasses
to override.
(fm_directory_view_get_emblem_names_to_exclude): New function for
subclasses to call.
* src/file-manager/fm-directory-view.c:
(real_get_emblem_names_to_exclude): New function, returns list
containing NAUTILUS_FILE_EMBLEM_NAME_TRASH, so directory views by
default don't show the trash emblem.
(fm_directory_view_initialize_class): Wire up
get_emblem_names_to_exclude.
(fm_directory_view_get_emblem_names_to_exclude): New function,
returns result of possibly overridden function pointer.
* src/file-manager/fm-icon-view.c: (get_icon_images_callback):
Use fm_directory_view_get_emblem_names_to_exclude when getting
emblems for each icon.
* src/file-manager/fm-list-view.c:
(fm_list_view_get_emblem_pixbufs_for_file):
Use fm_directory_view_get_emblem_names_to_exclude when getting
emblems for each icon.
* src/file-manager/fm-search-list-view.c:
(fm_search_list_view_initialize_class): Override
get_emblem_names_to_exclude with our real_get_emblem_names_to_exclude.
(real_get_emblem_names_to_exclude): New function, returns NULL, so
all emblems including the trash emblem will be displayed.
* src/nautilus-sidebar-title.c: (update_emblems):
Pass NULL for emblems-to-exclude when getting emblems for sidebar.
2000-08-11 Darin Adler <darin@eazel.com> 2000-08-11 Darin Adler <darin@eazel.com>
* HACKING: * HACKING:
......
...@@ -56,11 +56,6 @@ typedef enum { ...@@ -56,11 +56,6 @@ typedef enum {
NAUTILUS_DATE_TYPE_PERMISSIONS_CHANGED NAUTILUS_DATE_TYPE_PERMISSIONS_CHANGED
} NautilusDateType; } NautilusDateType;
#define EMBLEM_NAME_SYMBOLIC_LINK "symbolic-link"
#define EMBLEM_NAME_CANT_READ "noread"
#define EMBLEM_NAME_CANT_WRITE "nowrite"
#define EMBLEM_NAME_TRASH "trash"
enum { enum {
CHANGED, CHANGED,
LAST_SIGNAL LAST_SIGNAL
...@@ -1134,11 +1129,11 @@ compare_emblem_names (const char *name_1, const char *name_2) ...@@ -1134,11 +1129,11 @@ compare_emblem_names (const char *name_1, const char *name_2)
return 0; return 0;
} }
if (nautilus_strcmp (name_1, EMBLEM_NAME_SYMBOLIC_LINK) == 0) { if (nautilus_strcmp (name_1, NAUTILUS_FILE_EMBLEM_NAME_SYMBOLIC_LINK) == 0) {
return -1; return -1;
} }
if (nautilus_strcmp (name_2, EMBLEM_NAME_SYMBOLIC_LINK) == 0) { if (nautilus_strcmp (name_2, NAUTILUS_FILE_EMBLEM_NAME_SYMBOLIC_LINK) == 0) {
return +1; return +1;
} }
...@@ -3171,26 +3166,25 @@ nautilus_file_get_emblem_names (NautilusFile *file) ...@@ -3171,26 +3166,25 @@ nautilus_file_get_emblem_names (NautilusFile *file)
names = nautilus_file_get_keywords (file); names = nautilus_file_get_keywords (file);
if (nautilus_file_is_search_result (file) if (nautilus_file_is_in_trash (file)) {
&& nautilus_file_is_in_trash (file)) {
names = g_list_append names = g_list_append
(names, g_strdup (EMBLEM_NAME_TRASH)); (names, g_strdup (NAUTILUS_FILE_EMBLEM_NAME_TRASH));
} }
if (nautilus_file_is_symbolic_link (file)) { if (nautilus_file_is_symbolic_link (file)) {
names = g_list_append names = g_list_append
(names, g_strdup (EMBLEM_NAME_SYMBOLIC_LINK)); (names, g_strdup (NAUTILUS_FILE_EMBLEM_NAME_SYMBOLIC_LINK));
} }
if (!nautilus_file_can_write (file)) { if (!nautilus_file_can_write (file)) {
names = g_list_append names = g_list_append
(names, g_strdup (EMBLEM_NAME_CANT_WRITE)); (names, g_strdup (NAUTILUS_FILE_EMBLEM_NAME_CANT_WRITE));
} }
if (!nautilus_file_can_read (file)) { if (!nautilus_file_can_read (file)) {
names = g_list_append names = g_list_append
(names, g_strdup (EMBLEM_NAME_CANT_READ)); (names, g_strdup (NAUTILUS_FILE_EMBLEM_NAME_CANT_READ));
} }
...@@ -3356,22 +3350,17 @@ gboolean ...@@ -3356,22 +3350,17 @@ gboolean
nautilus_file_is_in_trash (NautilusFile *file) nautilus_file_is_in_trash (NautilusFile *file)
{ {
GnomeVFSURI *file_uri, *trash_dir_uri; GnomeVFSURI *file_uri, *trash_dir_uri;
char * uri; char *uri_string;
gboolean result; gboolean result;
if (file == NULL) {
return FALSE;
}
g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE); g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
uri = nautilus_file_get_activation_uri (file); uri_string = nautilus_file_get_uri (file);
if (uri == NULL) { file_uri = gnome_vfs_uri_new (uri_string);
/* we don't have loaded the data yet. */ g_free (uri_string);
return FALSE;
}
file_uri = gnome_vfs_uri_new (uri); /* Start with NULL so we don't try to unref uninitialized garbage later */
trash_dir_uri = NULL;
result = gnome_vfs_find_directory (file_uri, GNOME_VFS_DIRECTORY_KIND_TRASH, result = gnome_vfs_find_directory (file_uri, GNOME_VFS_DIRECTORY_KIND_TRASH,
&trash_dir_uri, FALSE, FALSE, 0777) == GNOME_VFS_OK; &trash_dir_uri, FALSE, FALSE, 0777) == GNOME_VFS_OK;
......
...@@ -66,6 +66,12 @@ typedef enum { ...@@ -66,6 +66,12 @@ typedef enum {
NAUTILUS_REQUEST_DONE NAUTILUS_REQUEST_DONE
} NautilusRequestStatus; } NautilusRequestStatus;
/* Emblems sometimes displayed for NautilusFiles. Do not localize. */
#define NAUTILUS_FILE_EMBLEM_NAME_SYMBOLIC_LINK "symbolic-link"
#define NAUTILUS_FILE_EMBLEM_NAME_CANT_READ "noread"
#define NAUTILUS_FILE_EMBLEM_NAME_CANT_WRITE "nowrite"
#define NAUTILUS_FILE_EMBLEM_NAME_TRASH "trash"
typedef void (*NautilusFileCallback) (NautilusFile *file, typedef void (*NautilusFileCallback) (NautilusFile *file,
gpointer callback_data); gpointer callback_data);
typedef void (*NautilusFileOperationCallback) (NautilusFile *file, typedef void (*NautilusFileOperationCallback) (NautilusFile *file,
......
...@@ -1124,7 +1124,7 @@ nautilus_icon_factory_get_emblem_icon_by_name (const char *emblem_name, gboolean ...@@ -1124,7 +1124,7 @@ nautilus_icon_factory_get_emblem_icon_by_name (const char *emblem_name, gboolean
} }
GList * GList *
nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file, gboolean anti_aliased) nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file, gboolean anti_aliased, NautilusStringList *exclude)
{ {
GList *icons, *emblem_names, *p; GList *icons, *emblem_names, *p;
NautilusScalableIcon *icon; NautilusScalableIcon *icon;
...@@ -1133,6 +1133,9 @@ nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file, gboolean an ...@@ -1133,6 +1133,9 @@ nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file, gboolean an
emblem_names = nautilus_file_get_emblem_names (file); emblem_names = nautilus_file_get_emblem_names (file);
for (p = emblem_names; p != NULL; p = p->next) { for (p = emblem_names; p != NULL; p = p->next) {
if (nautilus_string_list_contains (exclude, p->data)) {
continue;
}
icon = nautilus_icon_factory_get_emblem_icon_by_name (p->data, anti_aliased); icon = nautilus_icon_factory_get_emblem_icon_by_name (p->data, anti_aliased);
icons = g_list_prepend (icons, icon); icons = g_list_prepend (icons, icon);
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <gdk-pixbuf/gdk-pixbuf.h> #include <gdk-pixbuf/gdk-pixbuf.h>
#include <libnautilus-extensions/nautilus-file.h> #include <libnautilus-extensions/nautilus-file.h>
#include <libnautilus-extensions/nautilus-string-list.h>
#include <gtk/gtkobject.h> #include <gtk/gtkobject.h>
/* NautilusIconFactory is a class that knows how to hand out icons to be /* NautilusIconFactory is a class that knows how to hand out icons to be
...@@ -106,7 +107,8 @@ NautilusScalableIcon *nautilus_icon_factory_get_icon_for_file (Nautil ...@@ -106,7 +107,8 @@ NautilusScalableIcon *nautilus_icon_factory_get_icon_for_file (Nautil
gboolean nautilus_icon_factory_is_icon_ready_for_file (NautilusFile *file); gboolean nautilus_icon_factory_is_icon_ready_for_file (NautilusFile *file);
GList * nautilus_icon_factory_get_required_file_attributes (void); GList * nautilus_icon_factory_get_required_file_attributes (void);
GList * nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file, GList * nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file,
gboolean anti_aliased); gboolean anti_aliased,
NautilusStringList *exclude);
NautilusScalableIcon *nautilus_icon_factory_get_emblem_icon_by_name (const char *emblem_name, NautilusScalableIcon *nautilus_icon_factory_get_emblem_icon_by_name (const char *emblem_name,
gboolean anti_aliased); gboolean anti_aliased);
......
...@@ -92,7 +92,9 @@ nautilus_string_list_new_from_string_list (const NautilusStringList *other) ...@@ -92,7 +92,9 @@ nautilus_string_list_new_from_string_list (const NautilusStringList *other)
GList *other_iterator; GList *other_iterator;
const char *other_string; const char *other_string;
g_return_val_if_fail (other != NULL, NULL); if (other == NULL) {
return NULL;
}
string_list = nautilus_string_list_new (); string_list = nautilus_string_list_new ();
...@@ -140,7 +142,9 @@ nautilus_string_list_new_from_tokens (const char *string, ...@@ -140,7 +142,9 @@ nautilus_string_list_new_from_tokens (const char *string,
void void
nautilus_string_list_free (NautilusStringList *string_list) nautilus_string_list_free (NautilusStringList *string_list)
{ {
g_return_if_fail (string_list != NULL); if (string_list == NULL) {
return;
}
nautilus_string_list_clear (string_list); nautilus_string_list_clear (string_list);
g_free (string_list); g_free (string_list);
...@@ -181,7 +185,10 @@ nautilus_string_list_contains (const NautilusStringList *string_list, ...@@ -181,7 +185,10 @@ nautilus_string_list_contains (const NautilusStringList *string_list,
{ {
GList *find; GList *find;
g_return_val_if_fail (string_list != NULL, FALSE); if (string_list == NULL) {
return FALSE;
}
g_return_val_if_fail (string != NULL, FALSE); g_return_val_if_fail (string != NULL, FALSE);
find = g_list_find_custom (string_list->strings, (gpointer) string, (GCompareFunc) strcmp); find = g_list_find_custom (string_list->strings, (gpointer) string, (GCompareFunc) strcmp);
...@@ -360,6 +367,7 @@ nautilus_self_check_string_list (void) ...@@ -360,6 +367,7 @@ nautilus_self_check_string_list (void)
NAUTILUS_CHECK_INTEGER_RESULT (nautilus_string_list_get_length (empty), 0); NAUTILUS_CHECK_INTEGER_RESULT (nautilus_string_list_get_length (empty), 0);
NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_contains (empty, "something"), FALSE); NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_contains (empty, "something"), FALSE);
NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_contains (NULL, "something"), FALSE);
/********/ /********/
...@@ -381,6 +389,8 @@ nautilus_self_check_string_list (void) ...@@ -381,6 +389,8 @@ nautilus_self_check_string_list (void)
nautilus_string_list_free (cities_copy); nautilus_string_list_free (cities_copy);
NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_new_from_string_list (NULL) == NULL, TRUE);
/********/ /********/
fruits = nautilus_string_list_new (); fruits = nautilus_string_list_new ();
......
...@@ -56,11 +56,6 @@ typedef enum { ...@@ -56,11 +56,6 @@ typedef enum {
NAUTILUS_DATE_TYPE_PERMISSIONS_CHANGED NAUTILUS_DATE_TYPE_PERMISSIONS_CHANGED
} NautilusDateType; } NautilusDateType;
#define EMBLEM_NAME_SYMBOLIC_LINK "symbolic-link"
#define EMBLEM_NAME_CANT_READ "noread"
#define EMBLEM_NAME_CANT_WRITE "nowrite"
#define EMBLEM_NAME_TRASH "trash"
enum { enum {
CHANGED, CHANGED,
LAST_SIGNAL LAST_SIGNAL
...@@ -1134,11 +1129,11 @@ compare_emblem_names (const char *name_1, const char *name_2) ...@@ -1134,11 +1129,11 @@ compare_emblem_names (const char *name_1, const char *name_2)
return 0; return 0;
} }
if (nautilus_strcmp (name_1, EMBLEM_NAME_SYMBOLIC_LINK) == 0) { if (nautilus_strcmp (name_1, NAUTILUS_FILE_EMBLEM_NAME_SYMBOLIC_LINK) == 0) {
return -1; return -1;
} }
if (nautilus_strcmp (name_2, EMBLEM_NAME_SYMBOLIC_LINK) == 0) { if (nautilus_strcmp (name_2, NAUTILUS_FILE_EMBLEM_NAME_SYMBOLIC_LINK) == 0) {
return +1; return +1;
} }
...@@ -3171,26 +3166,25 @@ nautilus_file_get_emblem_names (NautilusFile *file) ...@@ -3171,26 +3166,25 @@ nautilus_file_get_emblem_names (NautilusFile *file)
names = nautilus_file_get_keywords (file); names = nautilus_file_get_keywords (file);
if (nautilus_file_is_search_result (file) if (nautilus_file_is_in_trash (file)) {
&& nautilus_file_is_in_trash (file)) {
names = g_list_append names = g_list_append
(names, g_strdup (EMBLEM_NAME_TRASH)); (names, g_strdup (NAUTILUS_FILE_EMBLEM_NAME_TRASH));
} }
if (nautilus_file_is_symbolic_link (file)) { if (nautilus_file_is_symbolic_link (file)) {
names = g_list_append names = g_list_append
(names, g_strdup (EMBLEM_NAME_SYMBOLIC_LINK)); (names, g_strdup (NAUTILUS_FILE_EMBLEM_NAME_SYMBOLIC_LINK));
} }
if (!nautilus_file_can_write (file)) { if (!nautilus_file_can_write (file)) {
names = g_list_append names = g_list_append
(names, g_strdup (EMBLEM_NAME_CANT_WRITE)); (names, g_strdup (NAUTILUS_FILE_EMBLEM_NAME_CANT_WRITE));
} }
if (!nautilus_file_can_read (file)) { if (!nautilus_file_can_read (file)) {
names = g_list_append names = g_list_append
(names, g_strdup (EMBLEM_NAME_CANT_READ)); (names, g_strdup (NAUTILUS_FILE_EMBLEM_NAME_CANT_READ));
} }
...@@ -3356,22 +3350,17 @@ gboolean ...@@ -3356,22 +3350,17 @@ gboolean
nautilus_file_is_in_trash (NautilusFile *file) nautilus_file_is_in_trash (NautilusFile *file)
{ {
GnomeVFSURI *file_uri, *trash_dir_uri; GnomeVFSURI *file_uri, *trash_dir_uri;
char * uri; char *uri_string;
gboolean result; gboolean result;
if (file == NULL) {
return FALSE;
}
g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE); g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
uri = nautilus_file_get_activation_uri (file); uri_string = nautilus_file_get_uri (file);
if (uri == NULL) { file_uri = gnome_vfs_uri_new (uri_string);
/* we don't have loaded the data yet. */ g_free (uri_string);
return FALSE;
}
file_uri = gnome_vfs_uri_new (uri); /* Start with NULL so we don't try to unref uninitialized garbage later */
trash_dir_uri = NULL;
result = gnome_vfs_find_directory (file_uri, GNOME_VFS_DIRECTORY_KIND_TRASH, result = gnome_vfs_find_directory (file_uri, GNOME_VFS_DIRECTORY_KIND_TRASH,
&trash_dir_uri, FALSE, FALSE, 0777) == GNOME_VFS_OK; &trash_dir_uri, FALSE, FALSE, 0777) == GNOME_VFS_OK;
......
...@@ -66,6 +66,12 @@ typedef enum { ...@@ -66,6 +66,12 @@ typedef enum {
NAUTILUS_REQUEST_DONE NAUTILUS_REQUEST_DONE
} NautilusRequestStatus; } NautilusRequestStatus;
/* Emblems sometimes displayed for NautilusFiles. Do not localize. */
#define NAUTILUS_FILE_EMBLEM_NAME_SYMBOLIC_LINK "symbolic-link"
#define NAUTILUS_FILE_EMBLEM_NAME_CANT_READ "noread"
#define NAUTILUS_FILE_EMBLEM_NAME_CANT_WRITE "nowrite"
#define NAUTILUS_FILE_EMBLEM_NAME_TRASH "trash"
typedef void (*NautilusFileCallback) (NautilusFile *file, typedef void (*NautilusFileCallback) (NautilusFile *file,
gpointer callback_data); gpointer callback_data);
typedef void (*NautilusFileOperationCallback) (NautilusFile *file, typedef void (*NautilusFileOperationCallback) (NautilusFile *file,
......
...@@ -1124,7 +1124,7 @@ nautilus_icon_factory_get_emblem_icon_by_name (const char *emblem_name, gboolean ...@@ -1124,7 +1124,7 @@ nautilus_icon_factory_get_emblem_icon_by_name (const char *emblem_name, gboolean
} }
GList * GList *
nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file, gboolean anti_aliased) nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file, gboolean anti_aliased, NautilusStringList *exclude)
{ {
GList *icons, *emblem_names, *p; GList *icons, *emblem_names, *p;
NautilusScalableIcon *icon; NautilusScalableIcon *icon;
...@@ -1133,6 +1133,9 @@ nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file, gboolean an ...@@ -1133,6 +1133,9 @@ nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file, gboolean an
emblem_names = nautilus_file_get_emblem_names (file); emblem_names = nautilus_file_get_emblem_names (file);
for (p = emblem_names; p != NULL; p = p->next) { for (p = emblem_names; p != NULL; p = p->next) {
if (nautilus_string_list_contains (exclude, p->data)) {
continue;
}
icon = nautilus_icon_factory_get_emblem_icon_by_name (p->data, anti_aliased); icon = nautilus_icon_factory_get_emblem_icon_by_name (p->data, anti_aliased);
icons = g_list_prepend (icons, icon); icons = g_list_prepend (icons, icon);
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <gdk-pixbuf/gdk-pixbuf.h> #include <gdk-pixbuf/gdk-pixbuf.h>
#include <libnautilus-extensions/nautilus-file.h> #include <libnautilus-extensions/nautilus-file.h>
#include <libnautilus-extensions/nautilus-string-list.h>
#include <gtk/gtkobject.h> #include <gtk/gtkobject.h>
/* NautilusIconFactory is a class that knows how to hand out icons to be /* NautilusIconFactory is a class that knows how to hand out icons to be
...@@ -106,7 +107,8 @@ NautilusScalableIcon *nautilus_icon_factory_get_icon_for_file (Nautil ...@@ -106,7 +107,8 @@ NautilusScalableIcon *nautilus_icon_factory_get_icon_for_file (Nautil
gboolean nautilus_icon_factory_is_icon_ready_for_file (NautilusFile *file); gboolean nautilus_icon_factory_is_icon_ready_for_file (NautilusFile *file);
GList * nautilus_icon_factory_get_required_file_attributes (void); GList * nautilus_icon_factory_get_required_file_attributes (void);
GList * nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file, GList * nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file,
gboolean anti_aliased); gboolean anti_aliased,
NautilusStringList *exclude);
NautilusScalableIcon *nautilus_icon_factory_get_emblem_icon_by_name (const char *emblem_name, NautilusScalableIcon *nautilus_icon_factory_get_emblem_icon_by_name (const char *emblem_name,
gboolean anti_aliased); gboolean anti_aliased);
......
...@@ -92,7 +92,9 @@ nautilus_string_list_new_from_string_list (const NautilusStringList *other) ...@@ -92,7 +92,9 @@ nautilus_string_list_new_from_string_list (const NautilusStringList *other)
GList *other_iterator; GList *other_iterator;
const char *other_string; const char *other_string;
g_return_val_if_fail (other != NULL, NULL); if (other == NULL) {
return NULL;
}
string_list = nautilus_string_list_new (); string_list = nautilus_string_list_new ();
...@@ -140,7 +142,9 @@ nautilus_string_list_new_from_tokens (const char *string, ...@@ -140,7 +142,9 @@ nautilus_string_list_new_from_tokens (const char *string,
void void
nautilus_string_list_free (NautilusStringList *string_list) nautilus_string_list_free (NautilusStringList *string_list)
{ {
g_return_if_fail (string_list != NULL); if (string_list == NULL) {
return;
}
nautilus_string_list_clear (string_list); nautilus_string_list_clear (string_list);
g_free (string_list); g_free (string_list);
...@@ -181,7 +185,10 @@ nautilus_string_list_contains (const NautilusStringList *string_list, ...@@ -181,7 +185,10 @@ nautilus_string_list_contains (const NautilusStringList *string_list,
{ {
GList *find; GList *find;
g_return_val_if_fail (string_list != NULL, FALSE); if (string_list == NULL) {
return FALSE;
}
g_return_val_if_fail (string != NULL, FALSE); g_return_val_if_fail (string != NULL, FALSE);
find = g_list_find_custom (string_list->strings, (gpointer) string, (GCompareFunc) strcmp); find = g_list_find_custom (string_list->strings, (gpointer) string, (GCompareFunc) strcmp);
...@@ -360,6 +367,7 @@ nautilus_self_check_string_list (void) ...@@ -360,6 +367,7 @@ nautilus_self_check_string_list (void)
NAUTILUS_CHECK_INTEGER_RESULT (nautilus_string_list_get_length (empty), 0); NAUTILUS_CHECK_INTEGER_RESULT (nautilus_string_list_get_length (empty), 0);
NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_contains (empty, "something"), FALSE); NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_contains (empty, "something"), FALSE);
NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_list_contains (NULL, "something"), FALSE);
/********/ /********/
...@@ -381,6 +389,8 @@ nautilus_self_check_string_list (void) ...@@ -381,6 +389,8 @@ nautilus_self_check_string_list (void)
nautilus_string_list_free (cities_copy); nautilus_string_list_free (cities_copy);