[gnome-photos] selection-toolbar: Implement deletion of collections
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] selection-toolbar: Implement deletion of collections
- Date: Sun, 14 Apr 2013 21:42:26 +0000 (UTC)
commit f9a6be2dd57a757a3d13068975519ae50fb4313a
Author: Debarshi Ray <debarshir gnome org>
Date: Sun Apr 14 13:49:34 2013 +0200
selection-toolbar: Implement deletion of collections
src/photos-base-item.c | 16 ++++++++++++++++
src/photos-base-item.h | 2 ++
src/photos-selection-toolbar.c | 6 +++++-
3 files changed, 23 insertions(+), 1 deletion(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 0d6c057..14f478b 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -33,6 +33,7 @@
#include "photos-base-item.h"
#include "photos-collection-icon-watcher.h"
+#include "photos-delete-item-job.h"
#include "photos-print-operation.h"
#include "photos-query.h"
#include "photos-single-item-job.h"
@@ -1038,3 +1039,18 @@ photos_base_item_set_favorite (PhotosBaseItem *self, gboolean favorite)
{
PHOTOS_BASE_ITEM_GET_CLASS (self)->set_favorite (self, favorite);
}
+
+
+void
+photos_base_item_trash (PhotosBaseItem *self)
+{
+ PhotosBaseItemPrivate *priv = self->priv;
+ PhotosDeleteItemJob *job;
+
+ if (!priv->collection)
+ return;
+
+ job = photos_delete_item_job_new (priv->id);
+ photos_delete_item_job_run (job, NULL, NULL);
+ g_object_unref (job);
+}
diff --git a/src/photos-base-item.h b/src/photos-base-item.h
index de228f3..6f6b2ba 100644
--- a/src/photos-base-item.h
+++ b/src/photos-base-item.h
@@ -135,6 +135,8 @@ void photos_base_item_set_default_app_name (PhotosBaseItem *self,
void photos_base_item_set_favorite (PhotosBaseItem *self, gboolean favorite);
+void photos_base_item_trash (PhotosBaseItem *self);
+
G_END_DECLS
#endif /* PHOTOS_BASE_ITEM_H */
diff --git a/src/photos-selection-toolbar.c b/src/photos-selection-toolbar.c
index b99171a..920b857 100644
--- a/src/photos-selection-toolbar.c
+++ b/src/photos-selection-toolbar.c
@@ -403,7 +403,11 @@ photos_selection_toolbar_trash_clicked (GtkButton *button, gpointer user_data)
selection = photos_selection_controller_get_selection (priv->sel_cntrlr);
for (l = selection; l != NULL; l = l->next)
{
- /* TODO: trash the doc */
+ PhotosBaseItem *item;
+ const gchar *urn = (gchar *) l->data;
+
+ item = PHOTOS_BASE_ITEM (photos_base_manager_get_object_by_id (priv->item_mngr, urn));
+ photos_base_item_trash (item);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]