[gnome-photos] local-item: Use the trash
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] local-item: Use the trash
- Date: Mon, 13 Apr 2015 11:08:46 +0000 (UTC)
commit a7e81cfbf2e59cfe21da804645b6dc7c61771331
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Apr 13 13:07:30 2015 +0200
local-item: Use the trash
It's there for when the user makes a mistake, but also for when the
software makes one.
Original patch from Bastien Nocera for gnome-documents.
https://bugzilla.gnome.org/show_bug.cgi?id=747696
src/photos-local-item.c | 48 +++++++++++++++++++++++-----------------------
1 files changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/src/photos-local-item.c b/src/photos-local-item.c
index 978a054..b4f353c 100644
--- a/src/photos-local-item.c
+++ b/src/photos-local-item.c
@@ -1,7 +1,7 @@
/*
* Photos - access, organize and share your photos on GNOME
* Copyright © 2014 Pranav Kant
- * Copyright © 2012, 2013, 2014 Red Hat, Inc.
+ * Copyright © 2012, 2013, 2014, 2015 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -42,28 +42,6 @@ G_DEFINE_TYPE_WITH_CODE (PhotosLocalItem, photos_local_item, PHOTOS_TYPE_BASE_IT
0));
-static void
-photos_local_item_delete (GObject *source_object, GAsyncResult *res, gpointer user_data)
-{
- PhotosLocalItem *self = PHOTOS_LOCAL_ITEM (user_data);
- GError *error;
- GFile *file = G_FILE (source_object);
-
- error = NULL;
- g_file_delete_finish (file, res, &error);
- if (error != NULL)
- {
- const gchar *uri;
-
- uri = photos_base_item_get_uri (PHOTOS_BASE_ITEM (self));
- g_warning ("Unable to delete %s: %s", uri, error->message);
- g_error_free (error);
- }
-
- g_object_unref (self);
-}
-
-
static gchar *
photos_local_item_create_name_fallback (PhotosBaseItem *item)
{
@@ -144,6 +122,28 @@ photos_local_item_get_source_widget (PhotosBaseItem *item)
static void
+photos_local_item_trash_finish (GObject *source_object, GAsyncResult *res, gpointer user_data)
+{
+ PhotosLocalItem *self = PHOTOS_LOCAL_ITEM (user_data);
+ GError *error;
+ GFile *file = G_FILE (source_object);
+
+ error = NULL;
+ g_file_trash_finish (file, res, &error);
+ if (error != NULL)
+ {
+ const gchar *uri;
+
+ uri = photos_base_item_get_uri (PHOTOS_BASE_ITEM (self));
+ g_warning ("Unable to trash %s: %s", uri, error->message);
+ g_error_free (error);
+ }
+
+ g_object_unref (self);
+}
+
+
+static void
photos_local_item_trash (PhotosBaseItem *item)
{
GFile *file;
@@ -154,7 +154,7 @@ photos_local_item_trash (PhotosBaseItem *item)
uri = photos_base_item_get_uri (item);
file = g_file_new_for_uri (uri);
- g_file_delete_async (file, G_PRIORITY_DEFAULT, NULL, photos_local_item_delete, g_object_ref (item));
+ g_file_trash_async (file, G_PRIORITY_DEFAULT, NULL, photos_local_item_trash_finish, g_object_ref (item));
g_object_unref (file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]