summaryrefslogtreecommitdiff
path: root/src/nautilus-toolbar.c
diff options
context:
space:
mode:
authorUjjwal Kumar <ujjwalkumar0501@gmail.com>2020-03-09 02:37:02 +0530
committerAntónio Fernandes <antoniojpfernandes@gmail.com>2020-03-28 20:29:00 +0000
commita700db42bb4afbd0b6f9ff7ee016ea728301b56f (patch)
tree8d94d86007dfad9b180b60fd98ecf14a17db9257 /src/nautilus-toolbar.c
parentf5ad5015689e0aae7d77f43f9414bad037127b65 (diff)
downloadnautilus-a700db42bb4afbd0b6f9ff7ee016ea728301b56f.tar.gz
usability: Change tooltip for view_toggle_button
Currently, the tooltip says 'Toggle view', which isn't clear. Usability testers had difficulty finding out how to change between list and grid view. Change tooltip to say 'Show list' or 'Show grid', depending on which view it can change to. Fixes: https://gitlab.gnome.org/GNOME/nautilus/issues/893
Diffstat (limited to 'src/nautilus-toolbar.c')
-rw-r--r--src/nautilus-toolbar.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 4ecb5ff6a..53acc9ddc 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -114,6 +114,7 @@ struct _NautilusToolbar
NautilusWindowSlot *window_slot;
GBinding *icon_binding;
GBinding *search_binding;
+ GBinding *tooltip_binding;
};
enum
@@ -1379,6 +1380,26 @@ nautilus_toolbar_view_toggle_icon_transform_to (GBinding *binding,
return TRUE;
}
+static gboolean
+nautilus_toolbar_view_toggle_tooltip_transform_to (GBinding *binding,
+ const GValue *from_value,
+ GValue *to_value,
+ gpointer user_data)
+{
+ const gchar *tooltip;
+
+ tooltip = g_value_get_string (from_value);
+
+ /* As per design decision, we let the previous used tooltip if no
+ * view menu is available */
+ if (tooltip)
+ {
+ g_value_set_string (to_value, tooltip);
+ }
+
+ return TRUE;
+}
+
/* Called from on_window_slot_destroyed(), since bindings and signal handlers
* are automatically removed once the slot goes away.
*/
@@ -1404,6 +1425,14 @@ nautilus_toolbar_set_window_slot_real (NautilusToolbar *self,
self,
NULL);
+ self->tooltip_binding = g_object_bind_property_full (self->window_slot, "tooltip",
+ self->view_toggle_button, "tooltip-text",
+ G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE,
+ (GBindingTransformFunc) nautilus_toolbar_view_toggle_tooltip_transform_to,
+ NULL,
+ self,
+ NULL);
+
self->search_binding = g_object_bind_property (self->window_slot, "searching",
self, "searching",
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);