summaryrefslogtreecommitdiff
path: root/gtk/gtksidebarrow.c
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2016-02-25 14:25:40 +0100
committerCarlos Soriano <csoriano@gnome.org>2016-02-25 14:44:40 +0100
commit20cf42c9ea977fe441c297a531811990876575c7 (patch)
tree75b83e8837784349471d870530f18811abe2bd6e /gtk/gtksidebarrow.c
parentfe4602acc59d4853e23c205ba1ba6d43f55894e8 (diff)
downloadgtk+-20cf42c9ea977fe441c297a531811990876575c7.tar.gz
gtkplacessidebar: avoid unresponsive UI while trashing
We were updating the whole places sidebar when the trash changed. This effectively removes all rows and create new ones for every trash state change. Although when using GtkTreeView it was somehow ok, with the new implementation with GtkListBox this effectively locks the UI while the trash operations are being performed. When performing operations for i.e. 100 files, the UI can be locked for more than 1 minute since gvfs-trash usually takes time. To fix this just update the icon of the trash when the state of the trash change instead of the whole sidebar. https://bugzilla.gnome.org/show_bug.cgi?id=762677
Diffstat (limited to 'gtk/gtksidebarrow.c')
-rw-r--r--gtk/gtksidebarrow.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/gtk/gtksidebarrow.c b/gtk/gtksidebarrow.c
index a095bd2655..3df5b026dd 100644
--- a/gtk/gtksidebarrow.c
+++ b/gtk/gtksidebarrow.c
@@ -156,11 +156,7 @@ gtk_sidebar_row_set_property (GObject *object,
break;
case PROP_ICON:
- g_set_object (&self->icon, g_value_get_object (value));
- if (self->icon != NULL)
- gtk_image_set_from_gicon (GTK_IMAGE (self->icon_widget), self->icon, GTK_ICON_SIZE_MENU);
- else
- gtk_image_clear (GTK_IMAGE (self->icon_widget));
+ gtk_sidebar_row_set_icon (self, g_value_get_object (value));
break;
case PROP_LABEL:
@@ -239,7 +235,7 @@ gtk_sidebar_row_set_property (GObject *object,
(GtkCallback) gtk_widget_destroy,
NULL);
- context = gtk_widget_get_style_context (GTK_WIDGET (self));
+ context = gtk_widget_get_style_context (GTK_WIDGET (self));
gtk_style_context_add_class (context, "sidebar-placeholder-row");
}
break;
@@ -283,6 +279,25 @@ gtk_sidebar_row_hide (GtkSidebarRow *self,
gtk_revealer_set_transition_duration (GTK_REVEALER (self->revealer), transition_duration);
}
+void
+gtk_sidebar_row_set_icon (GtkSidebarRow *self,
+ GIcon *icon)
+{
+ g_return_if_fail (GTK_IS_SIDEBAR_ROW (self));
+
+ if (self->icon != icon)
+ {
+ g_set_object (&self->icon, icon);
+ if (self->icon != NULL)
+ gtk_image_set_from_gicon (GTK_IMAGE (self->icon_widget), self->icon,
+ GTK_ICON_SIZE_MENU);
+ else
+ gtk_image_clear (GTK_IMAGE (self->icon_widget));
+
+ g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_ICON]);
+ }
+}
+
static void
gtk_sidebar_row_finalize (GObject *object)
{