From 02a9eb68308537fe712e757017ae4bb372863a8c Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 27 Aug 2008 19:56:31 +0000 Subject: Miscellaneous tweaks. Nothing major. svn path=/branches/kill-bonobo/; revision=36138 --- addressbook/gui/component/addressbook-config.c | 3 -- addressbook/gui/component/addressbook-config.h | 3 +- addressbook/gui/component/addressbook-migrate.c | 47 ++++++++++++++++--------- addressbook/gui/component/addressbook-migrate.h | 13 +++++-- addressbook/gui/component/addressbook.h | 4 --- 5 files changed, 43 insertions(+), 27 deletions(-) (limited to 'addressbook') diff --git a/addressbook/gui/component/addressbook-config.c b/addressbook/gui/component/addressbook-config.c index 2b749a6dd8..740e2c0575 100644 --- a/addressbook/gui/component/addressbook-config.c +++ b/addressbook/gui/component/addressbook-config.c @@ -18,8 +18,6 @@ #include #include -#include - #ifdef G_OS_WIN32 /* Include early and work around DATADIR lossage */ #define DATADIR crap_DATADIR @@ -30,7 +28,6 @@ #include #include "addressbook.h" -#include "addressbook-component.h" #include "addressbook-config.h" #include "e-util/e-error.h" diff --git a/addressbook/gui/component/addressbook-config.h b/addressbook/gui/component/addressbook-config.h index ef38e150bb..5e1f2c9c2c 100644 --- a/addressbook/gui/component/addressbook-config.h +++ b/addressbook/gui/component/addressbook-config.h @@ -25,7 +25,8 @@ #ifndef __ADDRESSBOOK_CONFIG_H__ #define __ADDRESSBOOK_CONFIG_H__ -#include "evolution-config-control.h" +#include +#include typedef enum { ADDRESSBOOK_LDAP_AUTH_NONE, diff --git a/addressbook/gui/component/addressbook-migrate.c b/addressbook/gui/component/addressbook-migrate.c index e6d5616e13..54f07704ce 100644 --- a/addressbook/gui/component/addressbook-migrate.c +++ b/addressbook/gui/component/addressbook-migrate.c @@ -56,7 +56,7 @@ typedef struct { ESourceList *source_list; - AddressbookComponent *component; + const gchar *data_dir; GtkWidget *window; GtkWidget *label; @@ -449,14 +449,12 @@ create_groups (MigrationContext *context, GSList *groups; ESourceGroup *group; char *base_uri, *base_uri_proto; - const gchar *base_dir; *on_this_computer = NULL; *on_ldap_servers = NULL; *personal_source = NULL; - base_dir = addressbook_component_peek_base_directory (context->component); - base_uri = g_build_filename (base_dir, "local", NULL); + base_uri = g_build_filename (context->data_dir, "local", NULL); base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL); @@ -743,12 +741,17 @@ get_source_by_name (ESourceList *source_list, const char *name) static gboolean migrate_completion_folders (MigrationContext *context) { - char *uris_xml = gconf_client_get_string (addressbook_component_peek_gconf_client (context->component), - "/apps/evolution/addressbook/completion/uris", - NULL); + GConfClient *client; + const gchar *key; + gchar *uris_xml; printf ("trying to migrate completion folders\n"); + client = gconf_client_get_default (); + key = "/apps/evolution/addressbook/completion/uris"; + uris_xml = gconf_client_get_string (client, key, NULL); + g_object_unref (client); + if (uris_xml) { xmlDoc *doc = xmlParseMemory (uris_xml, strlen (uris_xml)); xmlNode *root; @@ -1075,17 +1078,20 @@ migrate_pilot_data (const char *old_path, const char *new_path) g_dir_close (dir); } -static MigrationContext* -migration_context_new (AddressbookComponent *component) +static MigrationContext * +migration_context_new (const gchar *data_dir) { MigrationContext *context = g_new (MigrationContext, 1); /* set up the mapping from old uris to new uids */ - context->folder_uid_map = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)g_free, (GDestroyNotify)g_free); + context->folder_uid_map = g_hash_table_new_full ( + g_str_hash, g_str_equal, + (GDestroyNotify) g_free, + (GDestroyNotify) g_free); e_book_get_addressbooks (&context->source_list, NULL); - context->component = component; + context->data_dir = data_dir; return context; } @@ -1102,17 +1108,27 @@ migration_context_free (MigrationContext *context) g_free (context); } -int -addressbook_migrate (AddressbookComponent *component, int major, int minor, int revision, GError **err) +gboolean +addressbook_migrate (EShellModule *shell_module, + gint major, + gint minor, + gint revision, + GError **error) { ESourceGroup *on_this_computer; ESourceGroup *on_ldap_servers; ESource *personal_source; - MigrationContext *context = migration_context_new (component); + MigrationContext *context; gboolean need_dialog = FALSE; + const gchar *data_dir; printf ("addressbook_migrate (%d.%d.%d)\n", major, minor, revision); + g_return_val_if_fail (E_IS_SHELL_MODULE (shell_module), FALSE); + + data_dir = e_shell_module_get_data_dir (shell_module); + context = migration_context_new (data_dir); + /* we call this unconditionally now - create_groups either creates the groups/sources or it finds the necessary groups/sources. */ @@ -1170,8 +1186,7 @@ addressbook_migrate (AddressbookComponent *component, int major, int minor, int "Please be patient while Evolution migrates your Pilot Sync data...")); old_path = g_build_filename (g_get_home_dir (), "evolution", "local", "Contacts", NULL); - new_path = g_build_filename (addressbook_component_peek_base_directory (component), - "local", "system", NULL); + new_path = g_build_filename (data_dir, "local", "system", NULL); migrate_pilot_data (old_path, new_path); g_free (new_path); g_free (old_path); diff --git a/addressbook/gui/component/addressbook-migrate.h b/addressbook/gui/component/addressbook-migrate.h index e30b2381da..2437b17f45 100644 --- a/addressbook/gui/component/addressbook-migrate.h +++ b/addressbook/gui/component/addressbook-migrate.h @@ -22,10 +22,17 @@ #ifndef _ADDRESSBOOK_MIGRATE_H_ #define _ADDRESSBOOK_MIGRATE_H_ -#include "addressbook-component.h" +#include +#include -struct _GError; +G_BEGIN_DECLS -int addressbook_migrate (AddressbookComponent *component, int major, int minor, int revision, struct _GError **err); +gboolean addressbook_migrate (EShellModule *shell_module, + gint major, + gint minor, + gint revision, + GError **error); + +G_END_DECLS #endif /* _ADDRESSBOOK_MIGRATE_H_ */ diff --git a/addressbook/gui/component/addressbook.h b/addressbook/gui/component/addressbook.h index a2a475951a..23dc98a800 100644 --- a/addressbook/gui/component/addressbook.h +++ b/addressbook/gui/component/addressbook.h @@ -1,10 +1,6 @@ #ifndef __ADDRESSBOOK_H__ #define __ADDRESSBOOK_H__ -#include -#include -#include -#include #include guint addressbook_load (EBook *book, EBookCallback cb, gpointer closure); -- cgit v1.2.3