[gnome-photos/wip/foo: 20/20] organize-collection-view: Use PhotosSetCollectionJob
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/foo: 20/20] organize-collection-view: Use PhotosSetCollectionJob
- Date: Sun, 31 Mar 2013 03:35:28 +0000 (UTC)
commit 104ff45ddf72c31ea2dac062b6bcbe934b59050e
Author: Debarshi Ray <debarshir gnome org>
Date: Sat Mar 30 16:42:38 2013 +0100
organize-collection-view: Use PhotosSetCollectionJob
src/photos-organize-collection-view.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-organize-collection-view.c b/src/photos-organize-collection-view.c
index 9d9a0d2..a94abe6 100644
--- a/src/photos-organize-collection-view.c
+++ b/src/photos-organize-collection-view.c
@@ -33,6 +33,7 @@
#include "photos-fetch-collection-state-job.h"
#include "photos-organize-collection-model.h"
#include "photos-organize-collection-view.h"
+#include "photos-set-collection-job.h"
struct _PhotosOrganizeCollectionViewPrivate
@@ -70,11 +71,22 @@ photos_organize_collection_view_check_cell (GtkTreeViewColumn *tree_column,
static void
+photos_organize_collection_view_set_collection_executed (gpointer user_data)
+{
+ PhotosOrganizeCollectionView *self = PHOTOS_ORGANIZE_COLLECTION_VIEW (user_data);
+
+ photos_organize_collection_model_refresh_collection_state (PHOTOS_ORGANIZE_COLLECTION_MODEL
(self->priv->model));
+ g_object_unref (self);
+}
+
+
+static void
photos_organize_collection_view_check_toggled (PhotosOrganizeCollectionView *self, gchar *path)
{
PhotosOrganizeCollectionViewPrivate *priv = self->priv;
GtkTreeIter iter;
GtkTreePath *tree_path;
+ PhotosSetCollectionJob *job;
gboolean state;
gchar *coll_urn;
@@ -83,7 +95,9 @@ photos_organize_collection_view_check_toggled (PhotosOrganizeCollectionView *sel
gtk_tree_model_get (GTK_TREE_MODEL (priv->model), &iter, PHOTOS_ORGANIZE_MODEL_ID, &coll_urn, -1);
state = gtk_cell_renderer_toggle_get_active (GTK_CELL_RENDERER_TOGGLE (priv->renderer_check));
- /* TODO: SetCollectionForSelectionJob */
+ job = photos_set_collection_job_new (coll_urn, !state);
+ photos_set_collection_job_run (job, photos_organize_collection_view_set_collection_executed, g_object_ref
(self));
+ g_object_unref (job);
g_free (coll_urn);
}
@@ -96,6 +110,7 @@ photos_organize_collection_view_create_collection_executed (const gchar *created
PhotosOrganizeCollectionViewPrivate *priv = self->priv;
GtkTreeIter iter;
GtkTreePath *path = NULL;
+ PhotosSetCollectionJob *job = NULL;
if (created_urn == NULL)
{
@@ -110,9 +125,11 @@ photos_organize_collection_view_create_collection_executed (const gchar *created
gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->model), &iter, path);
gtk_list_store_set (priv->model, &iter, PHOTOS_ORGANIZE_MODEL_ID, created_urn, -1);
- /* TODO: SetCollectionForSelectionJob */
+ job = photos_set_collection_job_new (created_urn, TRUE);
+ photos_set_collection_job_run (job, NULL, NULL);
out:
+ g_clear_object (&job);
if (path != NULL)
gtk_tree_path_free (path);
g_object_unref (self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]