[frogr] Removed internal field in model: 'n_pictures'
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [frogr] Removed internal field in model: 'n_pictures'
- Date: Sun, 11 Nov 2012 00:10:09 +0000 (UTC)
commit 4246db80e621d943767da703d6cbbcf88bbf7105
Author: Mario Sanchez Prada <msanchez gnome org>
Date: Sat Nov 10 02:03:52 2012 +0100
Removed internal field in model: 'n_pictures'
src/frogr-controller.c | 8 ++++----
src/frogr-main-view-model.c | 9 ++-------
src/frogr-main-view.c | 2 +-
3 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/src/frogr-controller.c b/src/frogr-controller.c
index 84298aa..095f4e2 100644
--- a/src/frogr-controller.c
+++ b/src/frogr-controller.c
@@ -2696,12 +2696,12 @@ frogr_controller_upload_pictures (FrogrController *self)
else
{
FrogrMainViewModel *mainview_model = NULL;
- mainview_model = frogr_main_view_get_model (priv->mainview);
+ GSList *pictures = NULL;
- if (frogr_main_view_model_n_pictures (mainview_model) > 0)
+ mainview_model = frogr_main_view_get_model (priv->mainview);
+ pictures = frogr_main_view_model_get_pictures (mainview_model);
+ if (pictures)
{
- GSList *pictures = frogr_main_view_model_get_pictures (mainview_model);
-
UploadPicturesData *up_data = g_slice_new0 (UploadPicturesData);
up_data->pictures = g_slist_copy (pictures);
up_data->current = up_data->pictures;
diff --git a/src/frogr-main-view-model.c b/src/frogr-main-view-model.c
index 91b9826..70915e4 100644
--- a/src/frogr-main-view-model.c
+++ b/src/frogr-main-view-model.c
@@ -37,7 +37,6 @@ typedef struct _FrogrMainViewModelPrivate FrogrMainViewModelPrivate;
struct _FrogrMainViewModelPrivate
{
GSList *pictures;
- guint n_pictures;
/* For sequential access of groups and sets */
GSList *remote_sets;
@@ -375,8 +374,6 @@ frogr_main_view_model_init (FrogrMainViewModel *self)
/* Init private data */
priv->pictures = NULL;
- priv->n_pictures = 0;
-
priv->remote_sets = NULL;
priv->local_sets = NULL;
priv->all_sets = NULL;
@@ -416,7 +413,6 @@ frogr_main_view_model_add_picture (FrogrMainViewModel *self,
priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
priv->pictures = g_slist_append (priv->pictures, g_object_ref (picture));
- priv->n_pictures++;
g_signal_emit (self, signals[PICTURE_ADDED], 0, picture);
g_signal_emit (self, signals[MODEL_CHANGED], 0);
@@ -433,11 +429,10 @@ frogr_main_view_model_remove_picture (FrogrMainViewModel *self,
priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
priv->pictures = g_slist_remove (priv->pictures, picture);
- priv->n_pictures--;
- g_object_unref (picture);
g_signal_emit (self, signals[PICTURE_REMOVED], 0, picture);
g_signal_emit (self, signals[MODEL_CHANGED], 0);
+ g_object_unref (picture);
}
guint
@@ -448,7 +443,7 @@ frogr_main_view_model_n_pictures (FrogrMainViewModel *self)
g_return_val_if_fail(FROGR_IS_MAIN_VIEW_MODEL (self), 0);
priv = FROGR_MAIN_VIEW_MODEL_GET_PRIVATE (self);
- return priv->n_pictures;
+ return g_slist_length (priv->pictures);
}
GSList *
diff --git a/src/frogr-main-view.c b/src/frogr-main-view.c
index ed9360c..86d43b2 100644
--- a/src/frogr-main-view.c
+++ b/src/frogr-main-view.c
@@ -1728,7 +1728,7 @@ _craft_state_description (FrogrMainView *mainview)
/* Check size of the loaded pictures, if any */
pictures = frogr_main_view_model_get_pictures (priv->model);
n_pictures = frogr_main_view_model_n_pictures (priv->model);
- if (n_pictures > 0)
+ if (n_pictures)
{
GSList *item = NULL;
gulong total_size = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]