config/patches/base/nautilus/nautilus-extra-paths.patch

151 lines
4.1 KiB
Diff
Raw Permalink Normal View History

2022-02-05 21:42:36 +02:00
diff --git a/src/nautilus-file-utilities.c b/src/nautilus-file-utilities.c
index 3b161f5..e597e50 100644
--- a/src/nautilus-file-utilities.c
+++ b/src/nautilus-file-utilities.c
@@ -459,6 +459,45 @@ nautilus_is_home_directory (GFile *dir)
return g_file_equal (dir, home_dir);
}
+gboolean
+nautilus_is_ipfs_directory (GFile *dir)
+{
+ static GFile *ipfs_dir = NULL;
+
+ if (ipfs_dir == NULL)
+ {
+ ipfs_dir = g_file_new_for_path ("/ipfs");
+ }
+
+ return g_file_equal (dir, ipfs_dir);
+}
+
+gboolean
+nautilus_is_ipns_directory (GFile *dir)
+{
+ static GFile *ipns_dir = NULL;
+
+ if (ipns_dir == NULL)
+ {
+ ipns_dir = g_file_new_for_path ("/ipns");
+ }
+
+ return g_file_equal (dir, ipns_dir);
+}
+
+gboolean
+nautilus_is_nix_store_directory (GFile *dir)
+{
+ static GFile *nix_store_dir = NULL;
+
+ if (nix_store_dir == NULL)
+ {
+ nix_store_dir = g_file_new_for_path ("/nix/store");
+ }
+
+ return g_file_equal (dir, nix_store_dir);
+}
+
gboolean
nautilus_is_root_directory (GFile *dir)
{
diff --git a/src/nautilus-file-utilities.h b/src/nautilus-file-utilities.h
index 67df0e4..64eda25 100644
--- a/src/nautilus-file-utilities.h
+++ b/src/nautilus-file-utilities.h
@@ -36,6 +36,9 @@
*/
char * nautilus_get_user_directory (void);
char * nautilus_get_home_directory_uri (void);
+gboolean nautilus_is_ipfs_directory (GFile *dir);
+gboolean nautilus_is_ipns_directory (GFile *dir);
+gboolean nautilus_is_nix_store_directory (GFile *dir);
gboolean nautilus_is_root_directory (GFile *dir);
gboolean nautilus_is_home_directory (GFile *dir);
gboolean nautilus_is_home_directory_file (GFile *dir,
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 622686b..67ca14c 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -52,6 +52,9 @@ typedef enum
RECENT_BUTTON,
MOUNT_BUTTON,
TRASH_BUTTON,
+ IPFS_BUTTON,
+ IPNS_BUTTON,
+ NIX_STORE_BUTTON,
} ButtonType;
#define BUTTON_DATA(x) ((ButtonData *) (x))
@@ -327,6 +330,21 @@ get_dir_name (ButtonData *button_data)
return _("Home");
}
+ case IPFS_BUTTON:
+ {
+ return _("IPFS");
+ }
+
+ case IPNS_BUTTON:
+ {
+ return _("IPNS");
+ }
+
+ case NIX_STORE_BUTTON:
+ {
+ return _("Nix Store");
+ }
+
case OTHER_LOCATIONS_BUTTON:
{
return _("Other Locations");
@@ -1251,6 +1269,17 @@ get_gicon (ButtonData *button_data)
return g_themed_icon_new (NAUTILUS_ICON_FILESYSTEM);
}
+ case NIX_STORE_BUTTON:
+ {
+ return g_themed_icon_new ("weather-snow-symbolic");
+ }
+
+ case IPFS_BUTTON:
+ case IPNS_BUTTON:
+ {
+ return g_themed_icon_new (NAUTILUS_ICON_FOLDER_PUBLIC_SHARE);
+ }
+
case HOME_BUTTON:
{
return g_themed_icon_new (NAUTILUS_ICON_HOME);
@@ -1347,6 +1376,21 @@ setup_button_type (ButtonData *button_data,
{
button_data->type = ROOT_BUTTON;
}
+ else if (nautilus_is_ipfs_directory (location))
+ {
+ button_data->type = IPFS_BUTTON;
+ button_data->is_root = TRUE;
+ }
+ else if (nautilus_is_ipns_directory (location))
+ {
+ button_data->type = IPNS_BUTTON;
+ button_data->is_root = TRUE;
+ }
+ else if (nautilus_is_nix_store_directory (location))
+ {
+ button_data->type = NIX_STORE_BUTTON;
+ button_data->is_root = TRUE;
+ }
else if (nautilus_is_home_directory (location))
{
button_data->type = HOME_BUTTON;
@@ -1559,6 +1603,9 @@ make_button_data (NautilusPathBar *self,
case RECENT_BUTTON:
case STARRED_BUTTON:
case OTHER_LOCATIONS_BUTTON:
+ case IPFS_BUTTON:
+ case IPNS_BUTTON:
+ case NIX_STORE_BUTTON:
{
button_data->label = gtk_label_new (NULL);
button_data->disclosure_arrow = gtk_image_new_from_icon_name ("pan-down-symbolic",