[gnome-photos] utils: Define a macro for the error domain GQuark



commit 89298a3de1169c3de1e9b40241b72e379e9f90f3
Author: Debarshi Ray <debarshir gnome org>
Date:   Sun Aug 11 09:36:02 2013 +0200

    utils: Define a macro for the error domain GQuark

 src/photos-flickr-item.c |   10 ++++------
 src/photos-utils.c       |    7 +++++++
 src/photos-utils.h       |    4 ++++
 3 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/photos-flickr-item.c b/src/photos-flickr-item.c
index eb42860..329e6e8 100644
--- a/src/photos-flickr-item.c
+++ b/src/photos-flickr-item.c
@@ -37,6 +37,7 @@
 #include "photos-flickr-item.h"
 #include "photos-source.h"
 #include "photos-source-manager.h"
+#include "photos-utils.h"
 
 
 struct _PhotosFlickrItemPrivate
@@ -125,9 +126,8 @@ photos_flickr_item_create_thumbnail (PhotosBaseItem *item, GCancellable *cancell
   identifier = photos_base_item_get_identifier (item);
   if (strlen (identifier) <= prefix_len || !g_str_has_prefix (identifier, flickr_prefix))
     {
-      /* FIXME: use proper #defines and enumerated types */
       g_set_error (error,
-                   g_quark_from_static_string ("gnome-photos-error"),
+                   PHOTOS_ERROR,
                    0,
                    "Invalid nao:identifier for Flickr item %s",
                    identifier);
@@ -139,9 +139,8 @@ photos_flickr_item_create_thumbnail (PhotosBaseItem *item, GCancellable *cancell
   resource_urn = photos_base_item_get_resource_urn (item);
   if (strlen (resource_urn) <= prefix_len || !g_str_has_prefix (resource_urn, resource_prefix))
     {
-      /* FIXME: use proper #defines and enumerated types */
       g_set_error (error,
-                   g_quark_from_static_string ("gnome-photos-error"),
+                   PHOTOS_ERROR,
                    0,
                    "Invalid nie:dataSource for Flickr item %s",
                    resource_urn);
@@ -154,9 +153,8 @@ photos_flickr_item_create_thumbnail (PhotosBaseItem *item, GCancellable *cancell
   source = grl_registry_lookup_source (registry, grilo_id);
   if (source == NULL)
     {
-      /* FIXME: use proper #defines and enumerated types */
       g_set_error (error,
-                   g_quark_from_static_string ("gnome-photos-error"),
+                   PHOTOS_ERROR,
                    0,
                    "Failed to find a GrlSource for %s",
                    grilo_id);
diff --git a/src/photos-utils.c b/src/photos-utils.c
index 1aefdb9..0b2b3cd 100644
--- a/src/photos-utils.c
+++ b/src/photos-utils.c
@@ -358,6 +358,13 @@ photos_utils_embed_image_in_frame (GdkPixbuf *source_image,
 }
 
 
+GQuark
+photos_utils_error_quark (void)
+{
+  return g_quark_from_static_string ("gnome-photos-error-quark");
+}
+
+
 static gchar *
 photos_utils_filename_get_extension_offset (const gchar *filename)
 {
diff --git a/src/photos-utils.h b/src/photos-utils.h
index 05e5d41..66df5ac 100644
--- a/src/photos-utils.h
+++ b/src/photos-utils.h
@@ -34,6 +34,8 @@
 
 G_BEGIN_DECLS
 
+#define PHOTOS_ERROR (photos_utils_error_quark ())
+
 GIcon           *photos_utils_create_collection_icon      (gint base_size, GList *pixbufs);
 
 GdkPixbuf       *photos_utils_create_pixbuf_from_node     (GeglNode *node);
@@ -49,6 +51,8 @@ GdkPixbuf       *photos_utils_embed_image_in_frame        (GdkPixbuf *source_ima
                                                            GtkBorder *slice_width,
                                                            GtkBorder *border_width);
 
+GQuark           photos_utils_error_quark                 (void);
+
 gchar           *photos_utils_filename_strip_extension    (const gchar *filename_with_extension);
 
 gint             photos_utils_get_icon_size               (void);


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