[frogr] Honor the sorting order when uploading elements



commit 310aa77726521aeaae5c27e3b017b43b0a67d7f2
Author: Mario Sanchez Prada <msanchez gnome org>
Date:   Wed Dec 12 16:55:03 2012 +0100

    Honor the sorting order when uploading elements

 src/frogr-controller.c |   35 ++++++++++++++---------------------
 src/frogr-controller.h |    2 +-
 src/frogr-main-view.c  |    2 +-
 3 files changed, 16 insertions(+), 23 deletions(-)
---
diff --git a/src/frogr-controller.c b/src/frogr-controller.c
index 1c8c404..63cc41d 100644
--- a/src/frogr-controller.c
+++ b/src/frogr-controller.c
@@ -2752,11 +2752,12 @@ frogr_controller_load_pictures (FrogrController *self,
 }
 
 void
-frogr_controller_upload_pictures (FrogrController *self)
+frogr_controller_upload_pictures (FrogrController *self, GSList *pictures)
 {
   FrogrControllerPrivate *priv = NULL;
 
   g_return_if_fail(FROGR_IS_CONTROLLER (self));
+  g_return_if_fail(pictures);
 
   priv = FROGR_CONTROLLER_GET_PRIVATE (self);
 
@@ -2774,27 +2775,19 @@ frogr_controller_upload_pictures (FrogrController *self)
     }
   else
     {
-      FrogrModel *model = NULL;
-      GSList *pictures = NULL;
+      UploadPicturesData *up_data = g_slice_new0 (UploadPicturesData);
+      up_data->pictures = g_slist_copy (pictures);
+      up_data->current = up_data->pictures;
+      up_data->index = 0;
+      up_data->n_pictures = g_slist_length (pictures);
 
-      model = frogr_main_view_get_model (priv->mainview);
-      pictures = frogr_model_get_pictures (model);
-      if (pictures)
-        {
-          UploadPicturesData *up_data = g_slice_new0 (UploadPicturesData);
-          up_data->pictures = g_slist_copy (pictures);
-          up_data->current = up_data->pictures;
-          up_data->index = 0;
-          up_data->n_pictures = g_slist_length (pictures);
-
-          /* Add references */
-          g_slist_foreach (up_data->pictures, (GFunc)g_object_ref, NULL);
-
-          /* Load the pictures! */
-          _set_state (self, FROGR_STATE_UPLOADING_PICTURES);
-          frogr_main_view_show_progress (priv->mainview, NULL);
-          _upload_next_picture (self, up_data);
-        }
+      /* Add references */
+      g_slist_foreach (up_data->pictures, (GFunc)g_object_ref, NULL);
+
+      /* Load the pictures! */
+      _set_state (self, FROGR_STATE_UPLOADING_PICTURES);
+      frogr_main_view_show_progress (priv->mainview, NULL);
+      _upload_next_picture (self, up_data);
     }
 }
 
diff --git a/src/frogr-controller.h b/src/frogr-controller.h
index f2ba65f..4300eb8 100644
--- a/src/frogr-controller.h
+++ b/src/frogr-controller.h
@@ -117,7 +117,7 @@ void frogr_controller_revoke_authorization (FrogrController *self);
 
 void frogr_controller_load_pictures (FrogrController *self, GSList *fileuris);
 
-void frogr_controller_upload_pictures (FrogrController *self);
+void frogr_controller_upload_pictures (FrogrController *self, GSList *pictures);
 
 void frogr_controller_reorder_pictures (FrogrController *self);
 
diff --git a/src/frogr-main-view.c b/src/frogr-main-view.c
index fb11407..fd96096 100644
--- a/src/frogr-main-view.c
+++ b/src/frogr-main-view.c
@@ -1581,7 +1581,7 @@ _upload_pictures (FrogrMainView *self)
     return;
 
   gtk_icon_view_unselect_all (GTK_ICON_VIEW (priv->icon_view));
-  frogr_controller_upload_pictures (priv->controller);
+  frogr_controller_upload_pictures (priv->controller, priv->sorted_pictures);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]