From c7d3c9f95609123035ebaa267f9d2e6ecfa8c2e8 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 12 Jan 2009 04:12:01 +0000 Subject: Merge revisions 36866:37046 from trunk. svn path=/branches/kill-bonobo/; revision=37050 --- addressbook/ChangeLog | 86 ++++++++ addressbook/conduit/address-conduit.c | 220 +++++++++++++++++++++ addressbook/gui/component/Makefile.am | 1 + addressbook/gui/component/addressbook-component.c | 2 +- addressbook/gui/component/addressbook-config.c | 2 +- addressbook/gui/component/addressbook-view.c | 4 +- .../gui/contact-editor/e-contact-editor-address.c | 1 - .../gui/contact-editor/e-contact-editor-fullname.c | 1 - .../gui/contact-editor/e-contact-editor-im.c | 1 - addressbook/gui/contact-editor/e-contact-editor.h | 2 - .../gui/contact-editor/e-contact-quick-add.c | 1 - addressbook/gui/contact-editor/eab-editor.h | 2 - addressbook/gui/contact-editor/test-editor.c | 20 -- .../contact-list-editor/e-contact-list-editor.h | 2 - addressbook/gui/merging/eab-contact-merging.c | 2 +- addressbook/gui/widgets/addresstypes.xml | 2 +- addressbook/printing/e-contact-print.c | 1 - .../printing/test-contact-print-style-editor.c | 20 -- addressbook/printing/test-print.c | 21 -- 19 files changed, 312 insertions(+), 79 deletions(-) (limited to 'addressbook') diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 8fb965960d..2255936197 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,89 @@ +2009-01-11 Matthew Barnes + + * gui/widgets/eab-contact-display.c (eab_uri_popup_link_open), + (on_link_clicked): + Call e_show_uri() instead of gnome_url_show(). + +2009-01-10 Matthew Barnes + + * gui/contact-editor/e-contact-editor-fullname.c: + * gui/contact-editor/e-contact-editor-im.c: + * gui/contact-editor/e-contact-editor-address.c: + * gui/widgets/e-addressbook-view.c: + * printing/e-contact-print.c: + Remove unneeded #include . + +2009-01-10 Matthew Barnes + + * gui/component/addressbook-view.c: + * gui/contact-editor/e-contact-editor.h: + * gui/contact-editor/e-contact-quick-add.c: + * gui/contact-editor/eab-editor.h: + * gui/contact-list-editor/e-contact-list-editor.h: + Remove unneeded #include . + Remove unneeded #include + +2009-01-10 Matthew Barnes + + ** Fixes bug #567270 + + * gui/contact-editor/test-editor.c: + * printing/test-contact-style-editor.c: + * printing/test-print.c: + Remove already-disabled use of gnome_about_new(). + +2009-01-10 Matthew Barnes + + ** Fixes part of bug #567276 + + * gui/widgets/e-addressbook-view.c: + * printing/test-print.c: + Remove unneeded #include . + +2009-01-10 Andre Klapper + + * Fix for bug #567282 + + * /gui/component/addressbook-view.c: + Remove unrequired #include of . + +2009-01-09 Takao Fujiwara + + Reviewed by Matthew Barnes + + * Fix for bug #566011 + + * gui/component/Makefile.am: + * gui/component/addressbook-component.c + (addressbook_component_class_init): + Include instead of and + add bindtextdomain(). + +2009-01-08 Milan Crha + + ** Fix for bug #339879 + + * gui/widgets/addresstypes.xml: Use "rawcode" instead of "code" + to have not added a "match-all" into the expression. + +2009-01-07 Matt Davey + + ** Fix for bugs #201167 and #269342 + + * conduit/address-conduit.c: + Add support for category syncing. Also, retain an existing + given/first name split if it exists in the pilot record. + +2009-01-01 Matthew Barnes + + * ui/component/addressbook-config.c (eabc_general_offline): + Use the correct macro when marking strings for translation. + +2008-12-23 Andre Klapper + + * gui/merging/eab-contact-merging.c: + Include instead of + 2008-12-09 Milan Crha ** Part of fix for bug #563669 diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c index be9b6be368..e80d1c346e 100644 --- a/addressbook/conduit/address-conduit.c +++ b/addressbook/conduit/address-conduit.c @@ -35,6 +35,8 @@ #include #include #include +#include +#include #include #include #include @@ -64,6 +66,7 @@ void conduit_destroy_gpilot_conduit (GnomePilotConduit*); #define WARN g_warning #define INFO g_message +#define PILOT_MAX_CATEGORIES 16 enum { LABEL_WORK, @@ -155,6 +158,194 @@ struct _EAddrConduitCfg { gchar *last_uri; }; +/* NOTE: copied from calendar/conduit/common/libecalendar-common-conduit.c + * Adds a category to the category app info structure (name and ID), + * sets category->renamed[i] to true if possible to rename. + * + * This will be packed and written to the app info block during post_sync. + * + * NOTE: cat_to_add MUST be in PCHAR format. Evolution stores categories + * in UTF-8 format. A conversion must take place before calling + * this function (see e_pilot_utf8_to_pchar() in e-pilot-util.c) + */ +static int +e_pilot_add_category_if_possible(char *cat_to_add, struct CategoryAppInfo *category) +{ + int i, j; + int retval = 0; /* 0 is the Unfiled category */ + LOG(g_message("e_pilot_add_category_if_possible\n")); + + for(i=0; iname[i]) == 0){ + int cat_to_add_len; + int desktopUniqueID; + + cat_to_add_len = strlen(cat_to_add); + retval = i; + + if(cat_to_add_len > 15){ + char tmpstr[16]; + strncpy(tmpstr, cat_to_add,16); + tmpstr[16] = '\0'; + /* Have to truncate the category name */ + LOG (g_warning ("*** Desktop category '%s' too long for PDA." + "Truncating to '%s' ***",cat_to_add, tmpstr)); + cat_to_add_len = 15; + } + + /* only 15 characters for category, 16th is + * '\0' can't do direct mem transfer due to + * declaration type + */ + for(j=0; jname[i][j] = cat_to_add[j]; + } + + for(j=cat_to_add_len; j<16; j++) { + category->name[i][j] = '\0'; + } + + //find a desktop id that is not in use between 128 and 255 + /* XXX desktopUniqueID should really be used for tracking + * categories across renaming operations, but as Evo + * doesn't have a concept of category UIDs or renaming, + * we don't have much use for it at present. + */ + for (desktopUniqueID = 128; desktopUniqueID <= 255; desktopUniqueID++) { + int found = 0; + for(j=0; jID[j] == desktopUniqueID) { + found = 1; + } + } + if (found == 0) { + break; + } + if (desktopUniqueID == 255) { + LOG (g_warning ("*** no more categories available on PC ***")); + } + } + category->ID[i] = desktopUniqueID; + + category->renamed[i] = TRUE; + + break; + } + } + + if(retval == 0){ + LOG (g_warning ("*** not adding category - category list already full ***")); + } + + return retval; +} + +/* + * conversion from an evolution category to a palm category. + * we iterate over the list of desktop categories to see if + * there is matching palm category. If not, we create + * a new palm category from the first evo category. + * If a category was not found and could not be created, + * or if there are no desktop categories, then *pilotCategory + * is set to zero ("Unfiled"). + */ +static +void e_pilot_local_category_to_remote(int * pilotCategory, + EContact *contact, struct CategoryAppInfo *category) +{ + GList *c_list = NULL, *l; + char * category_string, *first_category = NULL; + int i; + *pilotCategory = 0; /* default to "Unfiled" */ + c_list = e_contact_get (contact, E_CONTACT_CATEGORY_LIST); + if (c_list) { + /* remember the first category */ + first_category = e_pilot_utf8_to_pchar((const char *)c_list->data); + } + l = c_list; + while(l && *pilotCategory == 0) { + //list != 0, so at least 1 category is assigned + category_string = e_pilot_utf8_to_pchar((const char *)l->data); + for (i=0; i < PILOT_MAX_CATEGORIES; i++) { + /* only 15 chars + nul in palm category name */ + if (strncmp(category_string,category->name[i], 15) == 0) { + *pilotCategory = i; + break; + } + } + g_free(category_string); + l = l->next; + } + if (*pilotCategory == 0 && first_category && *first_category) { + /* category not available on palm, try to create it */ + /* XXX e_pilot_add_category_if_possible can be called + * when we're doing a 'copy from pilot'. This should + * really be avoided. + */ + *pilotCategory = e_pilot_add_category_if_possible( + first_category,category); + g_free(first_category); + } + g_list_foreach (c_list, (GFunc)g_free, NULL); + g_list_free(c_list); + /*end category*/ +} + +/* + * conversion from a palm category to an evolution category + */ +static +void e_pilot_remote_category_to_local(int pilotCategory, + EContact *contact, struct CategoryAppInfo *category) +{ + char *category_string = NULL; + + if (pilotCategory != 0) { + /* pda has category assigned */ + category_string = e_pilot_utf8_from_pchar( + category->name[pilotCategory]); + + LOG(g_message("PDA Category: %s\n", category_string)); + + if(e_categories_exist(category_string) == FALSE){ + /* add if it doesn't exist */ + LOG(g_message("Category created on pc\n")); + e_categories_add(category_string, NULL, NULL, TRUE); + } + } + + /* store the data in EContact */ + if (category_string == NULL) { + /* remove categories from desktop. */ + e_contact_set (contact, E_CONTACT_CATEGORY_LIST, NULL); + } + else { + + /* Since the first first category is synced with the PDA, add the PDA's + * category to the beginning of the category list */ + GList *c_list = NULL; + GList *newcat_in_list; + c_list = e_contact_get (contact, E_CONTACT_CATEGORY_LIST); + + /* remove old item from list so we don't have duplicate entries */ + newcat_in_list = g_list_find_custom(c_list, category_string, (GCompareFunc)strcmp); + if(newcat_in_list != NULL) + { + g_free(newcat_in_list->data); + c_list = g_list_remove(c_list, newcat_in_list->data); + } + + c_list = g_list_prepend(c_list, category_string); + e_contact_set (contact, E_CONTACT_CATEGORY_LIST, c_list); + + g_list_foreach (c_list, (GFunc)g_free, NULL); + g_list_free(c_list); + } +} + static EAddrConduitCfg * addrconduit_load_configuration (guint32 pilot_id) { @@ -920,6 +1111,9 @@ local_record_from_ecard (EAddrLocalRecord *local, EContact *contact, EAddrCondui #endif } + /*Category support*/ + e_pilot_local_category_to_remote(&(local->local.category), contact, &(ctxt->ai.category)); + local->addr->entry[entryFirstname] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_GIVEN_NAME)); local->addr->entry[entryLastname] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_FAMILY_NAME)); local->addr->entry[entryCompany] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_ORG)); @@ -1105,11 +1299,17 @@ ecard_from_remote_record(EAddrConduitContext *ctxt, else contact = e_contact_duplicate (in_contact); + /*Category support*/ + e_pilot_remote_category_to_local(remote->category, contact, &(ctxt->ai.category)); + /* Name */ name = e_contact_name_new (); name->given = get_entry_text (address, entryFirstname); name->family = get_entry_text (address, entryLastname); + /* set the name, respecting the pilot's given/family names */ + e_contact_set (contact, E_CONTACT_NAME, name); + /* now set the full_name */ full_name = e_contact_name_to_string (name); e_contact_set (contact, E_CONTACT_FULL_NAME, full_name); e_contact_name_free (name); @@ -1424,9 +1624,29 @@ post_sync (GnomePilotConduit *conduit, { GList *changed; gchar *filename, *change_id; + unsigned char *buf; + int dlpRetVal, len; LOG (g_message ( "post_sync: Address Conduit v.%s", CONDUIT_VERSION )); + /* Write AppBlock to PDA - updates categories */ + buf = (unsigned char*)g_malloc (0xffff); + + len = pack_AddressAppInfo (&(ctxt->ai), buf, 0xffff); + + dlpRetVal = dlp_WriteAppBlock (dbi->pilot_socket, dbi->db_handle, + (unsigned char *)buf, len); + + g_free (buf); + + if (dlpRetVal < 0) { + WARN ( ("Could not write pilot's Address application block")); + WARN ("dlp_WriteAppBlock(...) = %d", dlpRetVal); + /*gnome_pilot_conduit_error (conduit, + _("Could not write pilot's Address application block"));*/ + return -1; + } + g_free (ctxt->cfg->last_uri); ctxt->cfg->last_uri = g_strdup (e_book_get_uri (ctxt->ebook)); addrconduit_save_configuration (ctxt->cfg); diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am index 53e0a2e804..c245592bea 100644 --- a/addressbook/gui/component/Makefile.am +++ b/addressbook/gui/component/Makefile.am @@ -18,6 +18,7 @@ INCLUDES = \ -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ -DEVOLUTION_GALVIEWSDIR=\""$(viewsdir)"\" \ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ + -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ -DEVOLUTION_UIDIR=\""$(evolutionuidir)"\" \ -DPREFIX=\""$(prefix)"\" \ $(LDAP_CFLAGS) \ diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c index a04bde676a..b79ff34cea 100644 --- a/addressbook/gui/component/addressbook-component.c +++ b/addressbook/gui/component/addressbook-component.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include #include #include diff --git a/addressbook/gui/component/addressbook-config.c b/addressbook/gui/component/addressbook-config.c index c1f3d76b75..7b94a8acea 100644 --- a/addressbook/gui/component/addressbook-config.c +++ b/addressbook/gui/component/addressbook-config.c @@ -627,7 +627,7 @@ eabc_general_offline(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, if (old) return old; else { - offline_setting = gtk_check_button_new_with_mnemonic (N_("Copy _book content locally for offline operation")); + offline_setting = gtk_check_button_new_with_mnemonic (_("Copy _book content locally for offline operation")); gtk_widget_show (offline_setting); gtk_container_add (GTK_CONTAINER (parent), offline_setting); g_signal_connect (offline_setting, "toggled", G_CALLBACK (offline_status_changed_cb), sdialog); diff --git a/addressbook/gui/component/addressbook-view.c b/addressbook/gui/component/addressbook-view.c index c3bb7c43d7..23872a3366 100644 --- a/addressbook/gui/component/addressbook-view.c +++ b/addressbook/gui/component/addressbook-view.c @@ -28,9 +28,7 @@ #include #include #include -#include -#include -#include +#include #include #include #include diff --git a/addressbook/gui/contact-editor/e-contact-editor-address.c b/addressbook/gui/contact-editor/e-contact-editor-address.c index be8c75e636..111dfe3bca 100644 --- a/addressbook/gui/contact-editor/e-contact-editor-address.c +++ b/addressbook/gui/contact-editor/e-contact-editor-address.c @@ -26,7 +26,6 @@ #include #include -#include #include #include #include diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.c b/addressbook/gui/contact-editor/e-contact-editor-fullname.c index db7030e98b..3eeaa9d6ed 100644 --- a/addressbook/gui/contact-editor/e-contact-editor-fullname.c +++ b/addressbook/gui/contact-editor/e-contact-editor-fullname.c @@ -23,7 +23,6 @@ #include #include "e-contact-editor-fullname.h" #include -#include #include static void e_contact_editor_fullname_init (EContactEditorFullname *card); diff --git a/addressbook/gui/contact-editor/e-contact-editor-im.c b/addressbook/gui/contact-editor/e-contact-editor-im.c index cc4fcc5d05..65a70f432b 100644 --- a/addressbook/gui/contact-editor/e-contact-editor-im.c +++ b/addressbook/gui/contact-editor/e-contact-editor-im.c @@ -22,7 +22,6 @@ #include #include "e-contact-editor-im.h" -#include #include #include #include diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h index d4af1495c2..d216fe0435 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.h +++ b/addressbook/gui/contact-editor/e-contact-editor.h @@ -23,8 +23,6 @@ #ifndef __E_CONTACT_EDITOR_H__ #define __E_CONTACT_EDITOR_H__ -#include -#include #include #include "addressbook/gui/contact-editor/eab-editor.h" diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c index 6de903d16f..d30559e34f 100644 --- a/addressbook/gui/contact-editor/e-contact-quick-add.c +++ b/addressbook/gui/contact-editor/e-contact-quick-add.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/addressbook/gui/contact-editor/eab-editor.h b/addressbook/gui/contact-editor/eab-editor.h index cc95e003e1..4f108f509f 100644 --- a/addressbook/gui/contact-editor/eab-editor.h +++ b/addressbook/gui/contact-editor/eab-editor.h @@ -24,8 +24,6 @@ #ifndef __EAB_EDITOR_H__ #define __EAB_EDITOR_H__ -#include -#include #include #include diff --git a/addressbook/gui/contact-editor/test-editor.c b/addressbook/gui/contact-editor/test-editor.c index 61c6de7174..44703c9e57 100644 --- a/addressbook/gui/contact-editor/test-editor.c +++ b/addressbook/gui/contact-editor/test-editor.c @@ -92,26 +92,6 @@ editor_closed_cb (EContactEditor *ce, gpointer data) exit (0); } -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey ", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Contact Editor Test" ), VERSION, - _( "Copyright (C) 2000, Ximian, Inc." ), - authors, - _( "This should test the contact editor canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - int main( int argc, char *argv[] ) { char *cardstr; diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.h b/addressbook/gui/contact-list-editor/e-contact-list-editor.h index 2c420fcbd2..13b6864a9a 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.h +++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.h @@ -23,8 +23,6 @@ #ifndef __E_CONTACT_LIST_EDITOR_H__ #define __E_CONTACT_LIST_EDITOR_H__ -#include -#include #include #include diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c index 96fccd1b13..2a97169459 100644 --- a/addressbook/gui/merging/eab-contact-merging.c +++ b/addressbook/gui/merging/eab-contact-merging.c @@ -32,7 +32,7 @@ #include #include "addressbook/gui/widgets/eab-contact-display.h" #include "e-util/e-util-private.h" -#include +#include typedef struct dropdown_data dropdown_data; typedef enum { diff --git a/addressbook/gui/widgets/addresstypes.xml b/addressbook/gui/widgets/addresstypes.xml index c93f9cac19..cef8000cc4 100644 --- a/addressbook/gui/widgets/addresstypes.xml +++ b/addressbook/gui/widgets/addresstypes.xml @@ -79,7 +79,7 @@ Expression - + diff --git a/addressbook/printing/e-contact-print.c b/addressbook/printing/e-contact-print.c index 23abe184ca..0ba9dbb71a 100644 --- a/addressbook/printing/e-contact-print.c +++ b/addressbook/printing/e-contact-print.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/addressbook/printing/test-contact-print-style-editor.c b/addressbook/printing/test-contact-print-style-editor.c index cf9aeebeb2..2ca9afb159 100644 --- a/addressbook/printing/test-contact-print-style-editor.c +++ b/addressbook/printing/test-contact-print-style-editor.c @@ -40,26 +40,6 @@ static void destroy_callback(GtkWidget *app, gpointer data) exit(0); } -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey ", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Contact Print Style Editor Test" ), VERSION, - _( "Copyright (C) 2000, Ximian, Inc." ), - authors, - _( "This should test the contact print style editor widget" ), - NULL); - gtk_widget_show (about); -} -#endif - int main( int argc, char *argv[] ) { GtkWidget *app; diff --git a/addressbook/printing/test-print.c b/addressbook/printing/test-print.c index 6616a92fff..2c658840e6 100644 --- a/addressbook/printing/test-print.c +++ b/addressbook/printing/test-print.c @@ -24,32 +24,11 @@ #include #include -#include #include #include #include #include "e-contact-print.h" -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey ", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Contact Print Test" ), VERSION, - _( "Copyright (C) 2000, Ximian, Inc." ), - authors, - _( "This should test the contact print code" ), - NULL); - gtk_widget_show (about); -} -#endif - int main( int argc, char *argv[] ) { GList *shown_fields = NULL; -- cgit v1.2.3