[gnome-flashback/gnome-3-36] desktop: fix RENAMED event handling
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback/gnome-3-36] desktop: fix RENAMED event handling
- Date: Wed, 29 Apr 2020 20:21:27 +0000 (UTC)
commit 9417e34cad913a49e1a6e67931303c0bca49e759
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Wed Apr 29 22:26:30 2020 +0300
desktop: fix RENAMED event handling
gnome-flashback/libdesktop/gf-icon-view.c | 44 ++++++++++++++++++++++---------
1 file changed, 31 insertions(+), 13 deletions(-)
---
diff --git a/gnome-flashback/libdesktop/gf-icon-view.c b/gnome-flashback/libdesktop/gf-icon-view.c
index f64073c..9299beb 100644
--- a/gnome-flashback/libdesktop/gf-icon-view.c
+++ b/gnome-flashback/libdesktop/gf-icon-view.c
@@ -711,6 +711,19 @@ remove_icon_from_view (GfIconView *self,
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
file_deleted (GfIconView *self,
GFile *deleted_file)
@@ -722,13 +735,7 @@ file_deleted (GfIconView *self,
if (info == NULL)
return;
- 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);
+ remove_icon (self, info);
}
static void
@@ -755,14 +762,25 @@ file_renamed (GfIconView *self,
GFile *old_file,
GFile *new_file)
{
- GfIconInfo *info;
-
- info = find_icon_info_by_file (self, old_file);
+ GfIconInfo *old_info;
+ GfIconInfo *new_info;
- if (info == NULL)
- return;
+ old_info = find_icon_info_by_file (self, old_file);
+ 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]