aboutsummaryrefslogtreecommitdiffstats
path: root/modules/addressbook
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-04-14 00:36:59 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-04-14 01:00:19 +0800
commit94503dd5eef40cafebc818f14a64b7519f051175 (patch)
tree188f3cbfdcd4ecdd7b44cc28bac804228858f408 /modules/addressbook
parent1982fafe9c416fc03ad29420fe920c6e961198ba (diff)
downloadgsoc2013-evolution-94503dd5eef40cafebc818f14a64b7519f051175.tar
gsoc2013-evolution-94503dd5eef40cafebc818f14a64b7519f051175.tar.gz
gsoc2013-evolution-94503dd5eef40cafebc818f14a64b7519f051175.tar.bz2
gsoc2013-evolution-94503dd5eef40cafebc818f14a64b7519f051175.tar.lz
gsoc2013-evolution-94503dd5eef40cafebc818f14a64b7519f051175.tar.xz
gsoc2013-evolution-94503dd5eef40cafebc818f14a64b7519f051175.tar.zst
gsoc2013-evolution-94503dd5eef40cafebc818f14a64b7519f051175.zip
Restore "Automatic Contacts" plugin preferences page.
This accidentally got dropped during the "account-mgmt" project. As much as I loathe EConfig, the "Automatic Contacts" plugin is useless without its Preferences page in the Contacts section. (cherry picked from commit 2abf047ec84e4d3ce31a4da86dceca3b0c9aaea1) Conflicts: modules/addressbook/autocompletion-config.c
Diffstat (limited to 'modules/addressbook')
-rw-r--r--modules/addressbook/autocompletion-config.c122
1 files changed, 106 insertions, 16 deletions
diff --git a/modules/addressbook/autocompletion-config.c b/modules/addressbook/autocompletion-config.c
index 49aca305df..bad6040c09 100644
--- a/modules/addressbook/autocompletion-config.c
+++ b/modules/addressbook/autocompletion-config.c
@@ -26,6 +26,8 @@
#include <glib/gi18n.h>
+#include "addressbook/gui/widgets/eab-config.h"
+
static GtkWidget *
add_section (GtkWidget *container,
const gchar *caption,
@@ -62,10 +64,34 @@ add_section (GtkWidget *container,
return widget;
}
-GtkWidget *
-autocompletion_config_new (EPreferencesWindow *window)
+static GtkWidget *
+get_main_notebook (EConfig *config,
+ EConfigItem *item,
+ GtkWidget *parent,
+ GtkWidget *old,
+ gint position,
+ gpointer user_data)
+{
+ GtkWidget *notebook;
+
+ if (old != NULL)
+ return old;
+
+ notebook = gtk_notebook_new ();
+ gtk_widget_show (notebook);
+
+ return notebook;
+}
+
+static GtkWidget *
+get_general_page (EConfig *config,
+ EConfigItem *item,
+ GtkWidget *parent,
+ GtkWidget *old,
+ gint position,
+ gpointer user_data)
{
- EShellSettings *shell_settings;
+ GSettings *settings;
ESourceRegistry *registry;
GtkWidget *container;
GtkWidget *itembox;
@@ -73,20 +99,25 @@ autocompletion_config_new (EPreferencesWindow *window)
GtkWidget *vbox;
EShell *shell;
- shell = e_preferences_window_get_shell (window);
-
- g_return_val_if_fail (E_IS_SHELL (shell), NULL);
+ if (old != NULL)
+ return old;
+ shell = E_SHELL (user_data);
registry = e_shell_get_registry (shell);
- shell_settings = e_shell_get_shell_settings (shell);
+
+ settings = g_settings_new ("org.gnome.evolution.addressbook");
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
+ gtk_notebook_append_page (
+ GTK_NOTEBOOK (parent), vbox,
+ gtk_label_new (_("General")));
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);
+ gtk_box_pack_start (GTK_BOX (itembox), widget, FALSE, FALSE, 0);
e_datetime_format_add_setup_widget (
widget, 0, "addressbook", "table",
DTFormatKindDateTime, _("_Table column:"));
@@ -96,11 +127,10 @@ autocompletion_config_new (EPreferencesWindow *window)
widget = gtk_check_button_new_with_mnemonic (
_("_Format address according to standard of its destination country"));
- g_object_bind_property (
- shell_settings, "enable-address-formatting",
+ g_settings_bind (
+ settings, "address-formatting",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
gtk_box_pack_start (GTK_BOX (itembox), widget, FALSE, FALSE, 0);
gtk_widget_show (widget);
@@ -108,11 +138,10 @@ autocompletion_config_new (EPreferencesWindow *window)
widget = gtk_check_button_new_with_mnemonic (
_("Always _show address of the autocompleted contact"));
- g_object_bind_property (
- shell_settings, "book-completion-show-address",
+ g_settings_bind (
+ settings, "completion-show-address",
widget, "active",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ G_SETTINGS_BIND_DEFAULT);
gtk_box_pack_start (GTK_BOX (itembox), widget, FALSE, FALSE, 0);
gtk_widget_show (widget);
@@ -131,5 +160,66 @@ autocompletion_config_new (EPreferencesWindow *window)
gtk_container_add (GTK_CONTAINER (container), widget);
gtk_widget_show (widget);
+ g_object_unref (settings);
+
return vbox;
}
+
+static EConfigItem config_items[] = {
+ { E_CONFIG_BOOK, (gchar *) "", (gchar *) "main-notebook", get_main_notebook },
+ { E_CONFIG_PAGE, (gchar *) "00.general", (gchar *) "general", get_general_page }
+};
+
+static void
+config_items_free (EConfig *config,
+ GSList *items,
+ gpointer user_data)
+{
+ g_slist_free (items);
+}
+
+GtkWidget *
+autocompletion_config_new (EPreferencesWindow *window)
+{
+ EShell *shell;
+ EABConfig *config;
+ EABConfigTargetPrefs *target;
+ GSettings *settings;
+ GtkWidget *vbox;
+ GtkWidget *widget;
+ GSList *items = NULL;
+ gint ii;
+
+ shell = e_preferences_window_get_shell (window);
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 0);
+ gtk_widget_show (vbox);
+
+ /** @HookPoint-EABConfig: Contacts Preferences Page
+ * @Id: org.gnome.evolution.addressbook.prefs
+ * @Type: E_CONFIG_BOOK
+ * @Class: org.gnome.evolution.addressbook.config:1.0
+ * @Target: EABConfigTargetPrefs
+ *
+ * The main contacts preferences page.
+ */
+ config = eab_config_new ("org.gnome.evolution.addressbook.prefs");
+
+ for (ii = 0; ii < G_N_ELEMENTS (config_items); ii++)
+ items = g_slist_prepend (items, &config_items[ii]);
+ e_config_add_items (
+ E_CONFIG (config), items, config_items_free, shell);
+
+ settings = g_settings_new ("org.gnome.evolution.addressbook");
+
+ target = eab_config_target_new_prefs (config, settings);
+ e_config_set_target (E_CONFIG (config), (EConfigTarget *) target);
+ widget = e_config_create_widget (E_CONFIG (config));
+ gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE, 0);
+
+ g_object_unref (settings);
+
+ return vbox;
+}
+