Home | History | Annotate | Download | only in patches
      1 --- e-util/e-pilot-util.h.orig	2006-12-29 16:57:56.429202000 +0800
      2 +++ e-util/e-pilot-util.h	2006-12-28 15:05:24.062281000 +0800
      3 @@ -26,8 +26,8 @@
      4  #ifndef E_PILOT_UTIL_H
      5  #define E_PILOT_UTIL_H
      6  
      7 -char *e_pilot_utf8_to_pchar (const char *string);
      8 -char *e_pilot_utf8_from_pchar (const char *string);
      9 +char *e_pilot_utf8_to_pchar   (const char *string, const char *pilot_charset);
     10 +char *e_pilot_utf8_from_pchar (const char *string, const char *pilot_charset);
     11  
     12  ESource *e_pilot_get_sync_source (ESourceList *source_list);
     13  void e_pilot_set_sync_source (ESourceList *source_list, ESource *source);
     14 --- e-util/e-pilot-util.c.orig	2006-12-29 16:58:06.396943000 +0800
     15 +++ e-util/e-pilot-util.c	2006-12-28 15:05:24.057859000 +0800
     16 @@ -29,16 +29,19 @@
     17  #include "e-pilot-util.h"
     18  
     19  char *
     20 -e_pilot_utf8_to_pchar (const char *string)
     21 +e_pilot_utf8_to_pchar (const char *string, const char *pilot_charset)
     22  {
     23  	char *pstring = NULL;
     24  	int res;
     25  
     26  	if (!string)
     27  		return NULL;
     28 -	
     29 -	res = convert_ToPilotChar ("UTF-8", string, strlen (string), &pstring);
     30  
     31 +#ifdef PILOT_LINK_0_12
     32 +	res = convert_ToPilotChar_WithCharset ("UTF-8", string, strlen (string), &pstring, pilot_charset);
     33 +#else
     34 +	res = convert_ToPilotChar ("UTF-8", string, strlen (string), &pstring);
     35 +#endif
     36  	if (res != 0)
     37  		pstring = strdup (string);
     38  
     39 @@ -46,16 +49,20 @@
     40  }
     41  
     42  char *
     43 -e_pilot_utf8_from_pchar (const char *string)
     44 +e_pilot_utf8_from_pchar (const char *string, const char *pilot_charset)
     45  {
     46  	char *ustring = NULL;
     47  	int res;
     48  
     49  	if (!string)
     50  		return NULL;
     51 -	
     52 +
     53 +#ifdef	PILOT_LINK_0_12
     54 +	res = convert_FromPilotChar_WithCharset ("UTF-8", string, strlen (string), &ustring, pilot_charset);
     55 +#else
     56  	res = convert_FromPilotChar ("UTF-8", string, strlen (string), &ustring);
     57 -	
     58 +#endif
     59 +
     60  	if (res != 0)
     61  		ustring = strdup (string);
     62  	
     63 --- addressbook/conduit/address-conduit.c.orig	2006-12-29 16:56:06.492195000 +0800
     64 +++ addressbook/conduit/address-conduit.c	2006-12-29 16:25:38.535634000 +0800
     65 @@ -63,6 +63,8 @@
     66  #define WARN g_warning
     67  #define INFO g_message
     68  
     69 +gchar *pilot_charset = NULL;
     70 +
     71  enum {
     72  	LABEL_WORK,
     73  	LABEL_HOME,
     74 @@ -750,7 +752,7 @@
     75  	char *text = NULL;
     76  	
     77  	if (address.entry[entry])
     78 -		text = e_pilot_utf8_from_pchar (address.entry[entry]);
     79 +		text = e_pilot_utf8_from_pchar (address.entry[entry], pilot_charset);
     80  
     81  	e_contact_set (contact, field, text);
     82  	
     83 @@ -761,7 +763,7 @@
     84  get_entry_text (struct Address address, int entry)
     85  {
     86  	if (address.entry[entry])
     87 -		return e_pilot_utf8_from_pchar (address.entry[entry]);
     88 +		return e_pilot_utf8_from_pchar (address.entry[entry], pilot_charset);
     89  
     90  	return NULL;	
     91  }
     92 @@ -917,10 +919,10 @@
     93  #endif
     94  	}
     95  
     96 -	local->addr->entry[entryFirstname] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_GIVEN_NAME));
     97 -	local->addr->entry[entryLastname] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_FAMILY_NAME));
     98 -	local->addr->entry[entryCompany] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_ORG));
     99 -	local->addr->entry[entryTitle] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_TITLE));
    100 +	local->addr->entry[entryFirstname] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_GIVEN_NAME), pilot_charset);
    101 +	local->addr->entry[entryLastname] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_FAMILY_NAME), pilot_charset);
    102 +	local->addr->entry[entryCompany] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_ORG), pilot_charset);
    103 +	local->addr->entry[entryTitle] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_TITLE), pilot_charset);
    104  	
    105  	/* See if the default has something in it */
    106  	if ((address = e_contact_get (contact, ctxt->cfg->default_address))) {
    107 @@ -946,13 +948,13 @@
    108  			add = g_strdup (address->street);
    109  			LOG (g_warning ("Address has only one line: [%s]\n", add));
    110  		}
    111 -		local->addr->entry[entryAddress] = e_pilot_utf8_to_pchar (add);
    112 +		local->addr->entry[entryAddress] = e_pilot_utf8_to_pchar (add, pilot_charset);
    113  		g_free (add);
    114  		
    115 -		local->addr->entry[entryCity] = e_pilot_utf8_to_pchar (address->locality);
    116 -		local->addr->entry[entryState] = e_pilot_utf8_to_pchar (address->region);
    117 -		local->addr->entry[entryZip] = e_pilot_utf8_to_pchar (address->code);
    118 -		local->addr->entry[entryCountry] = e_pilot_utf8_to_pchar (address->country);
    119 +		local->addr->entry[entryCity] = e_pilot_utf8_to_pchar (address->locality, pilot_charset);
    120 +		local->addr->entry[entryState] = e_pilot_utf8_to_pchar (address->region, pilot_charset);
    121 +		local->addr->entry[entryZip] = e_pilot_utf8_to_pchar (address->code, pilot_charset);
    122 +		local->addr->entry[entryCountry] = e_pilot_utf8_to_pchar (address->country, pilot_charset);
    123  		
    124  		e_contact_address_free (address);
    125  	}
    126 @@ -973,7 +975,7 @@
    127  			phone_str = e_contact_get_const (contact, priority[i]);
    128  			if (phone_str && *phone_str) {
    129  				clear_entry_text (*local->addr, phone);
    130 -				local->addr->entry[phone] = e_pilot_utf8_to_pchar (phone_str);
    131 +				local->addr->entry[phone] = e_pilot_utf8_to_pchar (phone_str, pilot_charset);
    132  				local->addr->phoneLabel[phone - entryPhone1] = priority_label[i];
    133  				phone++;
    134  			}
    135 @@ -1022,13 +1024,13 @@
    136  			
    137  			if (phone_str && *phone_str) {
    138  				clear_entry_text (*local->addr, i);
    139 -				local->addr->entry[i] = e_pilot_utf8_to_pchar (phone_str);
    140 +				local->addr->entry[i] = e_pilot_utf8_to_pchar (phone_str, pilot_charset);
    141  			}
    142  		}
    143  	}
    144  	
    145  	/* Note */
    146 -	local->addr->entry[entryNote] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_NOTE));
    147 +	local->addr->entry[entryNote] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_NOTE), pilot_charset);
    148  }
    149  
    150  static void 
    151 @@ -1301,6 +1303,13 @@
    152  	/* g_message ("Addressbook Conduit v.%s", CONDUIT_VERSION); */
    153  
    154  	ctxt->dbi = dbi;
    155 +
    156 +#ifdef PILOT_LINK_0_12
    157 +	if(NULL == dbi->pilotInfo->sync_options.pilot_charset)
    158 +		pilot_charset = NULL;
    159 +	else
    160 +		pilot_charset = g_strdup(dbi->pilotInfo->sync_options.pilot_charset);
    161 +#endif
    162  	
    163  	if (ctxt->cfg->source) {
    164  		ctxt->ebook = e_book_new (ctxt->cfg->source, NULL);
    165 @@ -1438,7 +1447,8 @@
    166  	if (e_book_get_changes (ctxt->ebook, change_id, &changed, NULL))
    167  		e_book_free_change_list (changed);
    168  	g_free (change_id);
    169 -
    170 +	if (pilot_charset)
    171 +		g_free (pilot_charset);
    172  	LOG (g_message ( "---------------------------------------------------------\n" ));
    173  	
    174  	return 0;
    175 --- calendar/conduits/calendar/calendar-conduit.c.orig	2006-12-29 16:56:33.574041000 +0800
    176 +++ calendar/conduits/calendar/calendar-conduit.c	2006-12-29 16:23:25.391507000 +0800
    177 @@ -60,6 +60,8 @@
    178  #define WARN g_warning
    179  #define INFO g_message
    180  
    181 +gchar *pilot_charset = NULL;
    182 +
    183  #define PILOT_MAX_ADVANCE 99
    184  
    185  typedef struct _ECalLocalRecord ECalLocalRecord;
    186 @@ -945,13 +947,13 @@
    187  	   uses free to deallocate */
    188  	e_cal_component_get_summary (comp, &summary);
    189  	if (summary.value) 
    190 -		local->appt->description = e_pilot_utf8_to_pchar (summary.value);
    191 +		local->appt->description = e_pilot_utf8_to_pchar (summary.value, pilot_charset);
    192  
    193  	e_cal_component_get_description_list (comp, &d_list);
    194  	if (d_list) {
    195  		description = (ECalComponentText *) d_list->data;
    196  		if (description && description->value)
    197 -			local->appt->note = e_pilot_utf8_to_pchar (description->value);
    198 +			local->appt->note = e_pilot_utf8_to_pchar (description->value, pilot_charset);
    199  		else
    200  			local->appt->note = NULL;
    201  	} else {
    202 @@ -1228,7 +1230,7 @@
    203  
    204  	e_cal_component_set_last_modified (comp, &now);
    205  
    206 -	summary.value = txt = e_pilot_utf8_from_pchar (appt.description);
    207 +	summary.value = txt = e_pilot_utf8_from_pchar (appt.description, pilot_charset);
    208  	e_cal_component_set_summary (comp, &summary);
    209  	free (txt);
    210  
    211 @@ -1239,7 +1241,7 @@
    212  		GSList l;
    213  		ECalComponentText text;
    214  
    215 -		text.value = txt = e_pilot_utf8_from_pchar (appt.note);
    216 +		text.value = txt = e_pilot_utf8_from_pchar (appt.note, pilot_charset);
    217  		text.altrep = NULL;
    218  		l.data = &text;
    219  		l.next = NULL;
    220 @@ -1494,6 +1496,12 @@
    221  	LOG (g_message ( "pre_sync: Calendar Conduit v.%s", CONDUIT_VERSION ));
    222  
    223  	ctxt->dbi = dbi;	
    224 +#ifdef PILOT_LINK_0_12
    225 +	if(NULL == dbi->pilotInfo->sync_options.pilot_charset)
    226 +		pilot_charset = NULL;
    227 +	else
    228 +		 pilot_charset = g_strdup(dbi->pilotInfo->sync_options.pilot_charset);
    229 +#endif
    230  	ctxt->client = NULL;
    231  
    232  	/* Get the timezone */
    233 @@ -1658,6 +1666,8 @@
    234  	if (e_cal_get_changes (ctxt->client, change_id, &changed, NULL))
    235  		e_cal_free_change_list (changed);
    236  	g_free (change_id);
    237 +	if (pilot_charset)
    238 +		g_free (pilot_charset);
    239  	
    240  	LOG (g_message ( "---------------------------------------------------------\n" ));
    241  
    242 --- calendar/conduits/todo/todo-conduit.c.orig	2006-12-29 16:57:11.237457000 +0800
    243 +++ calendar/conduits/todo/todo-conduit.c	2006-12-29 16:25:01.553824000 +0800
    244 @@ -65,6 +65,8 @@
    245  #define WARN g_warning
    246  #define INFO g_message
    247  
    248 +gchar *pilot_charset = NULL;
    249 +
    250  typedef struct _EToDoLocalRecord EToDoLocalRecord;
    251  typedef struct _EToDoConduitCfg EToDoConduitCfg;
    252  typedef struct _EToDoConduitGui EToDoConduitGui;
    253 @@ -798,13 +800,13 @@
    254  	   uses free to deallocate */
    255  	e_cal_component_get_summary (comp, &summary);
    256  	if (summary.value) 
    257 -		local->todo->description = e_pilot_utf8_to_pchar (summary.value);
    258 +		local->todo->description = e_pilot_utf8_to_pchar (summary.value, pilot_charset);
    259  
    260  	e_cal_component_get_description_list (comp, &d_list);
    261  	if (d_list) {
    262  		description = (ECalComponentText *) d_list->data;
    263  		if (description && description->value)
    264 -			local->todo->note = e_pilot_utf8_to_pchar (description->value);
    265 +			local->todo->note = e_pilot_utf8_to_pchar (description->value, pilot_charset);
    266  		else
    267  			local->todo->note = NULL;
    268  	} else {
    269 @@ -947,7 +949,7 @@
    270  
    271  	e_cal_component_set_last_modified (comp, &now);
    272  
    273 -	summary.value = txt = e_pilot_utf8_from_pchar (todo.description);
    274 +	summary.value = txt = e_pilot_utf8_from_pchar (todo.description, pilot_charset);
    275  	e_cal_component_set_summary (comp, &summary);
    276  	free (txt);
    277  	
    278 @@ -958,7 +960,7 @@
    279  		GSList l;
    280  		ECalComponentText text;
    281  
    282 -		text.value = txt = e_pilot_utf8_from_pchar (todo.note);
    283 +		text.value = txt = e_pilot_utf8_from_pchar (todo.note, pilot_charset);
    284  		text.altrep = NULL;
    285  		l.data = &text;
    286  		l.next = NULL;
    287 @@ -1098,6 +1100,13 @@
    288  	ctxt->dbi = dbi;	
    289  	ctxt->client = NULL;
    290  
    291 +#ifdef PILOT_LINK_0_12
    292 +	if(NULL == dbi->pilotInfo->sync_options.pilot_charset)
    293 +		pilot_charset = NULL;
    294 +	else
    295 +		pilot_charset = g_strdup(dbi->pilotInfo->sync_options.pilot_charset);
    296 +#endif
    297 +
    298  	/* Get the timezone */
    299  	ctxt->timezone = get_default_timezone ();
    300  	if (ctxt->timezone == NULL)
    301 @@ -1259,7 +1268,8 @@
    302  	if (e_cal_get_changes (ctxt->client, change_id, &changed, NULL))
    303  		e_cal_free_change_list (changed);
    304  	g_free (change_id);
    305 -	
    306 +	if (pilot_charset)
    307 +		g_free (pilot_charset);	
    308  	LOG (g_message ( "---------------------------------------------------------\n" ));
    309  
    310  	return 0;
    311 --- calendar/conduits/memo/memo-conduit.c.orig	2006-12-29 17:09:14.347437000 +0800
    312 +++ calendar/conduits/memo/memo-conduit.c	2006-12-29 17:11:04.095005000 +0800
    313 @@ -63,6 +63,8 @@
    314  #define WARN g_warning
    315  #define INFO g_message
    316  
    317 +gchar *pilot_charset = NULL;
    318 +
    319  typedef struct _EMemoLocalRecord EMemoLocalRecord;
    320  typedef struct _EMemoConduitCfg EMemoConduitCfg;
    321  typedef struct _EMemoConduitGui EMemoConduitGui;
    322 @@ -693,7 +695,7 @@
    323  	if (d_list) {
    324  		description = (ECalComponentText *) d_list->data;
    325  		if (description && description->value){
    326 -			local->memo->text = e_pilot_utf8_to_pchar (description->value);
    327 +			local->memo->text = e_pilot_utf8_to_pchar (description->value, pilot_charset);
    328  		}
    329  		else{
    330  			local->memo->text = NULL;
    331 @@ -831,10 +833,10 @@
    332  			
    333  		}
    334  
    335 -		sumText.value = txt3 = e_pilot_utf8_from_pchar(txt2);
    336 +		sumText.value = txt3 = e_pilot_utf8_from_pchar(txt2, pilot_charset);
    337  		sumText.altrep = NULL;
    338  
    339 -		text.value = txt = e_pilot_utf8_from_pchar (memo.text);
    340 +		text.value = txt = e_pilot_utf8_from_pchar (memo.text, pilot_charset);
    341  		text.altrep = NULL;
    342  		l.data = &text;
    343  		l.next = NULL;
    344 @@ -928,6 +930,13 @@
    345  	ctxt->dbi = dbi;	
    346  	ctxt->client = NULL;
    347  	
    348 +#ifdef PILOT_LINK_0_12
    349 +	if(NULL == dbi->pilotInfo->sync_options.pilot_charset)
    350 +		pilot_charset = NULL;
    351 +	else
    352 +		pilot_charset = g_strdup(dbi->pilotInfo->sync_options.pilot_charset);
    353 +#endif
    354 +
    355  	if (start_calendar_server (ctxt) != 0) {
    356  		WARN(_("Could not start evolution-data-server"));
    357  		gnome_pilot_conduit_error (conduit, _("Could not start evolution-data-server"));
    358 @@ -1095,7 +1104,8 @@
    359  	if (e_cal_get_changes (ctxt->client, change_id, &changed, NULL))
    360  		e_cal_free_change_list (changed);
    361  	g_free (change_id);
    362 -	
    363 +	if (pilot_charset)
    364 +		g_free (pilot_charset);
    365  	LOG (g_message ( "---------------------------------------------------------\n" ));
    366  
    367  	return 0;
    368