[gnome-photos/wip/foo: 13/13] organize-collection-view: Use PhotosSetCollectionJob
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/foo: 13/13] organize-collection-view: Use PhotosSetCollectionJob
- Date: Sat, 30 Mar 2013 15:47:48 +0000 (UTC)
commit aabdb23040b7f6bdd8ded7107298c41f57134324
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 2af31f0..596ab09 100644
--- a/src/photos-organize-collection-view.c
+++ b/src/photos-organize-collection-view.c
@@ -32,6 +32,7 @@
#include "photos-create-collection-job.h"
#include "photos-organize-collection-model.h"
#include "photos-organize-collection-view.h"
+#include "photos-set-collection-job.h"
struct _PhotosOrganizeCollectionViewPrivate
@@ -69,11 +70,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 (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;
@@ -82,7 +94,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);
}
@@ -95,6 +109,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)
{
@@ -109,9 +124,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 (&run);
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]