From 311c8dd1226555f81c2eaca738969f5d9e123d1f Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 12 Aug 2009 22:27:13 -0400 Subject: Add new preferences missed during the 2.27.90 merge. --- modules/addressbook/Makefile.am | 2 + modules/addressbook/autocompletion-config.c | 71 +++++++++++++++++++++++++++-- modules/addressbook/e-book-shell-backend.c | 4 ++ modules/addressbook/e-book-shell-settings.c | 34 ++++++++++++++ modules/addressbook/e-book-shell-settings.h | 33 ++++++++++++++ 5 files changed, 140 insertions(+), 4 deletions(-) create mode 100644 modules/addressbook/e-book-shell-settings.c create mode 100644 modules/addressbook/e-book-shell-settings.h (limited to 'modules/addressbook') diff --git a/modules/addressbook/Makefile.am b/modules/addressbook/Makefile.am index d7cd8c7c4e..5ba744dee6 100644 --- a/modules/addressbook/Makefile.am +++ b/modules/addressbook/Makefile.am @@ -40,6 +40,8 @@ libevolution_module_addressbook_la_SOURCES = \ e-book-shell-content.h \ e-book-shell-migrate.c \ e-book-shell-migrate.h \ + e-book-shell-settings.c \ + e-book-shell-settings.h \ e-book-shell-sidebar.c \ e-book-shell-sidebar.h \ e-book-shell-view.c \ diff --git a/modules/addressbook/autocompletion-config.c b/modules/addressbook/autocompletion-config.c index 1ce9e707fa..68e276d1c7 100644 --- a/modules/addressbook/autocompletion-config.c +++ b/modules/addressbook/autocompletion-config.c @@ -92,22 +92,83 @@ initialize_selection (ESourceSelector *source_selector) } } +static GtkWidget * +add_section (GtkWidget *container, + const gchar *caption, + gboolean expand) +{ + GtkWidget *widget; + gchar *markup; + + widget = gtk_vbox_new (FALSE, 6); + gtk_box_pack_start (GTK_BOX (container), widget, expand, expand, 0); + gtk_widget_show (widget); + + container = widget; + + markup = g_markup_printf_escaped ("%s", caption); + widget = gtk_label_new (markup); + gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); + gtk_label_set_use_markup (GTK_LABEL (widget), TRUE); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + g_free (markup); + + widget = gtk_alignment_new (0.0, 0.0, 1.0, 1.0); + gtk_alignment_set_padding (GTK_ALIGNMENT (widget), 0, 0, 12, 0); + gtk_box_pack_start (GTK_BOX (container), widget, expand, expand, 0); + gtk_widget_show (widget); + + container = widget; + + widget = gtk_vbox_new (FALSE, 6); + gtk_container_add (GTK_CONTAINER (container), widget); + gtk_widget_show (widget); + + return widget; +} + void autocompletion_config_init (EShell *shell) { + EShellSettings *shell_settings; ESourceList *source_list; GtkWidget *scrolled_window; GtkWidget *source_selector; GtkWidget *preferences_window; + GtkWidget *itembox; + GtkWidget *widget; + GtkWidget *vbox; g_return_if_fail (E_IS_SHELL (shell)); + shell_settings = e_shell_get_shell_settings (shell); + source_list = e_source_list_new_for_gconf_default ( "/apps/evolution/addressbook/sources"); - /* XXX should we watch for the source list to change and - update it in the control? what about our local changes? */ - /* g_signal_connect (ac->source_list, "changed", G_CALLBACK (source_list_changed), ac); */ + vbox = gtk_vbox_new (FALSE, 12); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); + gtk_widget_show (vbox); + + itembox = add_section (vbox, _("Date/Time Format"), FALSE); + + widget = gtk_table_new (1, 3, FALSE); + gtk_box_pack_start (GTK_BOX (itembox), widget, TRUE, TRUE, 0); + e_datetime_format_add_setup_widget ( + widget, 0, "addressbook", "table", + DTFormatKindDateTime, _("Table column:")); + gtk_widget_show (widget); + + itembox = add_section (vbox, _("Autocompletion"), TRUE); + + widget = gtk_check_button_new_with_mnemonic ( + _("Always _show address of the autocompleted contact")); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "book-completion-show-address", + G_OBJECT (widget), "active"); + gtk_box_pack_start (GTK_BOX (itembox), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy ( @@ -124,6 +185,8 @@ autocompletion_config_init (EShell *shell) gtk_container_add (GTK_CONTAINER (scrolled_window), source_selector); gtk_widget_show (source_selector); + gtk_box_pack_start (GTK_BOX (itembox), scrolled_window, TRUE, TRUE, 0); + initialize_selection (E_SOURCE_SELECTOR (source_selector)); preferences_window = e_shell_get_preferences_window (shell); @@ -133,6 +196,6 @@ autocompletion_config_init (EShell *shell) "contacts", "preferences-autocompletion", _("Contacts"), - scrolled_window, + vbox, 200); } diff --git a/modules/addressbook/e-book-shell-backend.c b/modules/addressbook/e-book-shell-backend.c index 9fe000aea8..87ac638822 100644 --- a/modules/addressbook/e-book-shell-backend.c +++ b/modules/addressbook/e-book-shell-backend.c @@ -44,6 +44,7 @@ #include "autocompletion-config.h" #include "e-book-shell-migrate.h" +#include "e-book-shell-settings.h" #include "e-book-shell-view.h" #ifdef ENABLE_SMIME @@ -509,6 +510,9 @@ book_shell_backend_constructed (GObject *object) G_CALLBACK (book_shell_backend_window_created_cb), shell_backend); + /* Initialize settings before initializing preferences, + * since the preferences bind to the shell settings. */ + e_book_shell_backend_init_settings (shell); autocompletion_config_init (shell); } diff --git a/modules/addressbook/e-book-shell-settings.c b/modules/addressbook/e-book-shell-settings.c new file mode 100644 index 0000000000..7a9544d721 --- /dev/null +++ b/modules/addressbook/e-book-shell-settings.c @@ -0,0 +1,34 @@ +/* + * e-book-shell-settings.c + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#include "e-book-shell-settings.h" + +void +e_book_shell_backend_init_settings (EShell *shell) +{ + EShellSettings *shell_settings; + + shell_settings = e_shell_get_shell_settings (shell); + + e_shell_settings_install_property_for_key ( + "book-completion-show-address", + "/apps/evolution/addressbook/completion/show_address"); +} diff --git a/modules/addressbook/e-book-shell-settings.h b/modules/addressbook/e-book-shell-settings.h new file mode 100644 index 0000000000..9e05de41df --- /dev/null +++ b/modules/addressbook/e-book-shell-settings.h @@ -0,0 +1,33 @@ +/* + * e-book-shell-settings.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef E_BOOK_SHELL_SETTINGS_H +#define E_BOOK_SHELL_SETTINGS_H + +#include + +G_BEGIN_DECLS + +void e_book_shell_backend_init_settings (EShell *shell); + +G_END_DECLS + +#endif /* E_CAL_SHELL_SETTINGS_H */ -- cgit