diff --git a/app/widgets/gimpcontainerview.c b/app/widgets/gimpcontainerview.c index 3d1d158594..fcd271bbef 100644 --- a/app/widgets/gimpcontainerview.c +++ b/app/widgets/gimpcontainerview.c @@ -146,6 +146,9 @@ static gint gimp_container_view_real_get_selected (GimpContainerView *view, GList **list, GList **paths); +static gboolean gimp_container_view_are_selected_items (GimpContainerView *view, + GList *items); + G_DEFINE_INTERFACE (GimpContainerView, gimp_container_view, GTK_TYPE_WIDGET) @@ -632,8 +635,11 @@ gimp_container_view_select_items (GimpContainerView *view, if (gimp_container_frozen (private->container)) return TRUE; - g_signal_emit (view, view_signals[SELECT_ITEMS], 0, - viewables, NULL, &success); + if (gimp_container_view_are_selected_items (view, viewables)) + success = TRUE; + else + g_signal_emit (view, view_signals[SELECT_ITEMS], 0, + viewables, NULL, &success); return success; } @@ -1430,3 +1436,32 @@ gimp_container_view_button_viewable_dropped (GtkWidget *widget, gtk_button_clicked (GTK_BUTTON (widget)); } } + +static gboolean +gimp_container_view_are_selected_items (GimpContainerView *view, + GList *items) +{ + GList *selected; + gboolean identical = FALSE; + + gimp_container_view_get_selected (view, &selected, NULL); + + if (g_list_length (items) == g_list_length (selected)) + { + GList *iter; + + identical = TRUE; + for (iter = items; iter; iter = iter->next) + { + if (g_list_find (selected, iter->data) == NULL) + { + identical = FALSE; + break; + } + } + } + + g_list_free (selected); + + return identical; +}