diff options
Diffstat (limited to 'plugins/default-source')
-rw-r--r-- | plugins/default-source/default-source.c | 41 | ||||
-rw-r--r-- | plugins/default-source/org-gnome-default-source.eplug.xml | 4 |
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> |