X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=lib%2Fev-file-helpers.c;h=130c62b20a48c91475db47c47be066e04beed654;hb=c9ea2bcbed22ab98363d73825e614e0b91c60fcf;hp=b093853565c5292fb798386ce82106e56e48d4c7;hpb=bca369672136e5ff831ece9832afd42085808fba;p=evince.git diff --git a/lib/ev-file-helpers.c b/lib/ev-file-helpers.c index b0938535..130c62b2 100644 --- a/lib/ev-file-helpers.c +++ b/lib/ev-file-helpers.c @@ -23,9 +23,13 @@ #endif #include +#include #include #include -#include +#include +#include +#include +#include #include "ev-file-helpers.h" @@ -61,8 +65,7 @@ ev_dot_dir (void) { gboolean exists; - dot_dir = g_build_filename (g_get_home_dir (), - GNOME_DOT_GNOME, + dot_dir = g_build_filename (gnome_user_dir_get (), "evince", NULL); @@ -80,8 +83,9 @@ ev_file_helpers_init (void) void ev_file_helpers_shutdown (void) -{ - rmdir (tmp_dir); +{ + if (tmp_dir != NULL) + rmdir (tmp_dir); g_free (tmp_dir); g_free (dot_dir); @@ -124,3 +128,36 @@ ev_tmp_filename (void) return filename; } + +gboolean +ev_xfer_uri_simple (const char *from, + const char *to, + GError **error) +{ + GnomeVFSResult result; + GnomeVFSURI *source_uri; + GnomeVFSURI *target_uri; + + if (!from) + return FALSE; + + source_uri = gnome_vfs_uri_new (from); + target_uri = gnome_vfs_uri_new (to); + + result = gnome_vfs_xfer_uri (source_uri, target_uri, + GNOME_VFS_XFER_DEFAULT | GNOME_VFS_XFER_FOLLOW_LINKS, + GNOME_VFS_XFER_ERROR_MODE_ABORT, + GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE, + NULL, + NULL); + gnome_vfs_uri_unref (target_uri); + gnome_vfs_uri_unref (source_uri); + + if (result != GNOME_VFS_OK) + g_set_error (error, + G_FILE_ERROR, + G_FILE_ERROR_FAILED, + gnome_vfs_result_to_string (result)); + return (result == GNOME_VFS_OK); + +}