[gnome-photos/wip/search: 27/35] dropdown, overview-searchbar: Use PhotosSearchMatchManager
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/search: 27/35] dropdown, overview-searchbar: Use PhotosSearchMatchManager
- Date: Tue, 28 Jan 2014 17:50:54 +0000 (UTC)
commit 9fa5a9a1c38b38e769ffff3d4270cb1afb0d9573
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Jan 27 11:22:19 2014 +0100
dropdown, overview-searchbar: Use PhotosSearchMatchManager
src/photos-dropdown.c | 9 ++++++++-
src/photos-overview-searchbar.c | 29 ++++++++++++++++++++++++-----
2 files changed, 32 insertions(+), 6 deletions(-)
---
diff --git a/src/photos-dropdown.c b/src/photos-dropdown.c
index e9a8eb8..fcf171a 100644
--- a/src/photos-dropdown.c
+++ b/src/photos-dropdown.c
@@ -30,14 +30,17 @@
#include "photos-base-view.h"
#include "photos-dropdown.h"
#include "photos-source-manager.h"
+#include "photos-search-match-manager.h"
#include "photos-search-type-manager.h"
struct _PhotosDropdownPrivate
{
GtkWidget *grid;
+ GtkWidget *match_view;
GtkWidget *source_view;
GtkWidget *type_view;
+ PhotosBaseManager *srch_mtch_mngr;
PhotosBaseManager *srch_typ_mngr;
PhotosBaseManager *src_mngr;
};
@@ -67,6 +70,7 @@ photos_dropdown_dispose (GObject *object)
PhotosDropdown *self = PHOTOS_DROPDOWN (object);
PhotosDropdownPrivate *priv = self->priv;
+ g_clear_object (&priv->srch_mtch_mngr);
g_clear_object (&priv->srch_typ_mngr);
g_clear_object (&priv->src_mngr);
@@ -84,13 +88,15 @@ photos_dropdown_init (PhotosDropdown *self)
self->priv = photos_dropdown_get_instance_private (self);
priv = self->priv;
+ priv->srch_mtch_mngr = photos_search_match_manager_dup_singleton ();
priv->srch_typ_mngr = photos_search_type_manager_dup_singleton ();
priv->src_mngr = photos_source_manager_dup_singleton ();
+ priv->match_view = photos_base_view_new (priv->srch_mtch_mngr);
priv->source_view = photos_base_view_new (priv->src_mngr);
priv->type_view = photos_base_view_new (priv->srch_typ_mngr);
- /* TODO: SearchMatchManager */
+ g_signal_connect_swapped (priv->match_view, "item-activated", G_CALLBACK (photos_dropdown_item_activated),
self);
g_signal_connect_swapped (priv->source_view, "item-activated", G_CALLBACK
(photos_dropdown_item_activated), self);
g_signal_connect_swapped (priv->type_view, "item-activated", G_CALLBACK (photos_dropdown_item_activated),
self);
@@ -107,6 +113,7 @@ photos_dropdown_init (PhotosDropdown *self)
gtk_container_add (GTK_CONTAINER (priv->grid), priv->source_view);
gtk_container_add (GTK_CONTAINER (priv->grid), priv->type_view);
+ gtk_container_add (GTK_CONTAINER (priv->grid), priv->match_view);
photos_dropdown_hide (self);
gtk_widget_show_all (GTK_WIDGET (self));
diff --git a/src/photos-overview-searchbar.c b/src/photos-overview-searchbar.c
index 57b2d03..83bfd89 100644
--- a/src/photos-overview-searchbar.c
+++ b/src/photos-overview-searchbar.c
@@ -32,6 +32,7 @@
#include "photos-collection-manager.h"
#include "photos-overview-searchbar.h"
#include "photos-search-controller.h"
+#include "photos-search-match-manager.h"
#include "photos-search-type.h"
#include "photos-search-type-manager.h"
#include "photos-source-manager.h"
@@ -42,12 +43,14 @@ struct _PhotosOverviewSearchbarPrivate
GAction *select_all;
GdTaggedEntry *search_entry;
GdTaggedEntryTag *src_tag;
+ GdTaggedEntryTag *srch_mtch_tag;
GdTaggedEntryTag *srch_typ_tag;
GtkWidget *dropdown;
GtkWidget *dropdown_button;
GtkWidget *search_container;
PhotosBaseManager *col_mngr;
PhotosBaseManager *src_mngr;
+ PhotosBaseManager *srch_mtch_mngr;
PhotosBaseManager *srch_typ_mngr;
PhotosSearchController *srch_cntrlr;
};
@@ -121,7 +124,7 @@ photos_overview_searchbar_hide (PhotosSearchbar *searchbar)
g_simple_action_set_enabled (G_SIMPLE_ACTION (priv->select_all), TRUE);
photos_base_manager_set_active_object_by_id (priv->srch_typ_mngr, "all");
- /* TODO: match manager */
+ photos_base_manager_set_active_object_by_id (priv->srch_mtch_mngr, "all");
photos_base_manager_set_active_object_by_id (priv->src_mngr, "all");
PHOTOS_SEARCHBAR_CLASS (photos_overview_searchbar_parent_class)->hide (searchbar);
@@ -136,6 +139,14 @@ photos_overview_searchbar_item_activated (PhotosOverviewSearchbar *self)
static void
+photos_overview_searchbar_search_match_active_changed (PhotosOverviewSearchbar *self)
+{
+ PhotosOverviewSearchbarPrivate *priv = self->priv;
+ photos_overview_searchbar_active_changed (self, priv->srch_mtch_mngr, priv->srch_mtch_tag);
+}
+
+
+static void
photos_overview_searchbar_search_string_changed (PhotosOverviewSearchbar *self, const gchar *str)
{
gtk_entry_set_text (GTK_ENTRY (self->priv->search_entry), str);
@@ -175,9 +186,10 @@ photos_overview_searchbar_tag_button_clicked (PhotosOverviewSearchbar *self, GdT
PhotosOverviewSearchbarPrivate *priv = self->priv;
PhotosBaseManager *mngr = NULL;
- /* TODO: match tag */
if (tag == priv->src_tag)
mngr = priv->src_mngr;
+ else if (tag == priv->srch_mtch_tag)
+ mngr = priv->srch_mtch_mngr;
else if (tag == priv->srch_typ_tag)
mngr = priv->srch_typ_mngr;
@@ -225,8 +237,8 @@ photos_overview_searchbar_create_search_widgets (PhotosSearchbar *searchbar)
photos_searchbar_set_search_entry (PHOTOS_SEARCHBAR (self), GTK_WIDGET (priv->search_entry));
priv->src_tag = gd_tagged_entry_tag_new (NULL);
+ priv->srch_mtch_tag = gd_tagged_entry_tag_new (NULL);
priv->srch_typ_tag = gd_tagged_entry_tag_new (NULL);
- /* TODO: match tag */
g_signal_connect_object (priv->srch_cntrlr,
"search-string-changed",
@@ -293,6 +305,7 @@ photos_overview_searchbar_constructed (GObject *object)
photos_overview_searchbar_source_active_changed (self);
photos_overview_searchbar_search_type_active_changed (self);
+ photos_overview_searchbar_search_match_active_changed (self);
}
@@ -304,6 +317,7 @@ photos_overview_searchbar_dispose (GObject *object)
g_clear_object (&priv->col_mngr);
g_clear_object (&priv->src_mngr);
+ g_clear_object (&priv->srch_mtch_mngr);
g_clear_object (&priv->srch_typ_mngr);
g_clear_object (&priv->srch_cntrlr);
@@ -349,6 +363,13 @@ photos_overview_searchbar_init (PhotosOverviewSearchbar *self)
self,
G_CONNECT_SWAPPED);
+ priv->srch_mtch_mngr = photos_search_match_manager_dup_singleton ();
+ g_signal_connect_object (priv->srch_mtch_mngr,
+ "active-changed",
+ G_CALLBACK (photos_overview_searchbar_search_match_active_changed),
+ self,
+ G_CONNECT_SWAPPED);
+
priv->srch_typ_mngr = photos_search_type_manager_dup_singleton ();
g_signal_connect_object (priv->srch_typ_mngr,
"active-changed",
@@ -356,8 +377,6 @@ photos_overview_searchbar_init (PhotosOverviewSearchbar *self)
self,
G_CONNECT_SWAPPED);
- /* TODO: SearchMatchManager */
-
priv->col_mngr = photos_collection_manager_dup_singleton ();
g_signal_connect_object (priv->col_mngr,
"active-changed",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]