[frogr] Ensure pictures keep sorted when modifiying details



commit f66dfc974f91ced62529341752c5e8f53d04d5c5
Author: Mario Sanchez Prada <msanchez igalia com>
Date:   Wed May 25 18:38:09 2011 +0200

    Ensure pictures keep sorted when modifiying details

 src/frogr-controller.c     |   11 +++++++++++
 src/frogr-controller.h     |    2 ++
 src/frogr-details-dialog.c |    6 +++++-
 src/frogr-main-view.c      |   13 ++++++++++++-
 src/frogr-main-view.h      |    2 ++
 5 files changed, 32 insertions(+), 2 deletions(-)
---
diff --git a/src/frogr-controller.c b/src/frogr-controller.c
index 33fdcfc..50563f5 100644
--- a/src/frogr-controller.c
+++ b/src/frogr-controller.c
@@ -2304,6 +2304,17 @@ frogr_controller_upload_pictures (FrogrController *self)
 }
 
 void
+frogr_controller_reorder_pictures (FrogrController *self)
+{
+  FrogrControllerPrivate *priv = NULL;
+
+  g_return_if_fail(FROGR_IS_CONTROLLER (self));
+
+  priv = FROGR_CONTROLLER_GET_PRIVATE (self);
+  frogr_main_view_reorder_pictures (priv->mainview);
+}
+
+void
 frogr_controller_cancel_ongoing_request (FrogrController *self)
 {
   FrogrControllerPrivate *priv = NULL;
diff --git a/src/frogr-controller.h b/src/frogr-controller.h
index bc27971..fa7950a 100644
--- a/src/frogr-controller.h
+++ b/src/frogr-controller.h
@@ -119,6 +119,8 @@ void frogr_controller_load_pictures (FrogrController *self, GSList *fileuris);
 
 void frogr_controller_upload_pictures (FrogrController *self);
 
+void frogr_controller_reorder_pictures (FrogrController *self);
+
 void frogr_controller_cancel_ongoing_request (FrogrController *self);
 
 G_END_DECLS
diff --git a/src/frogr-details-dialog.c b/src/frogr-details-dialog.c
index 4d25bcf..5fa4d09 100644
--- a/src/frogr-details-dialog.c
+++ b/src/frogr-details-dialog.c
@@ -966,9 +966,13 @@ static void _dialog_response_cb (GtkDialog *dialog, gint response, gpointer data
 
   /* Try to save data if response is OK */
   if (response == GTK_RESPONSE_OK && _save_data (self) == FALSE)
-      return;
+    return;
 
   gtk_widget_destroy (GTK_WIDGET (self));
+
+  /* Ensure pictures are reordered on OK */
+  if (response == GTK_RESPONSE_OK)
+    frogr_controller_reorder_pictures (frogr_controller_get_instance ());
 }
 
 static void
diff --git a/src/frogr-main-view.c b/src/frogr-main-view.c
index d01705d..427c3dd 100644
--- a/src/frogr-main-view.c
+++ b/src/frogr-main-view.c
@@ -1056,7 +1056,7 @@ _add_picture_to_ui (FrogrMainView *self, FrogrPicture *picture)
 
   /* Reorder if needed */
   if (priv->sorting_criteria != SORT_AS_LOADED || priv->sorting_reversed)
-    _reorder_pictures (self, priv->sorting_criteria, priv->sorting_reversed);
+    frogr_main_view_reorder_pictures (self);
 
   /* Update upload size in state description */
   _update_state_description (self);
@@ -2107,6 +2107,17 @@ frogr_main_view_hide_progress (FrogrMainView *self)
   gtk_widget_hide (GTK_WIDGET (priv->progress_dialog));
 }
 
+void
+frogr_main_view_reorder_pictures (FrogrMainView *self)
+{
+  FrogrMainViewPrivate *priv = NULL;
+
+  g_return_if_fail(FROGR_IS_MAIN_VIEW (self));
+
+  priv = FROGR_MAIN_VIEW_GET_PRIVATE (self);
+  _reorder_pictures (self, priv->sorting_criteria, priv->sorting_reversed);
+}
+
 FrogrMainViewModel *
 frogr_main_view_get_model (FrogrMainView *self)
 {
diff --git a/src/frogr-main-view.h b/src/frogr-main-view.h
index 472ef77..be501e3 100644
--- a/src/frogr-main-view.h
+++ b/src/frogr-main-view.h
@@ -69,6 +69,8 @@ void frogr_main_view_pulse_progress (FrogrMainView *self);
 
 void frogr_main_view_hide_progress (FrogrMainView *self);
 
+void frogr_main_view_reorder_pictures (FrogrMainView *self);
+
 FrogrMainViewModel *frogr_main_view_get_model (FrogrMainView *self);
 
 G_END_DECLS



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