From 789fce6433bc8f8d6e11b506d8a89a853e9b3c3e Mon Sep 17 00:00:00 2001
From: Yousuf Philips <philipz85@hotmail.com>
Date: Thu, 27 Feb 2020 20:44:35 +0400
Subject: [PATCH] Add computer:/// to side pane (Bug #16472)

---
 thunar/thunar-shortcuts-model.c | 19 +++++++++++++++++++
 thunar/thunar-shortcuts-model.h |  4 +++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/thunar/thunar-shortcuts-model.c b/thunar/thunar-shortcuts-model.c
index d5e92df26..0c9769fc4 100644
--- a/thunar/thunar-shortcuts-model.c
+++ b/thunar/thunar-shortcuts-model.c
@@ -990,6 +990,7 @@ thunar_shortcuts_model_shortcut_places (ThunarShortcutsModel *model)
   ThunarShortcut *shortcut;
   GFile          *home;
   GFile          *desktop;
+  GFile          *computer;
   GFile          *trash;
   ThunarFile     *file;
 
@@ -1064,6 +1065,24 @@ thunar_shortcuts_model_shortcut_places (ThunarShortcutsModel *model)
 
   /* read the Gtk+ bookmarks file */
   model->bookmarks_idle_id = g_idle_add_full (G_PRIORITY_DEFAULT, thunar_shortcuts_model_load, model, NULL);
+
+  /* get computer path */
+  computer = thunar_g_file_new_for_computer ();
+
+  /* add computer entry */
+  file = thunar_file_get (computer, NULL);
+  if (file != NULL)
+    {
+      shortcut = g_slice_new0 (ThunarShortcut);
+      shortcut->group = THUNAR_SHORTCUT_GROUP_PLACES_DEFAULT;
+      shortcut->name = g_strdup (_("Computer"));
+      shortcut->file = file;
+      shortcut->gicon = g_themed_icon_new ("computer");
+      shortcut->hidden = thunar_shortcuts_model_get_hidden (model, shortcut);
+      thunar_shortcuts_model_add_shortcut (model, shortcut);
+    }
+
+  g_object_unref (computer);
 }
 
 
diff --git a/thunar/thunar-shortcuts-model.h b/thunar/thunar-shortcuts-model.h
index 677e9b431..0fe21b65e 100644
--- a/thunar/thunar-shortcuts-model.h
+++ b/thunar/thunar-shortcuts-model.h
@@ -63,7 +63,8 @@ typedef enum
 #define THUNAR_SHORTCUT_GROUP_PLACES  (THUNAR_SHORTCUT_GROUP_PLACES_HEADER \
                                        | THUNAR_SHORTCUT_GROUP_PLACES_DEFAULT \
                                        | THUNAR_SHORTCUT_GROUP_PLACES_TRASH \
-                                       | THUNAR_SHORTCUT_GROUP_PLACES_BOOKMARKS)
+                                       | THUNAR_SHORTCUT_GROUP_PLACES_BOOKMARKS \
+                                       | THUNAR_SHORTCUT_GROUP_PLACES_COMPUTER )
 #define THUNAR_SHORTCUT_GROUP_NETWORK (THUNAR_SHORTCUT_GROUP_NETWORK_HEADER \
                                        | THUNAR_SHORTCUT_GROUP_NETWORK_DEFAULT \
                                        | THUNAR_SHORTCUT_GROUP_NETWORK_MOUNTS)
@@ -84,6 +85,7 @@ enum _ThunarShortcutGroup
   THUNAR_SHORTCUT_GROUP_PLACES_DEFAULT     = (1 << 5),  /* home and desktop */
   THUNAR_SHORTCUT_GROUP_PLACES_TRASH       = (1 << 6),  /* trash */
   THUNAR_SHORTCUT_GROUP_PLACES_BOOKMARKS   = (1 << 7),  /* gtk-bookmarks */
+  THUNAR_SHORTCUT_GROUP_PLACES_COMPUTER    = (1 << 11), /* computer */
 
   /* THUNAR_SHORTCUT_GROUP_NETWORK */
   THUNAR_SHORTCUT_GROUP_NETWORK_HEADER     = (1 << 8),  /* network header */
-- 
GitLab