[Xfce4-commits] [xfce/thunar] 01/01: Improve tooltips in shortcuts view (Bug #16566)
noreply at xfce.org
noreply at xfce.org
Mon Mar 23 22:35:25 CET 2020
This is an automated email from the git hooks/post-receive script.
a l e x p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/thunar.
commit 791e785a7d23387c7313d1934250ef35be544625
Author: Theo Linkspfeifer <lastonestanding at tutanota.com>
Date: Mon Mar 23 09:39:26 2020 +0100
Improve tooltips in shortcuts view (Bug #16566)
---
thunar/thunar-shortcuts-model.c | 66 ++++++++++++++++++++++++++++++-----------
1 file changed, 48 insertions(+), 18 deletions(-)
diff --git a/thunar/thunar-shortcuts-model.c b/thunar/thunar-shortcuts-model.c
index 1888cb3..82ce548 100644
--- a/thunar/thunar-shortcuts-model.c
+++ b/thunar/thunar-shortcuts-model.c
@@ -557,13 +557,14 @@ thunar_shortcuts_model_get_value (GtkTreeModel *tree_model,
GValue *value)
{
ThunarShortcut *shortcut;
- gboolean can_eject;
GFile *file;
+ gboolean can_eject;
+ gboolean file_size_binary;
gchar *disk_usage;
+ gchar *location;
+ gchar *tooltip;
guint32 trash_items;
- gchar *trash_string;
gchar *parse_name;
- gboolean file_size_binary;
_thunar_return_if_fail (iter->stamp == THUNAR_SHORTCUTS_MODEL (tree_model)->stamp);
_thunar_return_if_fail (THUNAR_IS_SHORTCUTS_MODEL (tree_model));
@@ -617,10 +618,22 @@ thunar_shortcuts_model_get_value (GtkTreeModel *tree_model,
if (file != NULL)
{
+ if (thunar_g_file_is_root (file))
+ location = g_strdup (_("Browse the file system"));
+ else
+ location = thunar_g_file_get_location (file);
+
file_size_binary = THUNAR_SHORTCUTS_MODEL (tree_model)->file_size_binary;
disk_usage = thunar_g_file_get_free_space_string (file, file_size_binary);
+
+ tooltip = g_strdup_printf ("%s\n%s", location, disk_usage);
+
+ g_value_take_string (value, tooltip);
+
+ g_free (location);
+ g_free (disk_usage);
+
g_object_unref (file);
- g_value_take_string (value, disk_usage);
}
break;
}
@@ -633,27 +646,39 @@ thunar_shortcuts_model_get_value (GtkTreeModel *tree_model,
}
else
{
- trash_string = g_strdup_printf (ngettext ("Trash contains %d file",
- "Trash contains %d files",
- trash_items), trash_items);
- g_value_take_string (value, trash_string);
+ tooltip = g_strdup_printf (ngettext ("Trash contains %d file",
+ "Trash contains %d files",
+ trash_items), trash_items);
+ g_value_take_string (value, tooltip);
}
break;
}
else if (shortcut->tooltip == NULL)
{
- if (shortcut->file != NULL)
- file = thunar_file_get_file (shortcut->file);
- else if (shortcut->location != NULL)
- file = shortcut->location;
+ if (shortcut->device != NULL)
+ {
+ file = thunar_device_get_root (shortcut->device);
+ if (G_LIKELY (file != NULL))
+ {
+ shortcut->tooltip = g_file_get_uri (file);
+ g_object_unref (file);
+ }
+ }
else
- file = NULL;
-
- if (G_LIKELY (file != NULL))
{
- parse_name = g_file_get_parse_name (file);
- shortcut->tooltip = g_markup_escape_text (parse_name, -1);
- g_free (parse_name);
+ if (shortcut->file != NULL)
+ file = thunar_file_get_file (shortcut->file);
+ else if (shortcut->location != NULL)
+ file = shortcut->location;
+ else
+ file = NULL;
+
+ if (G_LIKELY (file != NULL))
+ {
+ parse_name = g_file_get_parse_name (file);
+ shortcut->tooltip = g_markup_escape_text (parse_name, -1);
+ g_free (parse_name);
+ }
}
}
@@ -934,6 +959,7 @@ thunar_shortcuts_model_shortcut_devices (ThunarShortcutsModel *model)
shortcut = g_slice_new0 (ThunarShortcut);
shortcut->group = THUNAR_SHORTCUT_GROUP_DEVICES_FILESYSTEM;
shortcut->name = g_strdup (_("File System"));
+ shortcut->tooltip = g_strdup (_("Browse the file system"));
shortcut->file = thunar_file_get_for_uri ("file:///", NULL);
shortcut->gicon = g_themed_icon_new ("drive-harddisk");
shortcut->hidden = thunar_shortcuts_model_get_hidden (model, shortcut);
@@ -976,6 +1002,7 @@ thunar_shortcuts_model_shortcut_network (ThunarShortcutsModel *model)
shortcut = g_slice_new0 (ThunarShortcut);
shortcut->group = THUNAR_SHORTCUT_GROUP_NETWORK_DEFAULT;
shortcut->name = g_strdup (_("Browse Network"));
+ shortcut->tooltip = g_strdup (_("Browse local network connections"));
shortcut->location = g_file_new_for_uri ("network://");
shortcut->gicon = g_themed_icon_new ("network-workgroup");
shortcut->hidden = thunar_shortcuts_model_get_hidden (model, shortcut);
@@ -1008,6 +1035,7 @@ thunar_shortcuts_model_shortcut_places (ThunarShortcutsModel *model)
{
shortcut = g_slice_new0 (ThunarShortcut);
shortcut->group = THUNAR_SHORTCUT_GROUP_PLACES_DEFAULT;
+ shortcut->tooltip = g_strdup (_("Open the home folder"));
shortcut->file = file;
shortcut->gicon = g_themed_icon_new ("go-home");
shortcut->sort_id = 0;
@@ -1024,6 +1052,7 @@ thunar_shortcuts_model_shortcut_places (ThunarShortcutsModel *model)
{
shortcut = g_slice_new0 (ThunarShortcut);
shortcut->group = THUNAR_SHORTCUT_GROUP_PLACES_DEFAULT;
+ shortcut->tooltip = g_strdup (_("Open the desktop folder"));
shortcut->file = file;
shortcut->sort_id = 1;
shortcut->hidden = thunar_shortcuts_model_get_hidden (model, shortcut);
@@ -1071,6 +1100,7 @@ thunar_shortcuts_model_shortcut_places (ThunarShortcutsModel *model)
shortcut = g_slice_new0 (ThunarShortcut);
shortcut->group = THUNAR_SHORTCUT_GROUP_PLACES_COMPUTER;
shortcut->name = g_strdup (_("Computer"));
+ shortcut->tooltip = g_strdup (_("Browse the computer"));
shortcut->location = g_file_new_for_uri ("computer://");
shortcut->gicon = g_themed_icon_new ("computer");
shortcut->hidden = thunar_shortcuts_model_get_hidden (model, shortcut);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list