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>
* HACKING:
......
......@@ -56,11 +56,6 @@ typedef enum {
NAUTILUS_DATE_TYPE_PERMISSIONS_CHANGED
} 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 {
CHANGED,
LAST_SIGNAL
......@@ -1134,11 +1129,11 @@ compare_emblem_names (const char *name_1, const char *name_2)
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;
}
if (nautilus_strcmp (name_2, EMBLEM_NAME_SYMBOLIC_LINK) == 0) {
if (nautilus_strcmp (name_2, NAUTILUS_FILE_EMBLEM_NAME_SYMBOLIC_LINK) == 0) {
return +1;
}
......@@ -3171,26 +3166,25 @@ nautilus_file_get_emblem_names (NautilusFile *file)
names = nautilus_file_get_keywords (file);
if (nautilus_file_is_search_result (file)
&& nautilus_file_is_in_trash (file)) {
if (nautilus_file_is_in_trash (file)) {
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)) {
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)) {
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)) {
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
nautilus_file_is_in_trash (NautilusFile *file)
{
GnomeVFSURI *file_uri, *trash_dir_uri;
char * uri;
char *uri_string;
gboolean result;
if (file == NULL) {
return FALSE;
}
g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
uri = nautilus_file_get_activation_uri (file);
if (uri == NULL) {
/* we don't have loaded the data yet. */
return FALSE;
}
uri_string = nautilus_file_get_uri (file);
file_uri = gnome_vfs_uri_new (uri_string);
g_free (uri_string);
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,
&trash_dir_uri, FALSE, FALSE, 0777) == GNOME_VFS_OK;
......
......@@ -66,6 +66,12 @@ typedef enum {
NAUTILUS_REQUEST_DONE
} 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,
gpointer callback_data);
typedef void (*NautilusFileOperationCallback) (NautilusFile *file,
......
......@@ -1124,7 +1124,7 @@ nautilus_icon_factory_get_emblem_icon_by_name (const char *emblem_name, gboolean
}
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;
NautilusScalableIcon *icon;
......@@ -1133,6 +1133,9 @@ nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file, gboolean an
emblem_names = nautilus_file_get_emblem_names (file);
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);
icons = g_list_prepend (icons, icon);
}
......
......@@ -28,6 +28,7 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libnautilus-extensions/nautilus-file.h>
#include <libnautilus-extensions/nautilus-string-list.h>
#include <gtk/gtkobject.h>
/* 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
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_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,
gboolean anti_aliased);
......
......@@ -92,7 +92,9 @@ nautilus_string_list_new_from_string_list (const NautilusStringList *other)
GList *other_iterator;
const char *other_string;
g_return_val_if_fail (other != NULL, NULL);
if (other == NULL) {
return NULL;
}
string_list = nautilus_string_list_new ();
......@@ -140,7 +142,9 @@ nautilus_string_list_new_from_tokens (const char *string,
void
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);
g_free (string_list);
......@@ -181,7 +185,10 @@ nautilus_string_list_contains (const NautilusStringList *string_list,
{
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);
find = g_list_find_custom (string_list->strings, (gpointer) string, (GCompareFunc) strcmp);
......@@ -360,6 +367,7 @@ nautilus_self_check_string_list (void)
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 (NULL, "something"), FALSE);
/********/
......@@ -381,6 +389,8 @@ nautilus_self_check_string_list (void)
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 ();
......
......@@ -56,11 +56,6 @@ typedef enum {
NAUTILUS_DATE_TYPE_PERMISSIONS_CHANGED
} 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 {
CHANGED,
LAST_SIGNAL
......@@ -1134,11 +1129,11 @@ compare_emblem_names (const char *name_1, const char *name_2)
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;
}
if (nautilus_strcmp (name_2, EMBLEM_NAME_SYMBOLIC_LINK) == 0) {
if (nautilus_strcmp (name_2, NAUTILUS_FILE_EMBLEM_NAME_SYMBOLIC_LINK) == 0) {
return +1;
}
......@@ -3171,26 +3166,25 @@ nautilus_file_get_emblem_names (NautilusFile *file)
names = nautilus_file_get_keywords (file);
if (nautilus_file_is_search_result (file)
&& nautilus_file_is_in_trash (file)) {
if (nautilus_file_is_in_trash (file)) {
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)) {
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)) {
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)) {
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
nautilus_file_is_in_trash (NautilusFile *file)
{
GnomeVFSURI *file_uri, *trash_dir_uri;
char * uri;
char *uri_string;
gboolean result;
if (file == NULL) {
return FALSE;
}
g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
uri = nautilus_file_get_activation_uri (file);
if (uri == NULL) {
/* we don't have loaded the data yet. */
return FALSE;
}
uri_string = nautilus_file_get_uri (file);
file_uri = gnome_vfs_uri_new (uri_string);
g_free (uri_string);
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,
&trash_dir_uri, FALSE, FALSE, 0777) == GNOME_VFS_OK;
......
......@@ -66,6 +66,12 @@ typedef enum {
NAUTILUS_REQUEST_DONE
} 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,
gpointer callback_data);
typedef void (*NautilusFileOperationCallback) (NautilusFile *file,
......
......@@ -1124,7 +1124,7 @@ nautilus_icon_factory_get_emblem_icon_by_name (const char *emblem_name, gboolean
}
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;
NautilusScalableIcon *icon;
......@@ -1133,6 +1133,9 @@ nautilus_icon_factory_get_emblem_icons_for_file (NautilusFile *file, gboolean an
emblem_names = nautilus_file_get_emblem_names (file);
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);
icons = g_list_prepend (icons, icon);
}
......
......@@ -28,6 +28,7 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libnautilus-extensions/nautilus-file.h>
#include <libnautilus-extensions/nautilus-string-list.h>
#include <gtk/gtkobject.h>
/* 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
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_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,
gboolean anti_aliased);
......
......@@ -92,7 +92,9 @@ nautilus_string_list_new_from_string_list (const NautilusStringList *other)
GList *other_iterator;
const char *other_string;
g_return_val_if_fail (other != NULL, NULL);
if (other == NULL) {
return NULL;
}
string_list = nautilus_string_list_new ();
......@@ -140,7 +142,9 @@ nautilus_string_list_new_from_tokens (const char *string,
void
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);
g_free (string_list);
......@@ -181,7 +185,10 @@ nautilus_string_list_contains (const NautilusStringList *string_list,
{
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);
find = g_list_find_custom (string_list->strings, (gpointer) string, (GCompareFunc) strcmp);
......@@ -360,6 +367,7 @@ nautilus_self_check_string_list (void)
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 (NULL, "something"), FALSE);
/********/
......@@ -381,6 +389,8 @@ nautilus_self_check_string_list (void)
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 ();
......
......@@ -180,6 +180,7 @@ static void show_hidden_files_changed_callback
static void get_required_metadata_keys (FMDirectoryView *view,
GList **directory_keys_result,
GList **file_keys_result);
static NautilusStringList * real_get_emblem_names_to_exclude (FMDirectoryView *view);
static void start_renaming_item (FMDirectoryView *view,
const char *uri);
static void metadata_ready_callback (NautilusDirectory *directory,
......@@ -274,6 +275,7 @@ fm_directory_view_initialize_class (FMDirectoryViewClass *klass)
klass->merge_menus = fm_directory_view_real_merge_menus;
klass->update_menus = fm_directory_view_real_update_menus;
klass->get_required_metadata_keys = get_required_metadata_keys;
klass->get_emblem_names_to_exclude = real_get_emblem_names_to_exclude;
klass->start_renaming_item = start_renaming_item;
klass->supports_properties = fm_directory_view_real_supports_properties;
......@@ -3351,6 +3353,22 @@ get_required_metadata_keys (FMDirectoryView *view,
*file_keys_result = NULL;
}
NautilusStringList *
fm_directory_view_get_emblem_names_to_exclude (FMDirectoryView *view)
{
g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), NULL);
return (* FM_DIRECTORY_VIEW_CLASS (GTK_OBJECT (view)->klass)->get_emblem_names_to_exclude) (view);
}
static NautilusStringList *
real_get_emblem_names_to_exclude (FMDirectoryView *view)
{
g_assert (FM_IS_DIRECTORY_VIEW (view));
return nautilus_string_list_new_from_string (NAUTILUS_FILE_EMBLEM_NAME_TRASH);
}
/**
* fm_directory_view_merge_menus:
*
......
......@@ -32,6 +32,7 @@
#include <libnautilus-extensions/nautilus-directory.h>
#include <libnautilus-extensions/nautilus-file.h>
#include <libnautilus-extensions/nautilus-icon-container.h>
#include <libnautilus-extensions/nautilus-string-list.h>
typedef struct FMDirectoryView FMDirectoryView;
typedef struct FMDirectoryViewClass FMDirectoryViewClass;
......@@ -202,6 +203,13 @@ struct FMDirectoryViewClass {
GList **directory_metadata_keys,
GList **file_metadata_keys);
/* get_emblem_names_to_exclude is a function pointer that subclasses
* may override to specify a set of emblem names that should not
* be displayed with each file. By default, all emblems returned by
* NautilusFile are displayed.
*/
NautilusStringList * (* get_emblem_names_to_exclude) (FMDirectoryView *view);
/* supports_properties is a function pointer that subclasses may
* override to control whether the "Show Properties" menu item
* should be enabled for selected items. The default implementation
......@@ -282,6 +290,7 @@ void fm_directory_view_queue_file_change (FMDirectoryView *view,
NautilusFile *file);
void fm_directory_view_notify_selection_changed (FMDirectoryView *view);
BonoboUIHandler * fm_directory_view_get_bonobo_ui_handler (FMDirectoryView *view);
NautilusStringList *fm_directory_view_get_emblem_names_to_exclude (FMDirectoryView *view);
NautilusDirectory *fm_directory_view_get_model (FMDirectoryView *view);
void fm_directory_view_pop_up_background_context_menu (FMDirectoryView *view);
void fm_directory_view_pop_up_selection_context_menu (FMDirectoryView *view);
......
......@@ -1464,6 +1464,7 @@ get_icon_images_callback (NautilusIconContainer *container,
FMIconView *icon_view)
{
gboolean anti_aliased;
NautilusStringList *emblems_to_ignore;
g_assert (NAUTILUS_IS_ICON_CONTAINER (container));
g_assert (NAUTILUS_IS_FILE (file));
......@@ -1471,7 +1472,10 @@ get_icon_images_callback (NautilusIconContainer *container,
anti_aliased = nautilus_icon_container_get_anti_aliased_mode (container);
if (emblem_icons != NULL) {
*emblem_icons = nautilus_icon_factory_get_emblem_icons_for_file (file, anti_aliased);
emblems_to_ignore = fm_directory_view_get_emblem_names_to_exclude
(FM_DIRECTORY_VIEW (icon_view));
*emblem_icons = nautilus_icon_factory_get_emblem_icons_for_file (file, anti_aliased, emblems_to_ignore);
nautilus_string_list_free (emblems_to_ignore);
}
return nautilus_icon_factory_get_icon_for_file (file, modifier, anti_aliased);
}
......
......@@ -1401,8 +1401,13 @@ fm_list_view_get_emblem_pixbufs_for_file (FMListView *list_view,
GList *emblem_icons, *emblem_pixbufs, *p;
GdkPixbuf *emblem_pixbuf;
int emblem_size;
NautilusStringList *emblems_to_ignore;
emblems_to_ignore = fm_directory_view_get_emblem_names_to_exclude
(FM_DIRECTORY_VIEW (list_view));
emblem_icons = nautilus_icon_factory_get_emblem_icons_for_file (file, FALSE, emblems_to_ignore);
nautilus_string_list_free (emblems_to_ignore);
emblem_icons = nautilus_icon_factory_get_emblem_icons_for_file (file, FALSE);
emblem_pixbufs = NULL;
emblem_size = MAX (LIST_VIEW_MINIMUM_EMBLEM_SIZE,
fm_list_view_get_icon_size (list_view));
......
......@@ -64,6 +64,7 @@ static char * real_get_default_sort_attribute (FMListView *view);
static void real_get_column_specification (FMListView *list_view,
int column_number,
FMListViewColumn *specification);
static NautilusStringList * real_get_emblem_names_to_exclude (FMDirectoryView *view);
static void real_merge_menus (FMDirectoryView *view);
static gboolean real_supports_properties (FMDirectoryView *view);
static void load_location_callback (NautilusView *nautilus_view,
......@@ -104,6 +105,8 @@ fm_search_list_view_initialize_class (gpointer klass)
real_supports_properties;
fm_directory_view_class->create_selection_context_menu_items =
real_create_selection_context_menu_items;
fm_directory_view_class->get_emblem_names_to_exclude =
real_get_emblem_names_to_exclude;
fm_list_view_class->adding_file = real_adding_file;
fm_list_view_class->removing_file = real_removing_file;
......@@ -182,6 +185,15 @@ real_get_default_sort_attribute (FMListView *view)
return sort_attribute;
}
static NautilusStringList *
real_get_emblem_names_to_exclude (FMDirectoryView *view)
{
g_assert (FM_IS_DIRECTORY_VIEW (view));
/* Overridden to show even the trash emblem here */
return NULL;
}
static int
real_get_link_column (FMListView *view)
{
......
......@@ -365,7 +365,7 @@ update_emblems (NautilusSidebarTitle *sidebar_title)
NULL);
/* fetch the emblem icons from metadata */
icons = nautilus_icon_factory_get_emblem_icons_for_file (sidebar_title->details->file, FALSE);
icons = nautilus_icon_factory_get_emblem_icons_for_file (sidebar_title->details->file, FALSE, NULL);
/* loop through the list of emblems, installing them in the box */
for (p = icons; p != NULL; p = p->next) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment