[gnome-photos/wip/flickr: 5/11] source-manager: Track GoaObjects that implement GoaPhotos



commit 72b9de02437bfe30d9d6dfcdc7e95549bf998e5a
Author: Marek Chalupa <mchalupa redhat com>
Date:   Mon Jul 1 13:22:27 2013 +0200

    source-manager: Track GoaObjects that implement GoaPhotos
    
    Bump minimum GOA version to 3.8.0 because we need the GoaPhotos
    interface.
    
    Fixes: https://bugzilla.gnome.org/697675

 configure.ac                |    3 ++-
 src/photos-source-manager.c |   23 ++++++++++++++++-------
 2 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 1f0177b..3723b58 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,7 @@ GLIB_GSETTINGS
 
 EXEMPI_MIN_VERSION=1.99.5
 GLIB_MIN_VERSION=2.35.1
+GOA_MIN_VERSION=3.8.0
 GTK_MIN_VERSION=3.9.4
 LIBEXIF_MIN_VERSION=0.6.14
 LIBRSVG_MIN_VERSION=2.26.0
@@ -88,7 +89,7 @@ PKG_CHECK_MODULES(GIO, [gio-2.0])
 PKG_CHECK_MODULES(GNOME_DESKTOP, [gnome-desktop-3.0])
 AC_DEFINE([GNOME_DESKTOP_USE_UNSTABLE_API], [], [We are aware that GNOME_DESKTOP's API can change])
 
-PKG_CHECK_MODULES(GOA, [goa-1.0])
+PKG_CHECK_MODULES(GOA, [goa-1.0 >= $GOA_MIN_VERSION])
 AC_DEFINE([GOA_API_IS_SUBJECT_TO_CHANGE], [], [We are aware that GOA's API can change])
 
 PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= $GTK_MIN_VERSION])
diff --git a/src/photos-source-manager.c b/src/photos-source-manager.c
index 9651aab..83f7d74 100644
--- a/src/photos-source-manager.c
+++ b/src/photos-source-manager.c
@@ -48,6 +48,9 @@ photos_source_manager_client_account_added (GoaClient *client, GoaObject *object
   PhotosSourceManager *self = PHOTOS_SOURCE_MANAGER (user_data);
   PhotosSource *source;
 
+  if (goa_object_peek_photos (object) == NULL)
+    return;
+
   source = photos_source_new_from_goa_object (object);
   photos_base_manager_add_object (PHOTOS_BASE_MANAGER (self), G_OBJECT (source));
   g_object_unref (source);
@@ -71,8 +74,11 @@ static void
 photos_source_manager_client_account_changed (GoaClient *client, GoaObject *object, gpointer user_data)
 {
   PhotosSourceManager *self = PHOTOS_SOURCE_MANAGER (user_data);
-  photos_source_manager_client_account_removed (client, object, user_data);
-  photos_source_manager_client_account_added (client, object, user_data);
+
+  if (goa_object_peek_photos (object) == NULL)
+    photos_source_manager_client_account_removed (client, object, user_data);
+  else
+    photos_source_manager_client_account_added (client, object, user_data);
 }
 
 
@@ -86,15 +92,18 @@ photos_source_manager_refresh_accounts (PhotosSourceManager *self)
   accounts = goa_client_get_accounts (priv->client);
   for (l = accounts; l != NULL; l = l->next)
     {
+      GoaObject *object = GOA_OBJECT (l->data);
       PhotosSource *source;
 
-      if (goa_object_peek_account (GOA_OBJECT (l->data)) == NULL)
+      if (goa_object_peek_account (object) == NULL)
+        continue;
+
+      if (goa_object_peek_photos (object) == NULL)
         continue;
 
-      /* TODO: uncomment when we start supporting online providers */
-      /* source = photos_source_new_from_goa_object (GOA_OBJECT (l->data)); */
-      /* photos_base_manager_add_object (PHOTOS_BASE_MANAGER (self), G_OBJECT (source)); */
-      /* g_object_unref (source); */
+      source = photos_source_new_from_goa_object (GOA_OBJECT (l->data));
+      photos_base_manager_add_object (PHOTOS_BASE_MANAGER (self), G_OBJECT (source));
+      g_object_unref (source);
     }
 
   g_list_free_full (accounts, g_object_unref);


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