[gnome-photos] embed, view-container: Let each mode have its own error page



commit c13a89ab47ad7778692684b2a09b44298b358cda
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Feb 6 10:51:10 2014 +0100

    embed, view-container: Let each mode have its own error page
    
    Fixes: https://bugzilla.gnome.org/720570

 src/photos-embed.c          |   23 -----------------------
 src/photos-view-container.c |   27 +++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 23 deletions(-)
---
diff --git a/src/photos-embed.c b/src/photos-embed.c
index 982b2b9..ac1f596 100644
--- a/src/photos-embed.c
+++ b/src/photos-embed.c
@@ -31,7 +31,6 @@
 
 #include "photos-application.h"
 #include "photos-embed.h"
-#include "photos-error-box.h"
 #include "photos-indexing-notification.h"
 #include "photos-item-manager.h"
 #include "photos-mode-controller.h"
@@ -53,7 +52,6 @@ struct _PhotosEmbedPrivate
   GAction *search_action;
   GCancellable *loader_cancellable;
   GtkWidget *collections;
-  GtkWidget *error_box;
   GtkWidget *favorites;
   GtkWidget *indexing_ntfctn;
   GtkWidget *no_results;
@@ -373,23 +371,6 @@ photos_embed_prepare_for_search (PhotosEmbed *self)
 
 
 static void
-photos_embed_set_error (PhotosEmbed *self, const gchar *primary, const gchar *secondary)
-{
-  PhotosEmbedPrivate *priv = self->priv;
-
-  photos_error_box_update (PHOTOS_ERROR_BOX (priv->error_box), primary, secondary);
-  gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), "error");
-}
-
-
-static void
-photos_embed_query_error (PhotosEmbed *self, const gchar *primary, const gchar *secondary)
-{
-  photos_embed_set_error (self, primary, secondary);
-}
-
-
-static void
 photos_embed_query_status_changed (PhotosEmbed *self, gboolean querying)
 {
   PhotosEmbedPrivate *priv = self->priv;
@@ -572,9 +553,6 @@ photos_embed_init (PhotosEmbed *self)
   priv->spinner_box = photos_spinner_box_new ();
   gtk_stack_add_named (GTK_STACK (priv->stack), priv->spinner_box, "spinner");
 
-  priv->error_box = photos_error_box_new ();
-  gtk_stack_add_named (GTK_STACK (priv->stack), priv->error_box, "error");
-
   /* TODO: SearchBar.Dropdown, …
    */
 
@@ -594,7 +572,6 @@ photos_embed_init (PhotosEmbed *self)
                     self);
 
   priv->trk_ovrvw_cntrlr = photos_tracker_overview_controller_dup_singleton ();
-  g_signal_connect_swapped (priv->trk_ovrvw_cntrlr, "query-error", G_CALLBACK (photos_embed_query_error), 
self);
   g_signal_connect_swapped (priv->trk_ovrvw_cntrlr,
                             "query-status-changed",
                             G_CALLBACK (photos_embed_query_status_changed),
diff --git a/src/photos-view-container.c b/src/photos-view-container.c
index 1614156..5c9d1e1 100644
--- a/src/photos-view-container.c
+++ b/src/photos-view-container.c
@@ -29,6 +29,7 @@
 #include "photos-application.h"
 #include "photos-empty-results-box.h"
 #include "photos-enums.h"
+#include "photos-error-box.h"
 #include "photos-item-manager.h"
 #include "photos-load-more-button.h"
 #include "photos-offset-favorites-controller.h"
@@ -51,6 +52,7 @@ struct _PhotosViewContainerPrivate
   GdMainView *view;
   GtkListStore *model;
   GtkTreePath *current_path;
+  GtkWidget *error_box;
   GtkWidget *load_more;
   GtkWidget *no_results;
   PhotosBaseManager *item_mngr;
@@ -184,6 +186,23 @@ photos_view_container_item_activated (GdMainView *main_view,
 
 
 static void
+photos_view_container_set_error (PhotosViewContainer *self, const gchar *primary, const gchar *secondary)
+{
+  PhotosViewContainerPrivate *priv = self->priv;
+
+  photos_error_box_update (PHOTOS_ERROR_BOX (priv->error_box), primary, secondary);
+  gtk_stack_set_visible_child_name (GTK_STACK (self), "error");
+}
+
+
+static void
+photos_view_container_query_error (PhotosViewContainer *self, const gchar *primary, const gchar *secondary)
+{
+  photos_view_container_set_error (self, primary, secondary);
+}
+
+
+static void
 photos_view_container_query_status_changed (PhotosTrackerController *trk_cntrlr,
                                             gboolean query_status,
                                             gpointer user_data)
@@ -279,6 +298,9 @@ photos_view_container_constructed (GObject *object)
   priv->no_results = photos_empty_results_box_new ();
   gtk_stack_add_named (GTK_STACK (self), priv->no_results, "no-results");
 
+  priv->error_box = photos_error_box_new ();
+  gtk_stack_add_named (GTK_STACK (self), priv->error_box, "error");
+
   priv->view = gd_main_view_new (GD_MAIN_VIEW_ICON);
   gtk_container_add (GTK_CONTAINER (grid), GTK_WIDGET (priv->view));
 
@@ -361,6 +383,11 @@ photos_view_container_constructed (GObject *object)
                            self,
                            G_CONNECT_SWAPPED);
 
+  g_signal_connect_object (priv->trk_cntrlr,
+                           "query-error",
+                           G_CALLBACK (photos_view_container_query_error),
+                           self,
+                           G_CONNECT_SWAPPED);
   g_signal_connect (priv->trk_cntrlr,
                     "query-status-changed",
                     G_CALLBACK (photos_view_container_query_status_changed),


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