Skip to content
Snippets Groups Projects
Commit 3a01c1e7 authored by Jannis Pohlmann's avatar Jannis Pohlmann
Browse files

Add function thunar_file_is_parent().

parent 14d505a1
No related branches found
No related tags found
No related merge requests found
......@@ -2008,6 +2008,37 @@ thunar_file_is_local (const ThunarFile *file)
/**
* thunar_file_is_parent:
* @file : a #ThunarFile instance.
* @child : another #ThunarFile instance.
*
* Determines whether @file is the parent directory of @child.
*
* Return value: %TRUE if @file is the parent of @child.
**/
gboolean
thunar_file_is_parent (const ThunarFile *file,
const ThunarFile *child)
{
gboolean is_parent = FALSE;
GFile *parent;
_thunar_return_val_if_fail (THUNAR_IS_FILE (file), FALSE);
_thunar_return_val_if_fail (THUNAR_IS_FILE (child), FALSE);
parent = g_file_get_parent (child->gfile);
if (parent != NULL)
{
is_parent = g_file_equal (file->gfile, parent);
g_object_unref (parent);
}
return is_parent;
}
/**
* thunar_file_is_ancestor:
* @file : a #ThunarFile instance.
......
......@@ -190,6 +190,8 @@ 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_parent (const ThunarFile *file,
const ThunarFile *child);
gboolean thunar_file_is_ancestor (const ThunarFile *file,
const ThunarFile *ancestor);
gboolean thunar_file_is_executable (const ThunarFile *file);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment