aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-10-15 22:51:19 +0800
committerMilan Crha <mcrha@redhat.com>2009-10-15 22:51:19 +0800
commit2d089faf78be7db81c7e02273d827a50455086fe (patch)
tree9865a92e87297bd2b1b81f90183fd71564d2174f /plugins
parentc27b8cbd6313db5c8ad56f199b46d31987064693 (diff)
downloadgsoc2013-evolution-2d089faf78be7db81c7e02273d827a50455086fe.tar
gsoc2013-evolution-2d089faf78be7db81c7e02273d827a50455086fe.tar.gz
gsoc2013-evolution-2d089faf78be7db81c7e02273d827a50455086fe.tar.bz2
gsoc2013-evolution-2d089faf78be7db81c7e02273d827a50455086fe.tar.lz
gsoc2013-evolution-2d089faf78be7db81c7e02273d827a50455086fe.tar.xz
gsoc2013-evolution-2d089faf78be7db81c7e02273d827a50455086fe.tar.zst
gsoc2013-evolution-2d089faf78be7db81c7e02273d827a50455086fe.zip
Bug #373297 - Option for autocomplete in address book preferences
Diffstat (limited to 'plugins')
-rw-r--r--plugins/default-source/default-source.c41
-rw-r--r--plugins/default-source/org-gnome-default-source.eplug.xml4
2 files changed, 43 insertions, 2 deletions
diff --git a/plugins/default-source/default-source.c b/plugins/default-source/default-source.c
index 198d2f2671..1d8a7e0299 100644
--- a/plugins/default-source/default-source.c
+++ b/plugins/default-source/default-source.c
@@ -30,9 +30,13 @@
#include <libedataserver/e-source.h>
#include <glib/gi18n.h>
#include <string.h>
-GtkWidget* org_gnome_default_book (EPlugin *epl, EConfigHookItemFactoryData *data);
+
+GtkWidget *org_gnome_default_book (EPlugin *epl, EConfigHookItemFactoryData *data);
+GtkWidget *org_gnome_autocomplete_book (EPlugin *epl, EConfigHookItemFactoryData *data);
+
void commit_default_calendar (EPlugin *epl, EConfigTarget *target);
void commit_default_book (EPlugin *epl, EConfigTarget *target);
+
void
commit_default_calendar (EPlugin *epl, EConfigTarget *target)
{
@@ -59,7 +63,7 @@ commit_default_book (EPlugin *epl, EConfigTarget *target)
}
static void
-default_source_changed (GtkWidget *check_box, ESource *source)
+default_source_changed (GtkWidget *check_box, ESource *source)
{
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_box)))
@@ -68,6 +72,16 @@ default_source_changed (GtkWidget *check_box, ESource *source)
e_source_set_property (source, "default", NULL);
}
+static void
+autocomplete_book_changed (GtkWidget *check_box, ESource *source)
+{
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_box)))
+ e_source_set_property (source, "completion", "true");
+ else
+ e_source_set_property (source, "completion", NULL);
+}
+
GtkWidget *
org_gnome_default_book (EPlugin *epl, EConfigHookItemFactoryData *data)
{
@@ -92,6 +106,29 @@ org_gnome_default_book (EPlugin *epl, EConfigHookItemFactoryData *data)
return widget;
}
+GtkWidget *
+org_gnome_autocomplete_book (EPlugin *epl, EConfigHookItemFactoryData *data)
+{
+ GtkWidget *widget;
+ ESource *source;
+ EABConfigTargetSource *book_target;
+
+ if (data->old)
+ return data->old;
+
+ widget = gtk_check_button_new_with_mnemonic (_("A_utocomplete with this address book"));
+ book_target = (EABConfigTargetSource *) data->target;
+ source = book_target->source;
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), e_source_get_property (source, "completion") && g_str_equal (e_source_get_property (source, "completion"), "true"));
+ gtk_container_add (GTK_CONTAINER (data->parent), widget);
+
+ g_signal_connect (GTK_TOGGLE_BUTTON (widget), "toggled", G_CALLBACK (autocomplete_book_changed), source);
+ gtk_widget_show (widget);
+
+ return widget;
+}
+
static const gchar *
get_calendar_option_caption (ECalSourceType source_type)
{
diff --git a/plugins/default-source/org-gnome-default-source.eplug.xml b/plugins/default-source/org-gnome-default-source.eplug.xml
index 25bf09dbea..c5e29bcef9 100644
--- a/plugins/default-source/org-gnome-default-source.eplug.xml
+++ b/plugins/default-source/org-gnome-default-source.eplug.xml
@@ -29,6 +29,10 @@
type="item"
path="00.general/10.display/30.default"
factory="org_gnome_default_book"/>
+ <item
+ type="item"
+ path="00.general/10.display/31.default"
+ factory="org_gnome_autocomplete_book"/>
</group>
</hook>