[frogr] New functions to remove and set all the photosets at once.
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [frogr] New functions to remove and set all the photosets at once.
- Date: Sun, 11 Nov 2012 00:09:18 +0000 (UTC)
commit cabb17362cd9348370bda245384c9dae2fd60a8d
Author: Mario Sanchez Prada <msanchez gnome org>
Date: Fri Nov 9 17:45:01 2012 +0100
New functions to remove and set all the photosets at once.
Setting the photosets from a list of objects will split it into two
'remote sets' and a 'local sets' lists, for internal purposes.
src/frogr-main-view-model.c | 48 +++++++++++++++++++++++++++++++++++++++++++
src/frogr-main-view-model.h | 5 ++++
2 files changed, 53 insertions(+), 0 deletions(-)
---
diff --git a/src/frogr-main-view-model.c b/src/frogr-main-view-model.c
index 8731018..d0f46c5 100644
--- a/src/frogr-main-view-model.c
+++ b/src/frogr-main-view-model.c
@@ -501,6 +501,54 @@ frogr_main_view_model_get_photosets (FrogrMainViewModel *self)
return priv->all_sets;
}
+void
+frogr_main_view_model_set_photosets (FrogrMainViewModel *self,
+ GSList *photosets)
+{
+ FrogrMainViewModelPrivate *priv = NULL;
+ FrogrPhotoSet *set = NULL;
+ GSList *item = NULL;
+
+ g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
+
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
+
+ /* Remove all sets */
+ frogr_main_view_model_remove_all_photosets (self);
+
+ /* Set groups now, separating them into two lists: local and remote */
+ priv->remote_sets = photosets;
+ for (item = priv->remote_sets; item; item = g_slist_next (item))
+ {
+ set = FROGR_PHOTOSET(item->data);
+ if (frogr_photoset_is_local (set))
+ {
+ priv->remote_sets = g_slist_remove_link (priv->remote_sets, item);
+ frogr_main_view_model_add_local_photoset (self, set);
+ g_object_unref (set);
+ g_slist_free (item);
+ }
+ }
+}
+
+void
+frogr_main_view_model_remove_all_photosets (FrogrMainViewModel *self)
+{
+ FrogrMainViewModelPrivate *priv = NULL;
+
+ g_return_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self));
+
+ priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
+
+ g_slist_foreach (priv->local_sets, (GFunc)g_object_unref, NULL);
+ g_slist_free (priv->local_sets);
+ priv->local_sets = NULL;
+
+ g_slist_foreach (priv->remote_sets, (GFunc)g_object_unref, NULL);
+ g_slist_free (priv->remote_sets);
+ priv->remote_sets = NULL;
+}
+
guint
frogr_main_view_model_n_photosets (FrogrMainViewModel *self)
{
diff --git a/src/frogr-main-view-model.h b/src/frogr-main-view-model.h
index 49ad60f..150526a 100644
--- a/src/frogr-main-view-model.h
+++ b/src/frogr-main-view-model.h
@@ -85,6 +85,11 @@ void frogr_main_view_model_add_local_photoset (FrogrMainViewModel *self,
GSList *frogr_main_view_model_get_photosets (FrogrMainViewModel *self);
+void frogr_main_view_model_set_photosets (FrogrMainViewModel *self,
+ GSList *photosets);
+
+void frogr_main_view_model_remove_all_photosets (FrogrMainViewModel *self);
+
guint frogr_main_view_model_n_photosets (FrogrMainViewModel *self);
/* Groups */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]