[nautilus] name-cell: Improve drop feedback on list view
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] name-cell: Improve drop feedback on list view
- Date: Thu, 30 Jun 2022 17:41:23 +0000 (UTC)
commit 964192f0244fd296b2ae73ddf273263e1460a108
Author: António Fernandes <antoniof gnome org>
Date: Thu Jun 30 16:52:36 2022 +0100
name-cell: Improve drop feedback on list view
Since the GtkDropTarget is set on each cell, the default active state
(blue rectangle) is set only around a portion of the row in list view.
We disabled the GTK_STATE_FLAG_DROP_ACTIVE for view-cell anyways,
but we should have a better indication of drop state in list view since
the icons are small.
Heavily based on a different approach by Corey Berla
src/nautilus-name-cell.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
---
diff --git a/src/nautilus-name-cell.c b/src/nautilus-name-cell.c
index 9a269ac68..55574cb0a 100644
--- a/src/nautilus-name-cell.c
+++ b/src/nautilus-name-cell.c
@@ -208,6 +208,21 @@ on_item_size_changed (NautilusNameCell *self)
static void
on_item_drag_accept_changed (NautilusNameCell *self)
{
+ gboolean drag_accept;
+ NautilusViewItem *item;
+ GtkWidget *list_row = gtk_widget_get_parent (gtk_widget_get_parent (GTK_WIDGET (self)));
+
+ item = nautilus_view_cell_get_item (NAUTILUS_VIEW_CELL (self));
+ g_object_get (item, "drag-accept", &drag_accept, NULL);
+ if (drag_accept)
+ {
+ gtk_widget_set_state_flags (list_row, GTK_STATE_FLAG_DROP_ACTIVE, FALSE);
+ }
+ else
+ {
+ gtk_widget_unset_state_flags (list_row, GTK_STATE_FLAG_DROP_ACTIVE);
+ }
+
update_icon (self);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]