Changeset 3609
- Timestamp:
- 04/22/08 12:26:13
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/bindings/python/tinymail-camel-base.defs (modified) (1 diff)
- trunk/docs/devel/reference/tmpl/tny-account-store.sgml (modified) (1 diff)
- trunk/docs/devel/reference/tmpl/tny-account.sgml (modified) (1 diff)
- trunk/docs/devel/reference/tmpl/tny-device.sgml (modified) (1 diff)
- trunk/docs/devel/reference/tmpl/tny-send-queue.sgml (modified) (5 diffs)
- trunk/docs/devel/reference/tmpl/tny-shared.sgml (modified) (4 diffs)
- trunk/libtinymail-camel/tny-camel-account.c (modified) (9 diffs)
- trunk/libtinymail-camel/tny-camel-account.h (modified) (2 diffs)
- trunk/libtinymail-gnome-desktop/tny-gnome-account-store.c (modified) (1 diff)
- trunk/libtinymail-gpe/tny-gpe-account-store.c (modified) (1 diff)
- trunk/libtinymail-maemo/tny-maemo-account-store.c (modified) (1 diff)
- trunk/libtinymail-olpc/tny-olpc-account-store.c (modified) (1 diff)
- trunk/tests/shared/account-store.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r3601 r3609 1 2008-04-22 Philip Van Hoof <pvanhoof@gnome.org> 2 3 * tny_camel_account_add_option changed !! 4 * tny_camel_account_clear_options added 5 * tny_camel_account_get_options added 6 7 * This was a major API change in libtinymail-camel 8 1 9 2008-04-20 Philip Van Hoof <pvanhoof@gnome.org> 2 10 trunk/bindings/python/tinymail-camel-base.defs
r3275 r3609 191 191 (return-type "none") 192 192 (parameters 193 '(" const-gchar*" "option")193 '("TnyPair" "option") 194 194 ) 195 195 ) trunk/docs/devel/reference/tmpl/tny-account-store.sgml
r3606 r3609 49 49 50 50 </para> 51 52 @:53 51 54 52 @tnyaccountstore: the object which received the signal. trunk/docs/devel/reference/tmpl/tny-account.sgml
r3606 r3609 28 28 29 29 </para> 30 31 @: 30 32 31 33 @tnyaccount: the object which received the signal. trunk/docs/devel/reference/tmpl/tny-device.sgml
r3606 r3609 36 36 37 37 </para> 38 39 @:40 @:41 38 42 39 @tnydevice: the object which received the signal. trunk/docs/devel/reference/tmpl/tny-send-queue.sgml
r3606 r3609 40 40 </para> 41 41 42 @: 43 @: 44 @: 45 @: 46 42 47 @tnysendqueue: the object which received the signal. 43 48 @arg1: … … 49 54 50 55 </para> 56 57 @: 58 @: 59 @: 60 @: 61 @: 51 62 52 63 @tnysendqueue: the object which received the signal. … … 61 72 </para> 62 73 74 @: 75 @: 76 @: 77 @: 78 @: 79 63 80 @tnysendqueue: the object which received the signal. 64 81 @arg1: … … 72 89 </para> 73 90 74 @:75 76 91 @tnysendqueue: the object which received the signal. 77 92 … … 80 95 81 96 </para> 82 83 @:84 97 85 98 @tnysendqueue: the object which received the signal. trunk/docs/devel/reference/tmpl/tny-shared.sgml
r3606 r3609 54 54 </para> 55 55 56 @ tnyaccountstore: the object which received the signal.56 @: 57 57 58 58 <!-- ##### STRUCT TnyAccountStoreIface ##### --> … … 263 263 </para> 264 264 265 @ :265 @tnyaccount: the object which received the signal. 266 266 267 267 <!-- ##### SIGNAL TnyAccount::connection-status-changed ##### --> … … 322 322 </para> 323 323 324 @ tnydevice: the object which received the signal.325 @ arg1:324 @: 325 @: 326 326 327 327 <!-- ##### STRUCT TnyDeviceIface ##### --> … … 494 494 </para> 495 495 496 @tnysendqueue: the object which received the signal. 497 @arg1: 498 @arg2: 499 @arg3: 500 501 <!-- ##### SIGNAL TnySendQueue::msg-sending ##### --> 502 <para> 503 504 </para> 505 506 @tnysendqueue: the object which received the signal. 507 @arg1: 508 @arg2: 509 @arg3: 510 @arg4: 511 512 <!-- ##### SIGNAL TnySendQueue::msg-sent ##### --> 513 <para> 514 515 </para> 516 517 @tnysendqueue: the object which received the signal. 518 @arg1: 519 @arg2: 520 @arg3: 521 @arg4: 522 523 <!-- ##### SIGNAL TnySendQueue::queue-start ##### --> 524 <para> 525 526 </para> 527 496 528 @: 529 530 <!-- ##### SIGNAL TnySendQueue::queue-stop ##### --> 531 <para> 532 533 </para> 534 497 535 @: 498 @:499 @:500 501 <!-- ##### SIGNAL TnySendQueue::msg-sending ##### -->502 <para>503 504 </para>505 506 @:507 @:508 @:509 @:510 @:511 512 <!-- ##### SIGNAL TnySendQueue::msg-sent ##### -->513 <para>514 515 </para>516 517 @:518 @:519 @:520 @:521 @:522 523 <!-- ##### SIGNAL TnySendQueue::queue-start ##### -->524 <para>525 526 </para>527 528 @tnysendqueue: the object which received the signal.529 530 <!-- ##### SIGNAL TnySendQueue::queue-stop ##### -->531 <para>532 533 </para>534 535 @tnysendqueue: the object which received the signal.536 536 537 537 <!-- ##### STRUCT TnySendQueueIface ##### --> trunk/libtinymail-camel/tny-camel-account.c
r3590 r3609 156 156 g_object_unref (info->self); 157 157 return; 158 } 159 160 static void 161 output_param (GQuark key_id, gpointer data, gpointer user_data) 162 { 163 TnyCamelAccountPriv *apriv = user_data; 164 165 if (*(char *)data) { 166 apriv->options = g_list_prepend (apriv->options, 167 g_strdup_printf ("%s=%s", 168 g_quark_to_string (key_id), 169 (const gchar*) data)); 170 } 158 171 } 159 172 … … 231 244 232 245 if (url) { 246 if (url->params) 247 g_datalist_foreach (&url->params, output_param, apriv); 248 233 249 if (apriv->proto) 234 250 g_free (apriv->proto); … … 418 434 * tny_camel_account_add_option: 419 435 * @self: a #TnyCamelAccount object 420 * @option: a "key=value"Camel option436 * @option: a #TnyPair Camel option 421 437 * 422 438 * Add a Camel option to this #TnyCamelAccount instance. 423 439 * 424 440 * An often used option is the use_ssl one. For example "use_ssl=wrapped" or 425 441 * "use_ssl=tls" are the typical options added. Other possibilities for the 426 442 * "use_ssl" option are "never" and "when-possible": 443 * 444 * <informalexample><programlisting> 445 * tny_camel_account_add_option (account, tny_pair_new ("use_ssl", "tls")) 446 * </programlisting></informalexample> 427 447 * 428 448 * use_ssl=wrapped will wrap the connection on default port 993 with IMAP and … … 458 478 **/ 459 479 void 460 tny_camel_account_add_option (TnyCamelAccount *self, const gchar *option)480 tny_camel_account_add_option (TnyCamelAccount *self, TnyPair *option) 461 481 { 462 482 TNY_CAMEL_ACCOUNT_GET_CLASS (self)->add_option(self, option); 463 483 } 464 484 465 void466 tny_camel_account_add_option_default (TnyCamelAccount *self, const gchar *option)485 static void 486 tny_camel_account_add_option_default (TnyCamelAccount *self, TnyPair *option) 467 487 { 468 488 TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 469 489 GList *copy = priv->options; 470 490 gboolean found = FALSE; 491 gchar *option_str; 471 492 472 493 if (!option) 473 494 return; 474 495 475 while (copy) 476 { 496 if (!TNY_IS_PAIR (option)) { 497 g_critical ("The tny_camel_account_add_option API has changed. " 498 "Instead of a string you must now pass a TnyPair instance"); 499 } 500 501 g_assert (TNY_IS_PAIR (option)); 502 503 option_str = g_strdup_printf ("%s=%s", 504 tny_pair_get_name (option), 505 tny_pair_get_value (option)); 506 507 while (copy) { 477 508 gchar *str = (gchar *) copy->data; 478 509 479 if (str && !strcmp (option, str)) 480 { 510 if (str && !strcmp (option_str, str)) { 481 511 found = TRUE; 482 512 break; … … 485 515 } 486 516 487 if (!found) 488 { 489 priv->options = g_list_prepend (priv->options, g_strdup (option)); 517 if (!found) { 518 priv->options = g_list_prepend (priv->options, g_strdup (option_str)); 519 TNY_CAMEL_ACCOUNT_GET_CLASS (self)->prepare(self, TRUE, FALSE); 520 _tny_camel_account_emit_changed (self); 521 } 522 523 g_free (option_str); 524 525 return; 526 } 527 528 529 /** 530 * tny_camel_account_get_options: 531 * @self: a #TnyCamelAccount object 532 * @options: a #TnyList 533 * 534 * Get options of this #TnyCamelAccount instance. @options will be filled with 535 * #TnyPair instances. 536 **/ 537 void 538 tny_camel_account_get_options (TnyCamelAccount *self, TnyList *options) 539 { 540 TNY_CAMEL_ACCOUNT_GET_CLASS (self)->get_options (self, options); 541 } 542 543 544 545 static void 546 tny_camel_account_get_options_default (TnyCamelAccount *self, TnyList *options) 547 { 548 TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 549 GList *copy = priv->options; 550 551 if (!options) 552 return; 553 554 while (copy) { 555 gchar *str = g_strdup (copy->data); 556 gchar *key = str; 557 gchar *value = strchr (str, '='); 558 TnyPair *pair; 559 560 *value = '\0'; 561 value++; 562 563 pair = tny_pair_new (key, value); 564 g_free (str); 565 566 tny_list_prepend (options, (GObject *) pair); 567 568 copy = g_list_next (copy); 569 } 570 571 return; 572 } 573 574 575 /** 576 * tny_camel_account_clear_options: 577 * @self: a #TnyCamelAccount object 578 * 579 * Clear options of this #TnyCamelAccount instance. 580 **/ 581 void 582 tny_camel_account_clear_options (TnyCamelAccount *self) 583 { 584 TNY_CAMEL_ACCOUNT_GET_CLASS (self)->clear_options (self); 585 } 586 587 588 static void 589 tny_camel_account_clear_options_default (TnyCamelAccount *self) 590 { 591 TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 592 593 if (priv->options) { 594 g_list_foreach (priv->options, (GFunc)g_free, NULL); 595 g_list_free (priv->options); 596 priv->options = NULL; 597 490 598 TNY_CAMEL_ACCOUNT_GET_CLASS (self)->prepare(self, TRUE, FALSE); 491 599 _tny_camel_account_emit_changed (self); … … 624 732 tny_camel_account_stop_camel_operation_priv (TnyCamelAccountPriv *priv) 625 733 { 626 if (priv->cancel) 627 { 734 if (priv->cancel) { 628 735 camel_operation_unregister (priv->cancel); 629 736 camel_operation_end (priv->cancel); … … 680 787 TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 681 788 682 if (priv->cancel) 683 { 789 if (priv->cancel) { 684 790 g_static_rec_mutex_lock (priv->cancel_lock); 685 791 tny_camel_account_stop_camel_operation_priv (priv); … … 2028 2134 priv->inuse_spin = FALSE; 2029 2135 2030 if (priv->options) 2031 { 2136 if (priv->options) { 2032 2137 g_list_foreach (priv->options, (GFunc)g_free, NULL); 2033 2138 g_list_free (priv->options); … … 2192 2297 2193 2298 class->add_option= tny_camel_account_add_option_default; 2299 class->clear_options= tny_camel_account_clear_options_default; 2300 class->get_options= tny_camel_account_get_options_default; 2301 2194 2302 class->set_online= tny_camel_account_set_online_default; 2195 2303 trunk/libtinymail-camel/tny-camel-account.h
r3304 r3609 89 89 void (*stop_operation) (TnyAccount *self, gboolean *canceled); 90 90 91 void (*add_option) (TnyCamelAccount *self, const gchar *option); 91 void (*add_option) (TnyCamelAccount *self, TnyPair *option); 92 void (*clear_options) (TnyCamelAccount *self); 93 void (*get_options) (TnyCamelAccount *self, TnyList *options); 94 92 95 void (*set_online) (TnyCamelAccount *self, gboolean online, TnyCamelSetOnlineCallback callback, gpointer user_data); 93 96 … … 102 105 GType tny_camel_account_get_type (void); 103 106 104 void tny_camel_account_add_option (TnyCamelAccount *self, const gchar *option); 107 void tny_camel_account_get_options (TnyCamelAccount *self, TnyList *options); 108 void tny_camel_account_clear_options (TnyCamelAccount *self); 109 void tny_camel_account_add_option (TnyCamelAccount *self, TnyPair *option); 105 110 void tny_camel_account_set_session (TnyCamelAccount *self, TnySessionCamel *session); 106 111 void tny_camel_account_set_online (TnyCamelAccount *self, gboolean online, TnyCamelSetOnlineCallback callback, gpointer user_data); trunk/libtinymail-gnome-desktop/tny-gnome-account-store.c
r3592 r3609 247 247 g_free (key); 248 248 249 if (options) 250 { 249 if (options) { 251 250 GSList *tmp = options; 252 while (options) 253 { 254 tny_camel_account_add_option (TNY_CAMEL_ACCOUNT (account), options->data); 251 while (options) { 252 gchar *key = options->data; 253 gchar *value = strchr (options->data, '='); 254 *value = '\0'; 255 value++; 256 257 tny_camel_account_add_option (TNY_CAMEL_ACCOUNT (account), 258 tny_pair_new (key, value)); 259 255 260 g_free (options->data); 256 261 options = g_slist_next (options); trunk/libtinymail-gpe/tny-gpe-account-store.c
r3592 r3609 248 248 g_free (key); 249 249 250 if (options) 251 { 252 while (options) 253 { 254 tny_camel_account_add_option (TNY_CAMEL_ACCOUNT (account), options->data); 250 if (options) { 251 while (options) { 252 gchar *key = options->data; 253 gchar *value = strchr (options->data, '='); 254 *value = '\0'; 255 value++; 256 257 tny_camel_account_add_option (TNY_CAMEL_ACCOUNT (account), 258 tny_pair_new (key, value)); 255 259 g_free (options->data); 256 260 options = g_slist_next (options); trunk/libtinymail-maemo/tny-maemo-account-store.c
r3592 r3609 255 255 g_free (key); 256 256 257 if (options) 258 { 259 while (options) 260 { 261 tny_camel_account_add_option (TNY_CAMEL_ACCOUNT (account), options->data); 257 if (options) { 258 while (options) { 259 gchar *key = options->data; 260 gchar *value = strchr (options->data, '='); 261 *value = '\0'; 262 value++; 263 264 tny_camel_account_add_option (TNY_CAMEL_ACCOUNT (account), 265 tny_pair_new (key, value)); 262 266 g_free (options->data); 263 267 options = g_slist_next (options); trunk/libtinymail-olpc/tny-olpc-account-store.c
r3592 r3609 219 219 220 220 options = g_key_file_get_string_list (keyfile, "tinymail", "options", &options_len, NULL); 221 if (options) 222 { 223 for (i=0; i<options_len; i++) 224 tny_camel_account_add_option (TNY_CAMEL_ACCOUNT (account), options[i]); 221 if (options) { 222 for (i=0; i < options_len; i++) { 223 gchar *key = options[i]; 224 gchar *value = strchr (options[i], '='); 225 *value = '\0'; 226 value++; 227 tny_camel_account_add_option (TNY_CAMEL_ACCOUNT (account), 228 tny_pair_new (key, value)); 229 } 225 230 g_strfreev (options); 226 231 } trunk/tests/shared/account-store.c
r3422 r3609 66 66 67 67 static gboolean 68 tny_test_account_store_alert (TnyAccountStore *self, TnyAccount *account, TnyAlertType type, gboolean question, constGError *error)68 tny_test_account_store_alert (TnyAccountStore *self, TnyAccount *account, TnyAlertType type, gboolean question, GError *error) 69 69 { 70 70 return TRUE; … … 296 296 klass->alert= tny_test_account_store_alert; 297 297 klass->get_device= tny_test_account_store_get_device; 298 298 299 299 return; 300 300 }
