diff options
author | robertxgray <[email protected]> | 2021-03-19 17:13:53 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2021-04-02 18:35:55 +0200 |
commit | 2149626bef57b8ec1bd3edea537dc4e8e7548d10 (patch) | |
tree | 4bef206a53a16a41edbc16ee66835783667ce64e /libcaja-private/caja-file-utilities.c | |
parent | 66a721932a0cde427c28e6836ed9e64f32cb239b (diff) | |
download | caja-2149626bef57b8ec1bd3edea537dc4e8e7548d10.tar.bz2 caja-2149626bef57b8ec1bd3edea537dc4e8e7548d10.tar.xz |
Improved filesystem check on dnd
Diffstat (limited to 'libcaja-private/caja-file-utilities.c')
-rw-r--r-- | libcaja-private/caja-file-utilities.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/libcaja-private/caja-file-utilities.c b/libcaja-private/caja-file-utilities.c index 0049514f..13a300a0 100644 --- a/libcaja-private/caja-file-utilities.c +++ b/libcaja-private/caja-file-utilities.c @@ -1299,6 +1299,42 @@ caja_restore_files_from_trash (GList *files, caja_file_list_unref (unhandled_files); } +char * +caja_get_filesystem_id_by_location (GFile *location, gboolean follow) +{ + GFileInfo *info; + GFileQueryInfoFlags flags; + char *filesystem_id = NULL; + + if (follow) { + flags = G_FILE_QUERY_INFO_NONE; + } else { + flags = G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS; + } + + info = g_file_query_info (location, G_FILE_ATTRIBUTE_ID_FILESYSTEM, flags, NULL, NULL); + if (info) { + if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_ID_FILESYSTEM)) { + filesystem_id = g_strdup ( + g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_ID_FILESYSTEM)); + } + g_object_unref (info); + } + return filesystem_id; +} + +char * +caja_get_filesystem_id_by_uri (const char *uri, gboolean follow) +{ + GFile *location; + char *filesystem_id; + + location = g_file_new_for_uri (uri); + filesystem_id = caja_get_filesystem_id_by_location (location, follow); + g_object_unref (location); + return filesystem_id; +} + #if !defined (CAJA_OMIT_SELF_CHECK) void |