diff --git a/thunar/thunar-gio-extensions.c b/thunar/thunar-gio-extensions.c index a72bef40e24f733abc25e14e1eca17eddfe8918c..93bd64fc41e91f823e4cbd03a280c90ade4ede5f 100644 --- a/thunar/thunar-gio-extensions.c +++ b/thunar/thunar-gio-extensions.c @@ -64,6 +64,14 @@ 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) { diff --git a/thunar/thunar-gio-extensions.h b/thunar/thunar-gio-extensions.h index 48cc8acabf91ff56b40141d5ab299c85ed48361c..28a63e4dbc026f9718d9c58a9efc6bfbdcc14774 100644 --- a/thunar/thunar-gio-extensions.h +++ b/thunar/thunar-gio-extensions.h @@ -29,6 +29,7 @@ GFile *thunar_g_file_new_for_home (void); GFile *thunar_g_file_new_for_root (void); GFile *thunar_g_file_new_for_trash (void); GFile *thunar_g_file_new_for_desktop (void); +GFile *thunar_g_file_new_for_computer (void); GFile *thunar_g_file_new_for_bookmarks (void); gboolean thunar_g_file_is_root (GFile *file); diff --git a/thunar/thunar-window-ui.xml b/thunar/thunar-window-ui.xml index d251a706de0d727333aaacbcd74276d1a01e2031..457b82b2f6fe7646086998e854a3a1917daa7e1c 100644 --- a/thunar/thunar-window-ui.xml +++ b/thunar/thunar-window-ui.xml @@ -80,6 +80,7 @@ <menuitem action="open-home" /> <menuitem action="open-desktop" /> + <menuitem action="open-computer" /> <placeholder name="placeholder-go-items-actions" /> <menuitem action="open-file-system" /> <menuitem action="open-templates" /> diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c index 81d528a5f7ae0a4acb57d0d19c761ff5cea0397f..b37e6783abb3f33b3326185c3fccddfcc40273e7 100644 --- a/thunar/thunar-window.c +++ b/thunar/thunar-window.c @@ -201,6 +201,8 @@ static void thunar_window_action_open_home (GtkAction ThunarWindow *window); static void thunar_window_action_open_desktop (GtkAction *action, ThunarWindow *window); +static void thunar_window_action_open_computer (GtkAction *action, + ThunarWindow *window); static void thunar_window_action_open_templates (GtkAction *action, ThunarWindow *window); static void thunar_window_action_open_file_system (GtkAction *action, @@ -376,6 +378,7 @@ static GtkActionEntry action_entries[] = { "open-parent", "go-up-symbolic", N_ ("Open _Parent"), "<alt>Up", N_ ("Open the parent folder"), G_CALLBACK (thunar_window_action_go_up), }, { "open-home", "go-home-symbolic", N_ ("_Home"), "<alt>Home", N_ ("Go to the home folder"), G_CALLBACK (thunar_window_action_open_home), }, { "open-desktop", "user-desktop", N_ ("Desktop"), NULL, N_ ("Go to the desktop folder"), G_CALLBACK (thunar_window_action_open_desktop), }, + { "open-computer", "computer-symbolic", N_ ("Computer"), NULL, N_ ("Go to the computer folder"), G_CALLBACK (thunar_window_action_open_computer), }, { "open-file-system", "drive-harddisk", N_ ("File System"), NULL, N_ ("Browse the file system"), G_CALLBACK (thunar_window_action_open_file_system), }, { "open-network", "network-workgroup", N_("B_rowse Network"), NULL, N_ ("Browse local network connections"), G_CALLBACK (thunar_window_action_open_network), }, { "open-templates", "text-x-generic-template", N_("T_emplates"), NULL, N_ ("Go to the templates folder"), G_CALLBACK (thunar_window_action_open_templates), }, @@ -3094,6 +3097,40 @@ G_GNUC_END_IGNORE_DEPRECATIONS +static void +thunar_window_action_open_computer (GtkAction *action, + ThunarWindow *window) +{ + GFile *computer; + ThunarFile *computer_file; + GError *error = NULL; + + _thunar_return_if_fail (THUNAR_IS_WINDOW (window)); + + /* determine the path to the computer directory */ + computer = thunar_g_file_new_for_computer (); + + /* determine the file for the computer directory */ + computer_file = thunar_file_get (computer, &error); + if (G_UNLIKELY (computer_file == NULL)) + { + /* display an error to the user */ + thunar_dialogs_show_error (GTK_WIDGET (window), error, _("Failed to open the computer folder")); + g_error_free (error); + } + else + { + /* open the computer folder */ + thunar_window_set_current_directory (window, computer_file); + g_object_unref (G_OBJECT (computer_file)); + } + + /* release our reference on the computer path */ + g_object_unref (computer); +} + + + static void thunar_window_action_open_templates (GtkAction *action, ThunarWindow *window)