[gnome-photos/wip/search: 11/22] application: Use PhotosSearchProvider
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/search: 11/22] application: Use PhotosSearchProvider
- Date: Wed, 19 Feb 2014 12:32:43 +0000 (UTC)
commit 59ac774f35ce2a4e7948f6753adadd82a5faba9a
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Feb 7 17:57:57 2014 +0100
application: Use PhotosSearchProvider
src/photos-application.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 79 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index c3fecc9..90149da 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;
};
@@ -136,6 +138,15 @@ photos_application_action_toggle (GSimpleAction *simple, GVariant *parameter, gp
static void
+photos_application_activate_result (PhotosApplication *self,
+ const gchar *identifier,
+ const gchar *const *terms,
+ guint timestamp)
+{
+}
+
+
+static void
photos_application_can_fullscreen_changed (PhotosApplication *self)
{
PhotosApplicationPrivate *priv = self->priv;
@@ -156,6 +167,12 @@ photos_application_fullscreen (PhotosApplication *self, GVariant *parameter)
static void
+photos_application_launch_search (PhotosApplication *self, const gchar* const *terms, guint timestamp)
+{
+}
+
+
+static void
photos_application_open_current (PhotosApplication *self)
{
PhotosApplicationPrivate *priv = self->priv;
@@ -420,6 +437,51 @@ 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;
+ gchar *search_provider_path = NULL;
+
+ if (!G_APPLICATION_CLASS (photos_application_parent_class)->dbus_register (application,
+ connection,
+ object_path,
+ error))
+ goto out;
+
+ search_provider_path = g_strconcat (object_path, PHOTOS_SEARCH_PROVIDER_PATH_SUFFIX, NULL);
+ if (!photos_search_provider_dbus_export (self->priv->search_provider, connection, search_provider_path,
error))
+ goto out;
+
+ ret_val = TRUE;
+
+ out:
+ g_free (search_provider_path);
+ return ret_val;
+}
+
+
+static void
+photos_application_dbus_unregister (GApplication *application,
+ GDBusConnection *connection,
+ const gchar *object_path)
+{
+ PhotosApplication *self = PHOTOS_APPLICATION (application);
+ gchar *search_provider_path = NULL;
+
+ search_provider_path = g_strconcat (object_path, PHOTOS_SEARCH_PROVIDER_PATH_SUFFIX, NULL);
+ photos_search_provider_dbus_unexport (self->priv->search_provider, connection, search_provider_path);
+
+ G_APPLICATION_CLASS (photos_application_parent_class)->dbus_unregister (application, connection,
object_path);
+
+ g_free (search_provider_path);
+}
+
+
static void
photos_application_startup (GApplication *application)
{
@@ -614,6 +676,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 +685,22 @@ 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 ();
+ g_signal_connect_swapped (priv->search_provider,
+ "activate-result",
+ G_CALLBACK (photos_application_activate_result),
+ self);
+ g_signal_connect_swapped (priv->search_provider,
+ "launch-search",
+ G_CALLBACK (photos_application_launch_search),
+ self);
}
@@ -636,6 +713,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]