[nautilus] file: add function nautilus_file_is_regular_file
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] file: add function nautilus_file_is_regular_file
- Date: Wed, 5 Oct 2016 16:54:16 +0000 (UTC)
commit dd78529457d6d4081a10983063afbb46b9672ff5
Author: Neha Yadav <inehayadav28 gmail com>
Date: Wed Oct 5 15:46:50 2016 +0530
file: add function nautilus_file_is_regular_file
In commit we added a new function named nautilus_file_is_regular_file
The problem is that there are function present in different files
named "!nautilus_file_is_directory()" like inside nautilus-file.c
near line #7798. So, if any newcomer will come and look into the files
then it is difficult for them to analyse that there is any other
option available for file or not.
To solve this issue create a new function inside nautilus-file
with name nautilus_file_is_a_regular_file. So, we can check
for explicit regular file type.
https://bugzilla.gnome.org/show_bug.cgi?id=772316
src/nautilus-file.c | 15 +++++++++++++++
src/nautilus-file.h | 1 +
2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index e3b6d74..7509f1c 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -8064,6 +8064,21 @@ nautilus_file_is_nautilus_link (NautilusFile *file)
}
/**
+ * nautilus_file_is_regular_file
+ *
+ * Check if this file is a regular file.
+ * @file: NautilusFile representing the file in question.
+ *
+ * Returns: TRUE if @file is a regular file.
+ *
+ **/
+gboolean
+nautilus_file_is_regular_file (NautilusFile *file)
+{
+ return nautilus_file_get_file_type (file) == G_FILE_TYPE_REGULAR;
+}
+
+/**
* nautilus_file_is_directory
*
* Check if this file is a directory.
diff --git a/src/nautilus-file.h b/src/nautilus-file.h
index 7552dff..96654e4 100644
--- a/src/nautilus-file.h
+++ b/src/nautilus-file.h
@@ -206,6 +206,7 @@ gboolean nautilus_file_is_broken_symbolic_link (Nautilu
gboolean nautilus_file_is_nautilus_link (NautilusFile
*file);
gboolean nautilus_file_is_executable (NautilusFile
*file);
gboolean nautilus_file_is_directory (NautilusFile
*file);
+gboolean nautlius_file_is_regular_file (NautilusFile
*file);
gboolean nautilus_file_is_user_special_directory (NautilusFile
*file,
GUserDirectory
special_directory);
gboolean nautilus_file_is_special_link (NautilusFile
*file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]