[nautilus/414-superfluous-slash-label-on-the-file-system-root: 18/18] pathbar: Show label for administrator root



commit 9ccec443a610505646bad362c24c2c923b29b884
Author: António Fernandes <antoniof gnome org>
Date:   Thu Jul 26 15:34:31 2018 +0100

    pathbar: Show label for administrator root
    
    Similar problem to the previous commit.
    
    Ideally, we should simply call it "Computer", since it is the same
    location. But we currently lack an effective visual clue that the
    admin: backend is in use.
    
    For that reason, label it "Administrator root" istead.

 src/nautilus-pathbar.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index fe87b7e80..81c19fe4d 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -46,6 +46,7 @@ typedef enum
     NORMAL_BUTTON,
     OTHER_LOCATIONS_BUTTON,
     ROOT_BUTTON,
+    ADMIN_ROOT_BUTTON,
     HOME_BUTTON,
     STARRED_BUTTON,
     RECENT_BUTTON,
@@ -312,6 +313,10 @@ get_dir_name (ButtonData *button_data)
         {
             return _("Computer");
         }
+        case ADMIN_ROOT_BUTTON:
+        {
+            return _("Administrator Root");
+        }
 
         case HOME_BUTTON:
         {
@@ -1286,6 +1291,7 @@ get_gicon (ButtonData *button_data)
     switch (button_data->type)
     {
         case ROOT_BUTTON:
+        case ADMIN_ROOT_BUTTON:
         {
             return g_themed_icon_new (NAUTILUS_ICON_FILESYSTEM);
         }
@@ -1390,10 +1396,8 @@ setup_button_type (ButtonData      *button_data,
                    NautilusPathBar *self,
                    GFile           *location)
 {
-    GMount *mount;
-    gchar *uri;
-
-    uri = g_file_get_uri (location);
+    g_autoptr (GMount) mount = NULL;
+    g_autofree gchar *uri = NULL;
 
     if (nautilus_is_root_directory (location))
     {
@@ -1419,20 +1423,21 @@ setup_button_type (ButtonData      *button_data,
         button_data->dir_name = g_mount_get_name (mount);
         button_data->type = MOUNT_BUTTON;
         button_data->is_root = TRUE;
-
-        g_object_unref (mount);
     }
     else if (nautilus_is_other_locations_directory (location))
     {
         button_data->type = OTHER_LOCATIONS_BUTTON;
         button_data->is_root = TRUE;
     }
+    else if (strcmp ((uri = g_file_get_uri (location)), "admin:///") == 0)
+    {
+        button_data->type = ADMIN_ROOT_BUTTON;
+        button_data->is_root = TRUE;
+    }
     else
     {
         button_data->type = NORMAL_BUTTON;
     }
-
-    g_free (uri);
 }
 
 static void
@@ -1598,6 +1603,7 @@ make_button_data (NautilusPathBar *self,
     switch (button_data->type)
     {
         case ROOT_BUTTON:
+        case ADMIN_ROOT_BUTTON:
         case HOME_BUTTON:
         case MOUNT_BUTTON:
         case RECENT_BUTTON:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]