diff options
author | Milan Crha <mcrha@redhat.com> | 2011-08-09 23:18:42 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-09-14 20:08:46 +0800 |
commit | 77d14c71c1c4acd82287be23d49e894044af74b5 (patch) | |
tree | f75ca2908f08b501413cdc6f9ed03a3d8e00a1c4 /modules | |
parent | 51ef38a2cc59e8cdff400780818abac87313e477 (diff) | |
download | gsoc2013-evolution-77d14c71c1c4acd82287be23d49e894044af74b5.tar gsoc2013-evolution-77d14c71c1c4acd82287be23d49e894044af74b5.tar.gz gsoc2013-evolution-77d14c71c1c4acd82287be23d49e894044af74b5.tar.bz2 gsoc2013-evolution-77d14c71c1c4acd82287be23d49e894044af74b5.tar.lz gsoc2013-evolution-77d14c71c1c4acd82287be23d49e894044af74b5.tar.xz gsoc2013-evolution-77d14c71c1c4acd82287be23d49e894044af74b5.tar.zst gsoc2013-evolution-77d14c71c1c4acd82287be23d49e894044af74b5.zip |
Bug #655492 - Move 'Automatic contacts' tab to 'Contacts' part
Diffstat (limited to 'modules')
-rw-r--r-- | modules/addressbook/autocompletion-config.c | 89 | ||||
-rw-r--r-- | modules/addressbook/e-book-config-hook.c | 1 |
2 files changed, 86 insertions, 4 deletions
diff --git a/modules/addressbook/autocompletion-config.c b/modules/addressbook/autocompletion-config.c index d445063bac..c78b958022 100644 --- a/modules/addressbook/autocompletion-config.c +++ b/modules/addressbook/autocompletion-config.c @@ -34,7 +34,9 @@ #include <libedataserverui/e-source-selector.h> #include <libedataserverui/e-name-selector-entry.h> +#include "e-util/e-config.h" #include "e-util/e-datetime-format.h" +#include "addressbook/gui/widgets/eab-config.h" static void source_selection_changed_cb (ESourceSelector *source_selector) @@ -131,8 +133,20 @@ add_section (GtkWidget *container, return widget; } -GtkWidget * -autocompletion_config_new (EPreferencesWindow *window) +static GtkWidget * +acc_get_toplevel_notebook (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gint position, gpointer data) +{ + if (old) + return old; + + old = gtk_notebook_new (); + gtk_widget_show (old); + + return old; +} + +static GtkWidget * +acc_get_general_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gint position, gpointer data) { EShellSettings *shell_settings; ESourceList *source_list; @@ -143,7 +157,12 @@ autocompletion_config_new (EPreferencesWindow *window) GtkWidget *vbox; EShell *shell; - shell = e_preferences_window_get_shell (window); + if (old) + return old; + + g_return_val_if_fail (GTK_IS_NOTEBOOK (parent), NULL); + + shell = data; g_return_val_if_fail (E_IS_SHELL (shell), NULL); @@ -152,7 +171,7 @@ autocompletion_config_new (EPreferencesWindow *window) source_list = e_source_list_new_for_gconf_default ( "/apps/evolution/addressbook/sources"); - vbox = gtk_vbox_new (FALSE, 12); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); gtk_widget_show (vbox); @@ -194,6 +213,68 @@ autocompletion_config_new (EPreferencesWindow *window) gtk_widget_show (source_selector); gtk_box_pack_start (GTK_BOX (itembox), scrolled_window, TRUE, TRUE, 0); + gtk_widget_show_all (vbox); + + gtk_notebook_append_page (GTK_NOTEBOOK (parent), vbox, gtk_label_new (_("General"))); + + return vbox; +} + +/* plugin meta-data */ +static EConfigItem acc_items[] = { + { E_CONFIG_BOOK, (gchar *) "", (gchar *) "acc_toplevel_notebook", acc_get_toplevel_notebook }, + { E_CONFIG_PAGE, (gchar *) "00.general", (gchar *) "acc_general", acc_get_general_page } +}; + +static void +acc_free (EConfig *ec, GSList *items, gpointer data) +{ + g_slist_free (items); +} + +GtkWidget * +autocompletion_config_new (EPreferencesWindow *window) +{ + GtkWidget *toplevel; + GtkWidget *vbox; + GSList *l; + gint ii; + EShell *shell; + EABConfig *eab; + EABConfigTargetPrefs *target; + GConfClient *gconf; + + shell = e_preferences_window_get_shell (window); + + g_return_val_if_fail (E_IS_SHELL (shell), NULL); + + 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. + */ + eab = eab_config_new (E_CONFIG_BOOK, "org.gnome.evolution.addressbook.prefs"); + + l = NULL; + for (ii = 0; ii < G_N_ELEMENTS (acc_items); ii++) + l = g_slist_prepend (l, &acc_items[ii]); + e_config_add_items ((EConfig *) eab, l, NULL, NULL, acc_free, shell); + + gconf = gconf_client_get_default (); + + target = eab_config_target_new_prefs (eab, gconf); + e_config_set_target ((EConfig *) eab, (EConfigTarget *) target); + toplevel = e_config_create_widget ((EConfig *) eab); + gtk_box_pack_start (GTK_BOX (vbox), toplevel, TRUE, TRUE, 0); + + g_object_unref (gconf); return vbox; } diff --git a/modules/addressbook/e-book-config-hook.c b/modules/addressbook/e-book-config-hook.c index 1ea83c920f..dd4b38b5e5 100644 --- a/modules/addressbook/e-book-config-hook.c +++ b/modules/addressbook/e-book-config-hook.c @@ -34,6 +34,7 @@ static const EConfigHookTargetMask no_masks[] = { static const EConfigHookTargetMap targets[] = { { "source", EAB_CONFIG_TARGET_SOURCE, no_masks }, + { "prefs", EAB_CONFIG_TARGET_PREFS, no_masks }, { NULL } }; |