[nautilus/414-superfluous-slash-label-on-the-file-system-root] pathbar: Show label for administrator root
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/414-superfluous-slash-label-on-the-file-system-root] pathbar: Show label for administrator root
- Date: Thu, 26 Jul 2018 14:41:44 +0000 (UTC)
commit a050182c6d7dc9af0b1c41f7839387476f2b7681
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-file-utilities.c | 13 +++++++++++++
src/nautilus-file-utilities.h | 1 +
src/nautilus-pathbar.c | 20 ++++++++++++--------
3 files changed, 26 insertions(+), 8 deletions(-)
---
diff --git a/src/nautilus-file-utilities.c b/src/nautilus-file-utilities.c
index 94198476d..45dd99ed9 100644
--- a/src/nautilus-file-utilities.c
+++ b/src/nautilus-file-utilities.c
@@ -471,6 +471,19 @@ nautilus_is_root_directory (GFile *dir)
return g_file_equal (dir, root_dir);
}
+gboolean
+nautilus_is_admin_root_directory (GFile *dir)
+{
+ static GFile *admin_root_dir = NULL;
+
+ if (admin_root_dir == NULL)
+ {
+ admin_root_dir = g_file_new_for_path ("admin:///");
+ }
+
+ return g_file_equal (dir, admin_root_dir);
+}
+
gboolean
nautilus_is_search_directory (GFile *dir)
{
diff --git a/src/nautilus-file-utilities.h b/src/nautilus-file-utilities.h
index de21f742f..5e040c221 100644
--- a/src/nautilus-file-utilities.h
+++ b/src/nautilus-file-utilities.h
@@ -37,6 +37,7 @@
char * nautilus_get_user_directory (void);
char * nautilus_get_home_directory_uri (void);
gboolean nautilus_is_root_directory (GFile *dir);
+gboolean nautilus_is_admin_root_directory (GFile *dir);
gboolean nautilus_is_home_directory (GFile *dir);
gboolean nautilus_is_home_directory_file (GFile *dir,
const char *filename);
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index fe87b7e80..608128079 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,16 +1396,17 @@ setup_button_type (ButtonData *button_data,
NautilusPathBar *self,
GFile *location)
{
- GMount *mount;
- gchar *uri;
-
- uri = g_file_get_uri (location);
+ g_autoptr (GMount) mount;
if (nautilus_is_root_directory (location))
{
button_data->type = ROOT_BUTTON;
}
else if (nautilus_is_home_directory (location))
+ {
+ button_data->type = ADMIN_ROOT_BUTTON;
+ }
+ else if (nautilus_is_home_directory (location))
{
button_data->type = HOME_BUTTON;
button_data->is_root = TRUE;
@@ -1419,8 +1426,6 @@ 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))
{
@@ -1431,8 +1436,6 @@ setup_button_type (ButtonData *button_data,
{
button_data->type = NORMAL_BUTTON;
}
-
- g_free (uri);
}
static void
@@ -1598,6 +1601,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]