[gnome-photos/wip/search: 5/6] application: Use PhotosSearchProvider



commit 997486eb81c67c24ecbd229543004db137d33c1a
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Feb 7 17:57:57 2014 +0100

    application: Use PhotosSearchProvider

 src/photos-application.c |   49 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index c3fecc9..6ab9114 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -44,6 +44,7 @@
 #include "photos-mode-controller.h"
 #include "photos-properties-dialog.h"
 #include "photos-resources.h"
+#include "photos-search-provider.h"
 #include "photos-source-manager.h"
 
 
@@ -69,6 +70,7 @@ struct _PhotosApplicationPrivate
   PhotosBaseManager *src_mngr;
   PhotosCameraCache *camera_cache;
   PhotosModeController *mode_cntrlr;
+  PhotosSearchProvider *search_provider;
 };
 
 
@@ -420,6 +422,44 @@ photos_application_activate (GApplication *application)
 }
 
 
+static gboolean
+photos_application_dbus_register (GApplication *application,
+                                  GDBusConnection *connection,
+                                  const gchar *object_path,
+                                  GError **error)
+{
+  PhotosApplication *self = PHOTOS_APPLICATION (application);
+  gboolean ret_val = FALSE;
+
+  if (!G_APPLICATION_CLASS (photos_application_parent_class)->dbus_register (application,
+                                                                             connection,
+                                                                             object_path,
+                                                                             error))
+    goto out;
+
+  if (!photos_search_provider_dbus_export (self->priv->search_provider, connection, object_path, error))
+    goto out;
+
+  ret_val = TRUE;
+
+ out:
+  return ret_val;
+}
+
+
+static void
+photos_application_dbus_unregister (GApplication *application,
+                                    GDBusConnection *connection,
+                                    const gchar *object_path)
+{
+  PhotosApplication *self = PHOTOS_APPLICATION (application);
+
+  photos_search_provider_dbus_unexport (self->priv->search_provider, connection, object_path);
+
+  G_APPLICATION_CLASS (photos_application_parent_class)->dbus_unregister (application, connection, 
object_path);
+}
+
+
 static void
 photos_application_startup (GApplication *application)
 {
@@ -614,6 +654,7 @@ photos_application_dispose (GObject *object)
   g_clear_object (&priv->src_mngr);
   g_clear_object (&priv->camera_cache);
   g_clear_object (&priv->mode_cntrlr);
+  g_clear_object (&priv->search_provider);
 
   G_OBJECT_CLASS (photos_application_parent_class)->dispose (object);
 }
@@ -622,8 +663,14 @@ photos_application_dispose (GObject *object)
 static void
 photos_application_init (PhotosApplication *self)
 {
+  PhotosApplicationPrivate *priv;
+
   self->priv = photos_application_get_instance_private (self);
+  priv = self->priv;
+
   eog_debug_init ();
+
+  priv->search_provider = photos_search_provider_new ();
 }
 
 
@@ -636,6 +683,8 @@ photos_application_class_init (PhotosApplicationClass *class)
   object_class->constructor = photos_application_constructor;
   object_class->dispose = photos_application_dispose;
   application_class->activate = photos_application_activate;
+  application_class->dbus_register = photos_application_dbus_register;
+  application_class->dbus_unregister = photos_application_dbus_unregister;
   application_class->startup = photos_application_startup;
 
   /* TODO: Add miners-changed signal */


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