[Xfce4-commits] [xfce/thunar] 01/01: Computer: (Bug 16472) - make use of "thunar_g_vfs_is_uri_scheme_supported" to check for computer support - fixed some comments - Use "g_file_new_for_uri" directly

noreply at xfce.org noreply at xfce.org
Fri Mar 13 22:35:22 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 c9ae13f7b40ef4ce233324b4308171ef325f5c17
Author: Theo Linkspfeifer <lastonestanding at tutanota.com>
Date:   Fri Mar 13 22:35:09 2020 +0100

    Computer: (Bug 16472)
    - make use of "thunar_g_vfs_is_uri_scheme_supported" to check for
    computer support
    - fixed some comments
    - Use "g_file_new_for_uri" directly
---
 thunar/thunar-gio-extensions.c  |  8 --------
 thunar/thunar-shortcuts-model.c | 13 +++----------
 thunar/thunar-tree-model.c      |  9 ++++-----
 thunar/thunar-window.c          |  2 +-
 4 files changed, 8 insertions(+), 24 deletions(-)

diff --git a/thunar/thunar-gio-extensions.c b/thunar/thunar-gio-extensions.c
index 93bd64f..a72bef4 100644
--- a/thunar/thunar-gio-extensions.c
+++ b/thunar/thunar-gio-extensions.c
@@ -65,14 +65,6 @@ thunar_g_file_new_for_trash (void)
 
 
 GFile *
-thunar_g_file_new_for_computer (void)
-{
-  return g_file_new_for_uri ("computer:///");
-}
-
-
-
-GFile *
 thunar_g_file_new_for_desktop (void)
 {
   return g_file_new_for_path (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
diff --git a/thunar/thunar-shortcuts-model.c b/thunar/thunar-shortcuts-model.c
index 52e68e4..1888cb3 100644
--- a/thunar/thunar-shortcuts-model.c
+++ b/thunar/thunar-shortcuts-model.c
@@ -990,7 +990,6 @@ thunar_shortcuts_model_shortcut_places (ThunarShortcutsModel *model)
   ThunarShortcut *shortcut;
   GFile          *home;
   GFile          *desktop;
-  GFile          *computer;
   GFile          *trash;
   ThunarFile     *file;
 
@@ -1066,23 +1065,17 @@ 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)
+  /* append the computer icon if browsing the computer is supported */
+  if (thunar_g_vfs_is_uri_scheme_supported ("computer"))
     {
       shortcut = g_slice_new0 (ThunarShortcut);
       shortcut->group = THUNAR_SHORTCUT_GROUP_PLACES_COMPUTER;
       shortcut->name = g_strdup (_("Computer"));
-      shortcut->file = file;
+      shortcut->location = g_file_new_for_uri ("computer://");
       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-tree-model.c b/thunar/thunar-tree-model.c
index 2835aeb..1848395 100644
--- a/thunar/thunar-tree-model.c
+++ b/thunar/thunar-tree-model.c
@@ -282,7 +282,6 @@ thunar_tree_model_init (ThunarTreeModel *model)
   ThunarTreeModelItem *item;
   ThunarFile          *file;
   GFile               *home;
-  GFile               *computer;
   GList               *system_paths = NULL;
   GList               *devices;
   GList               *lp;
@@ -313,9 +312,9 @@ thunar_tree_model_init (ThunarTreeModel *model)
   g_signal_connect (model->device_monitor, "device-removed", G_CALLBACK (thunar_tree_model_device_removed), model);
   g_signal_connect (model->device_monitor, "device-changed", G_CALLBACK (thunar_tree_model_device_changed), model);
 
-  /* add the computer folder to the system paths */
-  computer = thunar_g_file_new_for_computer ();
-  system_paths = g_list_append (system_paths, g_object_ref (computer));
+  /* append the computer icon if browsing the computer is supported */
+  if (thunar_g_vfs_is_uri_scheme_supported ("computer"))
+    system_paths = g_list_append (system_paths, g_file_new_for_uri ("computer://"));
 
   /* add the home folder to the system paths */
   home = thunar_g_file_new_for_home ();
@@ -332,7 +331,7 @@ thunar_tree_model_init (ThunarTreeModel *model)
   /* append the root file system */
   system_paths = g_list_append (system_paths, thunar_g_file_new_for_root ());
 
-  /* append the system defined nodes ('Home', 'Trash', 'File System') */
+  /* append the system defined nodes ('Computer', 'Home', 'Trash', 'Network', 'File System') */
   for (lp = system_paths; lp != NULL; lp = lp->next)
     {
       /* determine the file for the path */
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index db2f267..5f7b78c 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -3108,7 +3108,7 @@ thunar_window_action_open_computer (GtkAction    *action,
   _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
 
   /* determine the computer location */
-  computer = thunar_g_file_new_for_computer ();
+  computer = g_file_new_for_uri ("computer://");
 
   /* determine the file for this location */
   computer_file = thunar_file_get (computer, &error);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list