]> www.fi.muni.cz Git - evince.git/commitdiff
[libdocument] Add ev_file_is_temp()
authorCarlos Garcia Campos <carlosgc@gnome.org>
Tue, 4 May 2010 11:44:31 +0000 (13:44 +0200)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Tue, 4 May 2010 11:44:31 +0000 (13:44 +0200)
libdocument/ev-file-helpers.c
libdocument/ev-file-helpers.h

index e0392f43089fa0ef866c27bc020559d91202b060..6483e2d7b5964094dd99e9667e77d0037b165f1f 100644 (file)
@@ -369,6 +369,25 @@ ev_tmp_uri_unlink (const gchar *uri)
        g_object_unref (file);
 }
 
+gboolean
+ev_file_is_temp (GFile *file)
+{
+       gchar   *path;
+       gboolean retval;
+
+       if (!g_file_is_native (file))
+               return FALSE;
+
+       path = g_file_get_path (file);
+       if (!path)
+               return FALSE;
+
+       retval = g_str_has_prefix (path, g_get_tmp_dir ());
+       g_free (path);
+
+       return retval;
+}
+
 /**
  * ev_xfer_uri_simple:
  * @from: the source URI
index d863caa420dd0978f298dc621a10b8314f46f212..fffae03ffc7c046d80f1a696e1a36d632bdc4470 100644 (file)
@@ -49,7 +49,7 @@ gchar       *ev_mkdtemp               (const char        *template,
 void         ev_tmp_filename_unlink   (const gchar       *filename);
 void         ev_tmp_file_unlink       (GFile             *file);
 void         ev_tmp_uri_unlink        (const gchar       *uri);
-
+gboolean     ev_file_is_temp          (GFile             *file);
 gboolean     ev_xfer_uri_simple       (const char        *from,
                                       const char        *to,
                                       GError           **error);