diff options
author | Theo Linkspfeifer <lastonestanding@tutanota.com> | 2020-03-13 22:35:09 +0100 |
---|---|---|
committer | Alexander Schwinn <alexxcons@xfce.org> | 2020-03-13 22:35:09 +0100 |
commit | c9ae13f7b40ef4ce233324b4308171ef325f5c17 (patch) | |
tree | 36318a1842a6c58d1deb72026ce806095140cafd | |
parent | 7acdd87ff7dbf10a3dfd4ea6a263a9aeca7817b8 (diff) | |
download | thunar-c9ae13f7b40ef4ce233324b4308171ef325f5c17.tar.gz |
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
-rw-r--r-- | thunar/thunar-gio-extensions.c | 8 | ||||
-rw-r--r-- | thunar/thunar-shortcuts-model.c | 13 | ||||
-rw-r--r-- | thunar/thunar-tree-model.c | 9 | ||||
-rw-r--r-- | 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 93bd64fc..a72bef40 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 52e68e46..1888cb3b 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 2835aeb8..1848395f 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 db2f267d..5f7b78c8 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); |