[gnome-photos/wip/flickr: 14/14] Start the miners



commit 6efa8d7ab21b7594d84ec5ccf8d18b951796d211
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Jul 2 19:25:58 2013 +0200

    Start the miners
    
    Fixes: https://bugzilla.gnome.org/697675

 src/Makefile.am             |   10 +++++++++
 src/photos-gom-miner.xml    |   30 ++++++++++++++++++++++++++++
 src/photos-source-manager.c |   45 ++++++++++++++++++++++++++++++++++++++++++-
 src/photos-source-manager.h |    8 ++++++-
 4 files changed, 91 insertions(+), 2 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 6243a14..59acb49 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -14,6 +14,8 @@ gnome_photos_built_sources = \
        photos-dleyna-renderer-manager.h \
        photos-dleyna-renderer-push-host.c \
        photos-dleyna-renderer-push-host.h \
+       photos-gom-miner.c \
+       photos-gom-miner.h \
        photos-marshalers.c \
        photos-marshalers.h \
        photos-mpris-player.c \
@@ -202,6 +204,7 @@ EXTRA_DIST = \
        photos-marshalers.list \
        photos-preview-menu.ui \
        photos-selection-menu.ui \
+       photos-gom-miner.xml \
        photos-tracker-resources.xml \
        photos-dleyna-renderer-device.xml \
        photos-dleyna-renderer-manager.xml \
@@ -410,6 +413,13 @@ photos-dleyna-renderer-push-host.h photos-dleyna-renderer-push-host.c: photos-dl
                --interface-prefix com.intel.dLeynaRenderer. \
                $<
 
+photos-gom-miner.h photos-gom-miner.c: photos-gom-miner.xml
+       $(AM_V_GEN)gdbus-codegen \
+               --c-namespace GomMiner \
+               --generate-c-code photos-gom-miner \
+               --interface-prefix org.gnome.OnlineMiners.Miner. \
+               $<
+
 photos-mpris-player.h photos-mpris-player.c: photos-mpris-player.xml
        $(AM_V_GEN)gdbus-codegen \
                --c-namespace Mpris \
diff --git a/src/photos-gom-miner.xml b/src/photos-gom-miner.xml
new file mode 100644
index 0000000..94ff188
--- /dev/null
+++ b/src/photos-gom-miner.xml
@@ -0,0 +1,30 @@
+<!DOCTYPE node PUBLIC
+"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd";>
+
+<!--
+ Photos - access, organize and share your photos on GNOME
+ Copyright © 2013 Red Hat, Inc.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+-->
+
+<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd";>
+  <interface name="org.gnome.OnlineMiners.Miner">
+    <method name="RefreshDB" />
+    <property name="DisplayName" type="s" access="read" />
+  </interface>
+</node>
diff --git a/src/photos-source-manager.c b/src/photos-source-manager.c
index 83f7d74..72e53e0 100644
--- a/src/photos-source-manager.c
+++ b/src/photos-source-manager.c
@@ -1,6 +1,6 @@
 /*
  * Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2013 Red Hat, Inc.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -197,3 +197,46 @@ photos_source_manager_new (void)
 {
   return g_object_new (PHOTOS_TYPE_SOURCE_MANAGER, NULL);
 }
+
+
+GList *
+photos_source_manager_get_for_provider_type (PhotosSourceManager *self, const gchar *provider_type)
+{
+  GHashTable *sources;
+  GHashTableIter iter;
+  GList *items = NULL;
+  PhotosSource *source;
+
+  sources = photos_base_manager_get_objects (PHOTOS_BASE_MANAGER (self));
+  g_hash_table_iter_init (&iter, sources);
+  while (g_hash_table_iter_next (&iter, NULL, (gpointer) &source))
+    {
+      GoaAccount *account;
+      GoaObject *object;
+
+      object = photos_source_get_goa_object (source);
+      if (object == NULL)
+        continue;
+
+      account = goa_object_peek_account (object);
+      if (g_strcmp0 (goa_account_get_provider_type (account), provider_type) == 0)
+        items = g_list_prepend (items, g_object_ref (source));
+    }
+
+  return items;
+}
+
+
+gboolean
+photos_source_manager_has_provider_type (PhotosSourceManager *self, const gchar *provider_type)
+{
+  GList *items;
+  gboolean ret_val = FALSE;
+
+  items = photos_source_manager_get_for_provider_type (self, provider_type);
+  if (items != NULL)
+    ret_val = TRUE;
+
+  g_list_free_full (items, g_object_unref);
+  return ret_val;
+}
diff --git a/src/photos-source-manager.h b/src/photos-source-manager.h
index e7df308..706de65 100644
--- a/src/photos-source-manager.h
+++ b/src/photos-source-manager.h
@@ -1,6 +1,6 @@
 /*
  * Photos - access, organize and share your photos on GNOME
- * Copyright © 2012 Red Hat, Inc.
+ * Copyright © 2012, 2013 Red Hat, Inc.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -70,6 +70,12 @@ GType                     photos_source_manager_get_type           (void) G_GNUC
 
 PhotosBaseManager        *photos_source_manager_new                (void);
 
+GList                    *photos_source_manager_get_for_provider_type (PhotosSourceManager *self,
+                                                                       const gchar *provider_type);
+
+gboolean                  photos_source_manager_has_provider_type     (PhotosSourceManager *self,
+                                                                       const gchar *provider_type);
+
 G_END_DECLS
 
 #endif /* PHOTOS_SOURCE_MANAGER_H */


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