[epiphany] Add ephy_file_move_uri to ephy-file-helpers
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Add ephy_file_move_uri to ephy-file-helpers
- Date: Tue, 7 Jan 2014 21:52:41 +0000 (UTC)
commit 5409a66aaa3ff2178504c6cfaa7adfe03624cba8
Author: Daniel Wyatt <Daniel Wyatt gmail com>
Date: Sat Nov 30 12:47:11 2013 -0500
Add ephy_file_move_uri to ephy-file-helpers
https://bugzilla.gnome.org/show_bug.cgi?id=674291
lib/ephy-file-helpers.c | 35 +++++++++++++++++++++++++++++++++++
lib/ephy-file-helpers.h | 2 ++
2 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
index fd4af38..f81d7d3 100644
--- a/lib/ephy-file-helpers.c
+++ b/lib/ephy-file-helpers.c
@@ -927,6 +927,41 @@ ephy_file_delete_uri (const char *uri)
}
/**
+ * ephy_file_move_uri
+ * @source_uri: URI of the file to be moved
+ * @dest_uri: URI of the destination
+ *
+ * Move from source_uri to dest_uri, overwriting if necessary.
+ */
+gboolean
+ephy_file_move_uri (const char *source_uri, const char *dest_uri)
+{
+ GFile *src;
+ GFile *dest;
+ gboolean ret;
+
+ g_return_if_fail (source_uri && dest_uri);
+
+ src = g_file_new_for_uri (source_uri);
+ dest = g_file_new_for_uri (dest_uri);
+
+ ret = g_file_move (src, dest, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL,
+ NULL);
+
+ if (ret == TRUE)
+ {
+ LOG ("Moved file '%s' to '%s'", source_uri, dest_uri);
+ }
+ else
+ {
+ LOG ("Couldn't move file '%s' to '%s'", source_uri, dest_uri);
+ }
+ g_object_unref (src);
+ g_object_unref (dest);
+ return ret;
+}
+
+/**
* ephy_file_create_data_uri_for_filename:
* @filename: the filename of a local path
* @mime_type: the MIME type of the filename, or %NULL
diff --git a/lib/ephy-file-helpers.h b/lib/ephy-file-helpers.h
index 28c83b2..4423f72 100644
--- a/lib/ephy-file-helpers.h
+++ b/lib/ephy-file-helpers.h
@@ -86,6 +86,8 @@ gboolean ephy_file_browse_to (GFile
gboolean ephy_file_delete_dir_recursively (GFile *file,
GError **error);
void ephy_file_delete_uri (const char *uri);
+gboolean ephy_file_move_uri (const char *source_uri,
+ const char *dest_uri);
char * ephy_file_create_data_uri_for_filename (const char *filename,
const char *mime_type);
char * ephy_sanitize_filename (char *filename);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]