[Xfce4-commits] <thunar:master> Fix browsing shortcuts and mountables in ThunarLauncher.
Jannis Pohlmann
noreply at xfce.org
Sun Jan 10 17:26:01 CET 2010
Updating branch refs/heads/master
to 79ca8dd4917d52bd4b8a3369409dd64f8e5520ce (commit)
from eb318b8ff1481cb4870a4b70bc949cf3c6e1c8b9 (commit)
commit 79ca8dd4917d52bd4b8a3369409dd64f8e5520ce
Author: Jannis Pohlmann <jannis at xfce.org>
Date: Sun Jan 10 17:23:39 2010 +0100
Fix browsing shortcuts and mountables in ThunarLauncher.
This commit introduces two new methods, thunar_file_is_shortcut() and
thunar_file_is_mountable() both of which can be used to identify special
file types we can browse in the file manager like directories (after
resolving and/or mounting them).
thunar/thunar-file.c | 42 ++++++++++++++++++++++++++++++++++++++++++
thunar/thunar-file.h | 2 ++
thunar/thunar-launcher.c | 4 +++-
3 files changed, 47 insertions(+), 1 deletions(-)
diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index 45e9530..e8ebe76 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -1949,6 +1949,48 @@ thunar_file_is_directory (const ThunarFile *file)
/**
+ * thunar_file_is_shortcut:
+ * @file : a #ThunarFile instance.
+ *
+ * Checks whether @file refers to a shortcut to something else.
+ *
+ * Return value: %TRUE if @file is a shortcut.
+ **/
+gboolean
+thunar_file_is_shortcut (const ThunarFile *file)
+{
+ _thunar_return_val_if_fail (THUNAR_IS_FILE (file), FALSE);
+
+ if (file->info == NULL)
+ return FALSE;
+
+ return thunar_file_get_kind (file) == G_FILE_TYPE_SHORTCUT;
+}
+
+
+
+/**
+ * thunar_file_is_mountable:
+ * @file : a #ThunarFile instance.
+ *
+ * Checks whether @file refers to a mountable file/directory.
+ *
+ * Return value: %TRUE if @file is a mountable file/directory.
+ **/
+gboolean
+thunar_file_is_mountable (const ThunarFile *file)
+{
+ _thunar_return_val_if_fail (THUNAR_IS_FILE (file), FALSE);
+
+ if (file->info == NULL)
+ return FALSE;
+
+ return thunar_file_get_kind (file) == G_FILE_TYPE_MOUNTABLE;
+}
+
+
+
+/**
* thunar_file_is_local:
* @file : a #ThunarFile instance.
*
diff --git a/thunar/thunar-file.h b/thunar/thunar-file.h
index 94d1f93..f67475a 100644
--- a/thunar/thunar-file.h
+++ b/thunar/thunar-file.h
@@ -187,6 +187,8 @@ gboolean thunar_file_get_free_space (const ThunarFile *file
gboolean thunar_file_is_mounted (const ThunarFile *file);
gboolean thunar_file_exists (const ThunarFile *file);
gboolean thunar_file_is_directory (const ThunarFile *file);
+gboolean thunar_file_is_shortcut (const ThunarFile *file);
+gboolean thunar_file_is_mountable (const ThunarFile *file);
gboolean thunar_file_is_local (const ThunarFile *file);
gboolean thunar_file_is_ancestor (const ThunarFile *file,
const ThunarFile *ancestor);
diff --git a/thunar/thunar-launcher.c b/thunar/thunar-launcher.c
index 4c2279d..c34faaf 100644
--- a/thunar/thunar-launcher.c
+++ b/thunar/thunar-launcher.c
@@ -745,7 +745,9 @@ thunar_launcher_update (ThunarLauncher *launcher)
/* determine the number of files/directories/executables */
for (lp = launcher->selected_files; lp != NULL; lp = lp->next, ++n_selected_files)
{
- if (thunar_file_is_directory (lp->data))
+ if (thunar_file_is_directory (lp->data)
+ || thunar_file_is_shortcut (lp->data)
+ || thunar_file_is_mountable (lp->data))
{
++n_directories;
}
More information about the Xfce4-commits
mailing list