[evolution] Bug #655492 - Move 'Automatic contacts' tab to 'Contacts' part
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug #655492 - Move 'Automatic contacts' tab to 'Contacts' part
- Date: Tue, 9 Aug 2011 15:19:32 +0000 (UTC)
commit fe67798104f76f0a794093bddcaf9d165df50bf5
Author: Milan Crha <mcrha redhat com>
Date: Tue Aug 9 17:18:42 2011 +0200
Bug #655492 - Move 'Automatic contacts' tab to 'Contacts' part
addressbook/gui/widgets/eab-config.c | 24 ++++++
addressbook/gui/widgets/eab-config.h | 14 ++++-
modules/addressbook/autocompletion-config.c | 89 ++++++++++++++++++++++-
modules/addressbook/e-book-config-hook.c | 1 +
plugins/bbdb/bbdb.c | 6 +-
plugins/bbdb/org-gnome-evolution-bbdb.eplug.xml | 6 +-
6 files changed, 129 insertions(+), 11 deletions(-)
---
diff --git a/addressbook/gui/widgets/eab-config.c b/addressbook/gui/widgets/eab-config.c
index dbbb8ce..5cb8d25 100644
--- a/addressbook/gui/widgets/eab-config.c
+++ b/addressbook/gui/widgets/eab-config.c
@@ -54,6 +54,8 @@ ecp_target_free (EConfig *ec, EConfigTarget *t)
p->source_changed_id = 0;
}
break; }
+ case EAB_CONFIG_TARGET_PREFS:
+ break;
}
}
@@ -64,6 +66,12 @@ ecp_target_free (EConfig *ec, EConfigTarget *t)
if (s->source)
g_object_unref (s->source);
break; }
+ case EAB_CONFIG_TARGET_PREFS: {
+ EABConfigTargetPrefs *s = (EABConfigTargetPrefs *) t;
+
+ if (s->gconf)
+ g_object_unref (s->gconf);
+ break; }
}
((EConfigClass *) ecp_parent_class)->target_free (ec, t);
@@ -91,6 +99,8 @@ ecp_set_target (EConfig *ec, EConfigTarget *t)
s->source, "changed",
G_CALLBACK (ecp_source_changed), ec);
break; }
+ case EAB_CONFIG_TARGET_PREFS:
+ break;
}
}
}
@@ -145,3 +155,17 @@ eab_config_target_new_source (EABConfig *ecp, struct _ESource *source)
return t;
}
+
+EABConfigTargetPrefs *
+eab_config_target_new_prefs (EABConfig *ecp, GConfClient *gconf)
+{
+ EABConfigTargetPrefs *t = e_config_target_new (
+ &ecp->config, EAB_CONFIG_TARGET_PREFS, sizeof (*t));
+
+ if (gconf)
+ t->gconf = g_object_ref (gconf);
+ else
+ t->gconf = NULL;
+
+ return t;
+}
diff --git a/addressbook/gui/widgets/eab-config.h b/addressbook/gui/widgets/eab-config.h
index 5aa822e..7cf7924 100644
--- a/addressbook/gui/widgets/eab-config.h
+++ b/addressbook/gui/widgets/eab-config.h
@@ -24,6 +24,7 @@
#ifndef __EAB_CONFIG_H__
#define __EAB_CONFIG_H__
+#include <gconf/gconf-client.h>
#include "e-util/e-config.h"
#define EAB_TYPE_CONFIG (eab_config_get_type ())
@@ -46,7 +47,8 @@ struct _EABConfigClass {
};
enum _eab_config_target_t {
- EAB_CONFIG_TARGET_SOURCE
+ EAB_CONFIG_TARGET_SOURCE,
+ EAB_CONFIG_TARGET_PREFS
};
typedef struct _EABConfigTargetSource EABConfigTargetSource;
@@ -57,12 +59,22 @@ struct _EABConfigTargetSource {
struct _ESource *source;
};
+typedef struct _EABConfigTargetPrefs EABConfigTargetPrefs;
+
+struct _EABConfigTargetPrefs {
+ EConfigTarget target;
+
+ /* preferences are global from gconf */
+ GConfClient *gconf;
+};
+
typedef struct _EConfigItem EABConfigItem;
GType eab_config_get_type (void);
EABConfig *eab_config_new (gint type, const gchar *menuid);
EABConfigTargetSource *eab_config_target_new_source (EABConfig *ecp, struct _ESource *source);
+EABConfigTargetPrefs *eab_config_target_new_prefs (EABConfig *ecp, GConfClient *gconf);
G_END_DECLS
diff --git a/modules/addressbook/autocompletion-config.c b/modules/addressbook/autocompletion-config.c
index d445063..c78b958 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 1ea83c9..dd4b38b 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 }
};
diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c
index e0005a9..2c53eaf 100644
--- a/plugins/bbdb/bbdb.c
+++ b/plugins/bbdb/bbdb.c
@@ -33,7 +33,7 @@
#include <libedataserverui/e-client-utils.h>
#include <e-util/e-config.h>
-#include <mail/em-config.h>
+#include <addressbook/gui/widgets/eab-config.h>
#include <mail/em-event.h>
#include <composer/e-msg-composer.h>
@@ -48,7 +48,7 @@ GtkWidget *bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data
/* For internal use */
struct bbdb_stuff {
- EMConfigTargetPrefs *target;
+ EABConfigTargetPrefs *target;
ESourceList *source_list;
GtkWidget *combo_box;
@@ -648,7 +648,7 @@ GtkWidget *
bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data)
{
struct bbdb_stuff *stuff;
- EMConfigTargetPrefs *target = (EMConfigTargetPrefs *) hook_data->config->target;
+ EABConfigTargetPrefs *target = (EABConfigTargetPrefs *) hook_data->config->target;
GtkWidget *page;
GtkWidget *tab_label;
GtkWidget *frame;
diff --git a/plugins/bbdb/org-gnome-evolution-bbdb.eplug.xml b/plugins/bbdb/org-gnome-evolution-bbdb.eplug.xml
index 04ad29f..2dac0d3 100644
--- a/plugins/bbdb/org-gnome-evolution-bbdb.eplug.xml
+++ b/plugins/bbdb/org-gnome-evolution-bbdb.eplug.xml
@@ -17,9 +17,9 @@ Automatically fills your address book with names and email addresses as you repl
handle="bbdb_handle_send"
target="message"
/>
- </hook>
- <hook class="org.gnome.evolution.mail.config:1.0">
- <group id="org.gnome.evolution.mail.prefs" target="prefs">
+ </hook>
+ <hook class="org.gnome.evolution.addressbook.config:1.0">
+ <group id="org.gnome.evolution.addressbook.prefs" target="prefs">
<item type="page" path="80.bbdb" _label="BBDB" factory="bbdb_page_factory"/>
</group>
</hook>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]