aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/widgets
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-12-11 04:12:48 +0800
committerMilan Crha <mcrha@redhat.com>2009-12-11 04:12:48 +0800
commit223c2f4a75c5423db244430ca3630717e2735a52 (patch)
tree962dc68f7636586f2224f131a7ecd306d53b7589 /addressbook/gui/widgets
parent4a9bf4dffd98346f9eee848708df573df56ed1d6 (diff)
downloadgsoc2013-evolution-223c2f4a75c5423db244430ca3630717e2735a52.tar.gz
gsoc2013-evolution-223c2f4a75c5423db244430ca3630717e2735a52.tar.zst
gsoc2013-evolution-223c2f4a75c5423db244430ca3630717e2735a52.zip
Bug #602998 - Contacts searches are supposed to be per address book
Diffstat (limited to 'addressbook/gui/widgets')
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c61
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.h13
2 files changed, 74 insertions, 0 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index afa8bc0c1e..a48ea8c351 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -84,6 +84,12 @@ struct _EAddressbookViewPrivate {
GObject *object;
GalViewInstance *view_instance;
+
+ /* stored search setup for this view */
+ gint filter_id;
+ gchar *search_text;
+ gint search_id;
+ EFilterRule *advanced_search;
};
enum {
@@ -492,6 +498,19 @@ addressbook_view_dispose (GObject *object)
priv->view_instance = NULL;
}
+ priv->filter_id = 0;
+ priv->search_id = 0;
+
+ if (priv->search_text) {
+ g_free (priv->search_text);
+ priv->search_text = NULL;
+ }
+
+ if (priv->advanced_search) {
+ g_object_unref (priv->advanced_search);
+ priv->advanced_search = NULL;
+ }
+
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -1344,3 +1363,45 @@ e_addressbook_view_move_to_folder (EAddressbookView *view, gboolean all)
{
view_transfer_contacts (view, TRUE, all);
}
+
+void
+e_addressbook_view_set_search (EAddressbookView *view, gint filter_id, gint search_id, const gchar *search_text, EFilterRule *advanced_search)
+{
+ EAddressbookViewPrivate *priv;
+
+ g_return_if_fail (view != NULL);
+ g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
+
+ priv = view->priv;
+
+ if (priv->search_text)
+ g_free (priv->search_text);
+ if (priv->advanced_search)
+ g_object_unref (priv->advanced_search);
+
+ priv->filter_id = filter_id;
+ priv->search_id = search_id;
+ priv->search_text = g_strdup (search_text);
+ priv->advanced_search = advanced_search ? e_filter_rule_clone (advanced_search) : NULL;
+}
+
+/* free returned values for search_text and advanced_search, if not NULL, as these are new copies */
+void
+e_addressbook_view_get_search (EAddressbookView *view, gint *filter_id, gint *search_id, gchar **search_text, EFilterRule **advanced_search)
+{
+ EAddressbookViewPrivate *priv;
+
+ g_return_if_fail (view != NULL);
+ g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
+ g_return_if_fail (filter_id != NULL);
+ g_return_if_fail (search_id != NULL);
+ g_return_if_fail (search_text != NULL);
+ g_return_if_fail (advanced_search != NULL);
+
+ priv = view->priv;
+
+ *filter_id = priv->filter_id;
+ *search_id = priv->search_id;
+ *search_text = g_strdup (priv->search_text);
+ *advanced_search = priv->advanced_search ? e_filter_rule_clone (priv->advanced_search) : NULL;
+}
diff --git a/addressbook/gui/widgets/e-addressbook-view.h b/addressbook/gui/widgets/e-addressbook-view.h
index 6abab6bf7a..319d060b89 100644
--- a/addressbook/gui/widgets/e-addressbook-view.h
+++ b/addressbook/gui/widgets/e-addressbook-view.h
@@ -29,6 +29,7 @@
#include <menus/gal-view-instance.h>
#include <misc/e-selection-model.h>
#include <shell/e-shell-view.h>
+#include <filter/e-filter-rule.h>
#include "e-addressbook-model.h"
#include "eab-contact-display.h"
@@ -117,6 +118,18 @@ void e_addressbook_view_move_to_folder
gboolean e_addressbook_view_can_create (EAddressbookView *view);
+void e_addressbook_view_set_search (EAddressbookView *view,
+ gint filter_id,
+ gint search_id,
+ const gchar *search_text,
+ EFilterRule *advanced_search);
+
+void e_addressbook_view_get_search (EAddressbookView *view,
+ gint *filter_id,
+ gint *search_id,
+ gchar **search_text,
+ EFilterRule **advanced_search);
+
G_END_DECLS
#endif /* E_ADDRESSBOOK_VIEW_H */