[frogr] New function frogr_controller_get_main_view_model()
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [frogr] New function frogr_controller_get_main_view_model()
- Date: Sun, 11 Nov 2012 00:08:18 +0000 (UTC)
commit 9d9b69b61133688b106797629ff32b829e7db2a5
Author: Mario Sanchez Prada <msanchez gnome org>
Date: Thu Nov 8 15:43:02 2012 +0100
New function frogr_controller_get_main_view_model()
src/frogr-add-tags-dialog.c | 4 +---
src/frogr-controller.c | 14 ++++++++++++++
src/frogr-controller.h | 3 +++
src/frogr-create-new-set-dialog.c | 4 +---
src/frogr-details-dialog.c | 5 +----
5 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/src/frogr-add-tags-dialog.c b/src/frogr-add-tags-dialog.c
index a7b9ad6..8c85925 100644
--- a/src/frogr-add-tags-dialog.c
+++ b/src/frogr-add-tags-dialog.c
@@ -85,7 +85,6 @@ _dialog_response_cb (GtkDialog *dialog, gint response, gpointer data)
/* Check if there's something to add */
if (tags && !g_str_equal (tags, ""))
{
- FrogrMainView *mainview = NULL;
FrogrMainViewModel *model = NULL;
FrogrPicture *picture = NULL;
GSList *item = NULL;
@@ -100,8 +99,7 @@ _dialog_response_cb (GtkDialog *dialog, gint response, gpointer data)
}
/* Add tags to the model */
- mainview = frogr_controller_get_main_view (frogr_controller_get_instance ());
- model = frogr_main_view_get_model (mainview);
+ model = frogr_controller_get_main_view_model (frogr_controller_get_instance ());
frogr_main_view_model_add_local_tags_from_string (model, tags);
}
diff --git a/src/frogr-controller.c b/src/frogr-controller.c
index d46a138..21aca43 100644
--- a/src/frogr-controller.c
+++ b/src/frogr-controller.c
@@ -2145,6 +2145,20 @@ frogr_controller_get_main_view (FrogrController *self)
return priv->mainview;
}
+FrogrMainViewModel *
+frogr_controller_get_main_view_model (FrogrController *self)
+{
+ FrogrControllerPrivate *priv = NULL;
+
+ g_return_val_if_fail(FROGR_IS_CONTROLLER (self), FALSE);
+
+ priv = FROGR_CONTROLLER_GET_PRIVATE (self);
+ if (!priv->mainview)
+ return NULL;
+
+ return frogr_main_view_get_model (priv->mainview);;
+}
+
gboolean
frogr_controller_run_app (FrogrController *self)
{
diff --git a/src/frogr-controller.h b/src/frogr-controller.h
index 52ed3b8..b9273fe 100644
--- a/src/frogr-controller.h
+++ b/src/frogr-controller.h
@@ -23,6 +23,7 @@
#include "frogr-account.h"
#include "frogr-main-view.h"
+#include "frogr-main-view-model.h"
#include "frogr-picture.h"
#include <config.h>
@@ -66,6 +67,8 @@ FrogrController *frogr_controller_get_instance (void);
FrogrMainView *frogr_controller_get_main_view (FrogrController *self);
+FrogrMainViewModel *frogr_controller_get_main_view_model (FrogrController *self);
+
gboolean frogr_controller_run_app (FrogrController *self);
gboolean frogr_controller_quit_app (FrogrController *self);
diff --git a/src/frogr-create-new-set-dialog.c b/src/frogr-create-new-set-dialog.c
index a6f6fad..41a32bb 100644
--- a/src/frogr-create-new-set-dialog.c
+++ b/src/frogr-create-new-set-dialog.c
@@ -170,7 +170,6 @@ _update_model (FrogrCreateNewSetDialog *self,
{
FrogrCreateNewSetDialogPrivate *priv = NULL;
FrogrController *controller = NULL;
- FrogrMainView *mainview = NULL;
FrogrMainViewModel *mainview_model = NULL;
FrogrPhotoSet *new_set = NULL;
FrogrPicture *picture = NULL;
@@ -179,8 +178,7 @@ _update_model (FrogrCreateNewSetDialog *self,
priv = FROGR_CREATE_NEW_SET_DIALOG_GET_PRIVATE (self);
controller = frogr_controller_get_instance ();
- mainview = frogr_controller_get_main_view (controller);
- mainview_model = frogr_main_view_get_model (mainview);
+ mainview_model = frogr_controller_get_main_view_model (controller);
/* Add the set to the model */
new_set = frogr_photoset_new_local (title, description);
diff --git a/src/frogr-details-dialog.c b/src/frogr-details-dialog.c
index eec6ff8..e27a331 100644
--- a/src/frogr-details-dialog.c
+++ b/src/frogr-details-dialog.c
@@ -999,11 +999,8 @@ _save_data (FrogrDetailsDialog *self)
/* Add tags to the model */
if (!g_str_equal (tags, ""))
{
- FrogrMainView *mainview = NULL;
FrogrMainViewModel *model = NULL;
-
- mainview = frogr_controller_get_main_view (frogr_controller_get_instance ());
- model = frogr_main_view_get_model (mainview);
+ model = frogr_controller_get_main_view_model (frogr_controller_get_instance ());
frogr_main_view_model_add_local_tags_from_string (model, tags);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]