[gnome-photos] tracker-controller: Add "query-error" signal
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] tracker-controller: Add "query-error" signal
- Date: Tue, 13 Nov 2012 01:06:15 +0000 (UTC)
commit 6513cb614391f79c207b5c61008a4a0684b4e1d3
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Nov 13 01:49:39 2012 +0100
tracker-controller: Add "query-error" signal
po/POTFILES.in | 1 +
src/photos-marshalers.list | 1 +
src/photos-tracker-controller.c | 32 +++++++++++++++++++++++++++++---
src/photos-tracker-controller.h | 1 +
4 files changed, 32 insertions(+), 3 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 526d63c..07853d3 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -16,3 +16,4 @@ src/photos-search-type-manager.c
src/photos-selection-toolbar.c
src/photos-source-manager.c
src/photos-spinner-box.c
+src/photos-tracker-controller.c
\ No newline at end of file
diff --git a/src/photos-marshalers.list b/src/photos-marshalers.list
index fad4924..a380f7a 100644
--- a/src/photos-marshalers.list
+++ b/src/photos-marshalers.list
@@ -1,2 +1,3 @@
+VOID:CHAR,CHAR
VOID:ENUM,ENUM
VOID:INT,INT
diff --git a/src/photos-tracker-controller.c b/src/photos-tracker-controller.c
index 3f052db..cda6429 100644
--- a/src/photos-tracker-controller.c
+++ b/src/photos-tracker-controller.c
@@ -26,8 +26,10 @@
#include "config.h"
#include <glib.h>
+#include <glib/gi18n.h>
#include "photos-item-manager.h"
+#include "photos-marshalers.h"
#include "photos-offset-controller.h"
#include "photos-query-builder.h"
#include "photos-source-manager.h"
@@ -52,6 +54,7 @@ struct _PhotosTrackerControllerPrivate
enum
{
+ QUERY_ERROR,
QUERY_STATUS_CHANGED,
LAST_SIGNAL
};
@@ -73,6 +76,18 @@ static void photos_tracker_controller_set_query_status (PhotosTrackerController
static void
+photos_tracker_controller_query_error (PhotosTrackerController *self, GError *error)
+{
+ const gchar *primary = _("Unable to fetch the list of photos");
+
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ return;
+
+ g_signal_emit (self, signals[QUERY_ERROR], 0, primary, error->message);
+}
+
+
+static void
photos_tracker_controller_query_finished (PhotosTrackerController *self, GError *error)
{
PhotosTrackerControllerPrivate *priv = self->priv;
@@ -80,9 +95,7 @@ photos_tracker_controller_query_finished (PhotosTrackerController *self, GError
photos_tracker_controller_set_query_status (self, FALSE);
if (error != NULL)
- {
- /* TODO: print error */
- }
+ photos_tracker_controller_query_error (self, error);
else
photos_offset_controller_reset_count (priv->offset_cntrlr);
@@ -333,6 +346,19 @@ photos_tracker_controller_class_init (PhotosTrackerControllerClass *class)
object_class->dispose = photos_tracker_controller_dispose;
object_class->finalize = photos_tracker_controller_finalize;
+ signals[QUERY_ERROR] = g_signal_new ("query-error",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (PhotosTrackerControllerClass,
+ query_error),
+ NULL, /*accumulator */
+ NULL, /*accu_data */
+ _photos_marshal_VOID__CHAR_CHAR,
+ G_TYPE_NONE,
+ 2,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
+
signals[QUERY_STATUS_CHANGED] = g_signal_new ("query-status-changed",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
diff --git a/src/photos-tracker-controller.h b/src/photos-tracker-controller.h
index b56ed02..1662899 100644
--- a/src/photos-tracker-controller.h
+++ b/src/photos-tracker-controller.h
@@ -65,6 +65,7 @@ struct _PhotosTrackerControllerClass
{
GObjectClass parent_class;
+ void (*query_error) (PhotosTrackerController *self, const gchar *primary, const gchar *secondary);
void (*query_status_changed) (PhotosTrackerController *self, gboolean querying);
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]