[gnome-photos/wip/rishi/flowbox: 2/5] properties-dialog: Don't look for the camera if there is none



commit 34ee804fc857c7ac4010a6ef0e84b5a5da2483e3
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Jan 2 17:45:44 2017 +0100

    properties-dialog: Don't look for the camera if there is none
    
    If the item doesn't have any information about the equipment in its
    metadata, then there is no point looking for it.
    
    The code was surprisingly working so far because the following SPARQL:
      SELECT nfo:manufacturer (<(null)>) nfo:model (<(null)>) WHERE {}
    ... does not return an empty cursor or throw an error, but:
      (null), (null)

 src/photos-properties-dialog.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/photos-properties-dialog.c b/src/photos-properties-dialog.c
index fa610f9..0505790 100644
--- a/src/photos-properties-dialog.c
+++ b/src/photos-properties-dialog.c
@@ -367,11 +367,6 @@ photos_properties_dialog_constructed (GObject *object)
     }
 
   equipment = photos_base_item_get_equipment (item);
-  photos_camera_cache_get_camera_async (self->camera_cache,
-                                        equipment,
-                                        self->cancellable,
-                                        photos_properties_dialog_get_camera,
-                                        self);
   if (equipment != 0)
     {
       self->camera_w = gtk_label_new (_("Camera"));
@@ -511,6 +506,15 @@ photos_properties_dialog_constructed (GObject *object)
       g_free (dims_str);
     }
 
+  if (self->camera_w != NULL)
+    {
+      photos_camera_cache_get_camera_async (self->camera_cache,
+                                            equipment,
+                                            self->cancellable,
+                                            photos_properties_dialog_get_camera,
+                                            self);
+    }
+
   if (exposure_time_w != NULL)
     {
       GtkWidget *exposure_time_data;


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