[gnome-builder] ls: Use libide's files symbolic icons override
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] ls: Use libide's files symbolic icons override
- Date: Thu, 31 Dec 2020 22:16:40 +0000 (UTC)
commit 0a0d52fa9cfd1c3571992f54c95731ae5610c829
Author: vanadiae <vanadiae35 gmail com>
Date: Thu Dec 31 18:42:04 2020 +0100
ls: Use libide's files symbolic icons override
Currently it only uses the icons from the default icon theme, so it
doesn't show up the same as in the project tree or opened files list.
So this commit makes use of those overridden icons with
ide_g_content_type_get_symbolic_icon().
src/plugins/ls/gbp-ls-model.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/ls/gbp-ls-model.c b/src/plugins/ls/gbp-ls-model.c
index 5edea190c..6483b9dfb 100644
--- a/src/plugins/ls/gbp-ls-model.c
+++ b/src/plugins/ls/gbp-ls-model.c
@@ -396,6 +396,7 @@ gbp_ls_model_worker (IdeTask *task,
enumerator = g_file_enumerate_children (directory,
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME","
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE","
G_FILE_ATTRIBUTE_STANDARD_SIZE","
G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON","
G_FILE_ATTRIBUTE_TIME_MODIFIED","
@@ -442,10 +443,16 @@ gbp_ls_model_worker (IdeTask *task,
while ((info = g_file_enumerator_next_file (enumerator, cancellable, &error)))
{
GFileType file_type = g_file_info_get_file_type (info);
+ GIcon *file_icon = NULL;
/* Prefer our symbolic icon for folders */
if (file_type == G_FILE_TYPE_DIRECTORY)
- g_file_info_set_attribute_object (info, G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON, G_OBJECT (icon));
+ file_icon = icon;
+ else
+ file_icon = ide_g_content_type_get_symbolic_icon (g_file_info_get_content_type (info),
+ g_file_info_get_display_name (info));
+
+ g_file_info_set_attribute_object (info, G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON, G_OBJECT (file_icon));
g_ptr_array_add (items, info);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]