Commit 2c977e34 authored by Alberts Muktupāvels's avatar Alberts Muktupāvels
Browse files

desktop: fix RENAMED event handling

parent 262a0dd0
...@@ -764,6 +764,19 @@ remove_icon_from_view (GfIconView *self, ...@@ -764,6 +764,19 @@ remove_icon_from_view (GfIconView *self,
self->extend_from_icon = NULL; self->extend_from_icon = NULL;
} }
static void
remove_icon (GfIconView *self,
GfIconInfo *info)
{
remove_icon_from_view (self, info);
self->icons = g_list_remove (self->icons, info);
gf_icon_info_free (info);
if (self->placement == GF_PLACEMENT_AUTO_ARRANGE_ICONS)
remove_and_readd_icons (self);
}
static void static void
file_deleted (GfIconView *self, file_deleted (GfIconView *self,
GFile *deleted_file) GFile *deleted_file)
...@@ -775,13 +788,7 @@ file_deleted (GfIconView *self, ...@@ -775,13 +788,7 @@ file_deleted (GfIconView *self,
if (info == NULL) if (info == NULL)
return; return;
remove_icon_from_view (self, info); remove_icon (self, info);
self->icons = g_list_remove (self->icons, info);
gf_icon_info_free (info);
if (self->placement == GF_PLACEMENT_AUTO_ARRANGE_ICONS)
remove_and_readd_icons (self);
} }
static void static void
...@@ -808,14 +815,25 @@ file_renamed (GfIconView *self, ...@@ -808,14 +815,25 @@ file_renamed (GfIconView *self,
GFile *old_file, GFile *old_file,
GFile *new_file) GFile *new_file)
{ {
GfIconInfo *info; GfIconInfo *old_info;
GfIconInfo *new_info;
info = find_icon_info_by_file (self, old_file);
if (info == NULL) old_info = find_icon_info_by_file (self, old_file);
return; new_info = find_icon_info_by_file (self, new_file);
gf_icon_set_file (GF_ICON (info->icon), new_file); if (old_info != NULL && new_info != NULL)
{
gf_icon_set_file (GF_ICON (new_info->icon), new_file);
remove_icon (self, old_info);
}
else if (old_info != NULL)
{
gf_icon_set_file (GF_ICON (old_info->icon), new_file);
}
else if (new_info != NULL)
{
gf_icon_set_file (GF_ICON (new_info->icon), new_file);
}
} }
static void static void
......
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