aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/select-names/e-select-names-bonobo.c68
-rw-r--r--addressbook/gui/component/select-names/e-select-names-completion.c38
-rw-r--r--addressbook/gui/component/select-names/e-select-names-completion.h3
-rw-r--r--addressbook/gui/component/select-names/e-select-names-manager.c2
4 files changed, 90 insertions, 21 deletions
diff --git a/addressbook/gui/component/select-names/e-select-names-bonobo.c b/addressbook/gui/component/select-names/e-select-names-bonobo.c
index 428826f7fe..d2e4ab5b00 100644
--- a/addressbook/gui/component/select-names/e-select-names-bonobo.c
+++ b/addressbook/gui/component/select-names/e-select-names-bonobo.c
@@ -37,9 +37,9 @@
#include "Evolution-Addressbook-SelectNames.h"
#include "e-select-names-manager.h"
-
#include "e-select-names-model.h"
#include "e-select-names-text-model.h"
+#include "e-select-names-completion.h"
@@ -53,6 +53,8 @@ struct _ESelectNamesBonoboPrivate {
enum _EntryPropertyID {
ENTRY_PROPERTY_ID_TEXT,
+ ENTRY_PROPERTY_ID_DESTINATIONS,
+ ENTRY_PROPERTY_ID_ALLOW_CONTACT_LISTS,
ENTRY_PROPERTY_ID_ENTRY_CHANGED
};
typedef enum _EntryPropertyID EntryPropertyID;
@@ -74,21 +76,36 @@ entry_get_property_fn (BonoboPropertyBag *bag,
switch (arg_id) {
case ENTRY_PROPERTY_ID_TEXT:
+ BONOBO_ARG_SET_STRING (arg, e_entry_get_text (E_ENTRY (w)));
+ break;
+
+ case ENTRY_PROPERTY_ID_DESTINATIONS:
{
- ESelectNamesTextModel *text_model;
ESelectNamesModel *model;
+ model = E_SELECT_NAMES_MODEL (gtk_object_get_data (GTK_OBJECT (w), "select_names_model"));
+ g_assert (model != NULL);
- gtk_object_get(GTK_OBJECT(w),
- "model", &text_model,
- NULL);
- gtk_object_get(GTK_OBJECT(text_model),
- "source", &model,
- NULL);
text = e_select_names_model_export_destinationv (model);
BONOBO_ARG_SET_STRING (arg, text);
g_free (text);
}
break;
+
+ case ENTRY_PROPERTY_ID_ALLOW_CONTACT_LISTS:
+ {
+ ESelectNamesCompletion *comp;
+ comp = E_SELECT_NAMES_COMPLETION (gtk_object_get_data (GTK_OBJECT (w), "completion_handler"));
+ g_assert (comp != NULL);
+
+ BONOBO_ARG_SET_BOOLEAN (arg, e_select_names_completion_get_match_contact_lists (comp));
+ break;
+ }
+
+ case ENTRY_PROPERTY_ID_ENTRY_CHANGED:
+ /* This is a read-only property. */
+ g_assert_not_reached ();
+ break;
+
default:
break;
}
@@ -101,19 +118,40 @@ entry_set_property_fn (BonoboPropertyBag *bag,
CORBA_Environment *ev,
gpointer user_data)
{
- GtkWidget *widget;
+ GtkWidget *w;
- widget = GTK_WIDGET (user_data);
+ w = GTK_WIDGET (user_data);
switch (arg_id) {
case ENTRY_PROPERTY_ID_TEXT:
- e_entry_set_text (E_ENTRY (widget), BONOBO_ARG_GET_STRING (arg));
+ e_entry_set_text (E_ENTRY (w), BONOBO_ARG_GET_STRING (arg));
break;
+ case ENTRY_PROPERTY_ID_DESTINATIONS:
+ {
+ ESelectNamesModel *model;
+ model = E_SELECT_NAMES_MODEL (gtk_object_get_data (GTK_OBJECT (w), "select_names_model"));
+ g_assert (model != NULL);
+
+ e_select_names_model_import_destinationv (model, BONOBO_ARG_GET_STRING (arg));
+ break;
+ }
+
+ case ENTRY_PROPERTY_ID_ALLOW_CONTACT_LISTS:
+ {
+ ESelectNamesCompletion *comp;
+ comp = E_SELECT_NAMES_COMPLETION (gtk_object_get_data (GTK_OBJECT (w), "completion_handler"));
+ g_assert (comp != NULL);
+
+ e_select_names_completion_set_match_contact_lists (comp, BONOBO_ARG_GET_BOOLEAN (arg));
+ break;
+ }
+
case ENTRY_PROPERTY_ID_ENTRY_CHANGED:
- gtk_object_set_data (GTK_OBJECT (widget), "entry_property_id_changed", GUINT_TO_POINTER (1));
+ gtk_object_set_data (GTK_OBJECT (w), "entry_property_id_changed", GUINT_TO_POINTER (1));
break;
+
default:
break;
}
@@ -224,6 +262,12 @@ impl_SelectNames_get_entry_for_section (PortableServer_Servant servant,
bonobo_property_bag_add (property_bag, "text", ENTRY_PROPERTY_ID_TEXT,
BONOBO_ARG_STRING, NULL, NULL,
BONOBO_PROPERTY_READABLE | BONOBO_PROPERTY_WRITEABLE);
+ bonobo_property_bag_add (property_bag, "destinations", ENTRY_PROPERTY_ID_DESTINATIONS,
+ BONOBO_ARG_STRING, NULL, NULL,
+ BONOBO_PROPERTY_READABLE | BONOBO_PROPERTY_WRITEABLE);
+ bonobo_property_bag_add (property_bag, "allow_contact_lists", ENTRY_PROPERTY_ID_ALLOW_CONTACT_LISTS,
+ BONOBO_ARG_BOOLEAN, NULL, NULL,
+ BONOBO_PROPERTY_READABLE | BONOBO_PROPERTY_WRITEABLE);
bonobo_property_bag_add (property_bag, "entry_changed", ENTRY_PROPERTY_ID_ENTRY_CHANGED,
BONOBO_ARG_BOOLEAN, NULL, NULL,
BONOBO_PROPERTY_WRITEABLE);
diff --git a/addressbook/gui/component/select-names/e-select-names-completion.c b/addressbook/gui/component/select-names/e-select-names-completion.c
index 2590a8515b..e75f964b4c 100644
--- a/addressbook/gui/component/select-names/e-select-names-completion.c
+++ b/addressbook/gui/component/select-names/e-select-names-completion.c
@@ -62,6 +62,7 @@ struct _ESelectNamesCompletionPrivate {
gchar *cached_query_text;
GList *cached_cards;
+ gboolean match_contact_lists;
gboolean primary_only;
};
@@ -543,16 +544,20 @@ book_query_process_card_list (ESelectNamesCompletion *comp, const GList *cards)
if (e_card_evolution_list (card)) {
- EDestination *dest = e_destination_new ();
- ECompletionMatch *match;
- e_destination_set_card (dest, card, 0);
- match = book_query_score (comp, dest);
- if (match && match->score > 0) {
- e_completion_found_match (E_COMPLETION (comp), match);
- } else {
- e_completion_match_unref (match);
+ if (comp->priv->match_contact_lists) {
+
+ EDestination *dest = e_destination_new ();
+ ECompletionMatch *match;
+ e_destination_set_card (dest, card, 0);
+ match = book_query_score (comp, dest);
+ if (match && match->score > 0) {
+ e_completion_found_match (E_COMPLETION (comp), match);
+ } else {
+ e_completion_match_unref (match);
+ }
+ gtk_object_unref (GTK_OBJECT (dest));
+
}
- gtk_object_unref (GTK_OBJECT (dest));
} else if (card->email) {
gint i;
@@ -715,6 +720,7 @@ static void
e_select_names_completion_init (ESelectNamesCompletion *comp)
{
comp->priv = g_new0 (struct _ESelectNamesCompletionPrivate, 1);
+ comp->priv->match_contact_lists = TRUE;
}
static void
@@ -1154,3 +1160,17 @@ e_select_names_completion_new (EBook *book, ESelectNamesModel *model)
return E_COMPLETION (comp);
}
+gboolean
+e_select_names_completion_get_match_contact_lists (ESelectNamesCompletion *comp)
+{
+ g_return_val_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp), FALSE);
+ return comp->priv->match_contact_lists;
+}
+
+
+void
+e_select_names_completion_set_match_contact_lists (ESelectNamesCompletion *comp, gboolean x)
+{
+ g_return_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp));
+ comp->priv->match_contact_lists = x;
+}
diff --git a/addressbook/gui/component/select-names/e-select-names-completion.h b/addressbook/gui/component/select-names/e-select-names-completion.h
index 1f3de5ea3d..cfa496ca69 100644
--- a/addressbook/gui/component/select-names/e-select-names-completion.h
+++ b/addressbook/gui/component/select-names/e-select-names-completion.h
@@ -59,6 +59,9 @@ GtkType e_select_names_completion_get_type (void);
ECompletion *e_select_names_completion_new (EBook *, ESelectNamesModel *);
+gboolean e_select_names_completion_get_match_contact_lists (ESelectNamesCompletion *);
+void e_select_names_completion_set_match_contact_lists (ESelectNamesCompletion *, gboolean);
+
END_GNOME_DECLS
#endif /* E_SELECT_NAMES_COMPLETION_H */
diff --git a/addressbook/gui/component/select-names/e-select-names-manager.c b/addressbook/gui/component/select-names/e-select-names-manager.c
index b255942d08..4481438327 100644
--- a/addressbook/gui/component/select-names/e-select-names-manager.c
+++ b/addressbook/gui/component/select-names/e-select-names-manager.c
@@ -400,6 +400,8 @@ e_select_names_manager_create_entry (ESelectNamesManager *manager, const char *i
comp = e_select_names_completion_new (NULL, section->model); /* NULL == use local addressbook */
e_entry_enable_completion_full (eentry, comp, 50, completion_handler);
+ gtk_object_set_data (GTK_OBJECT (eentry), "completion_handler", comp);
+
gtk_object_set(GTK_OBJECT(eentry),
"model", model,
"editable", TRUE,