[gnome-photos/wip/search: 17/23] application: Implement launch_search



commit b6f403d76d3cebcec6c826f887cb9987557ee443
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Feb 18 14:42:11 2014 +0100

    application: Implement launch_search

 src/photos-application.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index a3f78de..a41ea6e 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-controller.h"
 #include "photos-search-provider.h"
 #include "photos-source-manager.h"
 
@@ -70,6 +71,7 @@ struct _PhotosApplicationPrivate
   PhotosBaseManager *src_mngr;
   PhotosCameraCache *camera_cache;
   PhotosModeController *mode_cntrlr;
+  PhotosSearchController *srch_cntrlr;
   PhotosSearchProvider *search_provider;
   guint32 activation_timestamp;
 };
@@ -217,6 +219,22 @@ photos_application_init_app_menu (PhotosApplication *self)
 static void
 photos_application_launch_search (PhotosApplication *self, const gchar* const *terms, guint timestamp)
 {
+  PhotosApplicationPrivate *priv = self->priv;
+  GVariant *state;
+  gchar *str;
+
+  photos_application_create_window (self);
+  photos_mode_controller_set_window_mode (priv->mode_cntrlr, PHOTOS_WINDOW_MODE_OVERVIEW);
+
+  str = g_strjoinv (" ", (gchar **) terms);
+  photos_search_controller_set_string (priv->srch_cntrlr, str);
+  g_free (str);
+
+  state = g_variant_new ("b", TRUE);
+  g_action_group_change_action_state (G_ACTION_GROUP (self), "search", state);
+
+  priv->activation_timestamp = timestamp;
+  g_application_activate (G_APPLICATION (self));
 }
 
 
@@ -593,6 +611,7 @@ photos_application_startup (GApplication *application)
   priv->camera_cache = photos_camera_cache_dup_singleton ();
 
   priv->mode_cntrlr = photos_mode_controller_dup_singleton ();
+  priv->srch_cntrlr = photos_search_controller_dup_singleton ();
 
   action = g_simple_action_new ("about", NULL);
   g_signal_connect_swapped (action, "activate", G_CALLBACK (photos_application_about), self);
@@ -712,6 +731,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->srch_cntrlr);
   g_clear_object (&priv->search_provider);
 
   G_OBJECT_CLASS (photos_application_parent_class)->dispose (object);


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