Changeset 3118
- Timestamp:
- 12/13/07 23:37:34
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/libtinymail-camel/Makefile.am (modified) (2 diffs)
- trunk/libtinymail-camel/tny-camel-account-priv.h (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-account.c (modified) (6 diffs)
- trunk/libtinymail-camel/tny-camel-account.h (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-default-connection-strategy.c (added)
- trunk/libtinymail-camel/tny-camel-default-connection-strategy.h (added)
- trunk/libtinymail-camel/tny-camel-folder.c (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-store-account.c (modified) (3 diffs)
- trunk/libtinymail/Makefile.am (modified) (2 diffs)
- trunk/libtinymail/tny-account.c (modified) (1 diff)
- trunk/libtinymail/tny-account.h (modified) (3 diffs)
- trunk/libtinymail/tny-connection-strategy.c (added)
- trunk/libtinymail/tny-connection-strategy.h (added)
- trunk/libtinymail/tny-shared.h (modified) (1 diff)
- trunk/libtinymail/tny.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r3111 r3118 1 2007-12-13 Philip Van Hoof <pvanhoof@gnome.org> 2 3 * Added the TnyConnectionStrategy type for coping with connectivity 4 changes (for example sheduling a reconnect or asking the user what to 5 do about the event of a lost connection) 6 1 7 2007-12-13 Alberto Garcia Gonzalez <agarcia@igalia.com> 2 8 trunk/libtinymail-camel/Makefile.am
r3078 r3118 38 38 tny-camel-bs-msg.h \ 39 39 tny-camel-bs-mime-part.h \ 40 tny-camel-bs-msg-receive-strategy.h 40 tny-camel-bs-msg-receive-strategy.h \ 41 tny-camel-default-connection-strategy.h 41 42 42 43 libtinymail_camel_priv_headers = \ … … 93 94 tny-camel-bs-mime-part.c \ 94 95 tny-camel-bs-msg-receive-strategy.c \ 95 tny-camel-bs-msg-header.c 96 tny-camel-bs-msg-header.c \ 97 tny-camel-default-connection-strategy.c 96 98 97 99 libtinymail_camel_1_0_la_LIBADD = \ trunk/libtinymail-camel/tny-camel-account-priv.h
r2993 r3118 76 76 gchar *delete_this; 77 77 TnyCamelQueue *queue; 78 TnyConnectionStrategy *con_strat; 78 79 }; 79 80 trunk/libtinymail-camel/tny-camel-account.c
r3113 r3118 47 47 #include <tny-camel-shared.h> 48 48 #include <tny-status.h> 49 50 #include <tny-camel-default-connection-strategy.h> 49 51 50 52 #include "tny-session-camel-priv.h" … … 1368 1370 TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 1369 1371 1372 priv->con_strat = tny_camel_default_connection_strategy_new (); 1370 1373 priv->queue = _tny_camel_queue_new (self); 1371 1374 priv->delete_this = NULL; … … 1739 1742 1740 1743 1744 static TnyConnectionStrategy* 1745 tny_camel_account_get_connection_strategy (TnyAccount *self) 1746 { 1747 TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 1748 return TNY_CONNECTION_STRATEGY (g_object_ref (priv->con_strat)); 1749 } 1750 1751 static void 1752 tny_camel_account_set_connection_strategy (TnyAccount *self, TnyConnectionStrategy *strategy) 1753 { 1754 TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 1755 g_object_unref (priv->con_strat); 1756 priv->con_strat = TNY_CONNECTION_STRATEGY (g_object_ref (strategy)); 1757 return; 1758 } 1759 1760 1761 1741 1762 1742 1763 … … 1994 2015 g_free (priv->cancel_lock); 1995 2016 priv->cancel_lock = NULL; 1996 1997 2017 priv->inuse_spin = FALSE; 1998 2018 … … 2041 2061 2042 2062 g_object_unref (priv->queue); 2063 g_object_unref (priv->con_strat); 2043 2064 2044 2065 camel_exception_free (priv->ex); … … 2090 2111 klass->stop_operation_func = tny_camel_account_stop_operation; 2091 2112 klass->is_ready_func = tny_camel_account_is_ready; 2113 klass->set_connection_strategy_func = tny_camel_account_set_connection_strategy; 2114 klass->get_connection_strategy_func = tny_camel_account_get_connection_strategy; 2092 2115 2093 2116 return; trunk/libtinymail-camel/tny-camel-account.h
r2825 r3118 89 89 void (*stop_operation_func) (TnyAccount *self, gboolean *canceled); 90 90 91 92 91 void (*add_option_func) (TnyCamelAccount *self, const gchar *option); 93 92 void (*set_online_func) (TnyCamelAccount *self, gboolean online, TnyCamelSetOnlineCallback callback, gpointer user_data); trunk/libtinymail-camel/tny-camel-folder.c
r3106 r3118 2487 2487 nhdr = tny_msg_get_header (retval); 2488 2488 /* This trick is for forcing owning a TnyCamelHeader reference */ 2489 _tny_camel_msg_header_set_decorated ( nhdr, hdr, TRUE);2489 _tny_camel_msg_header_set_decorated ((TnyCamelMsgHeader *) nhdr, hdr, TRUE); 2490 2490 g_object_unref (nhdr); 2491 2491 } trunk/libtinymail-camel/tny-camel-store-account.c
r3113 r3118 203 203 } 204 204 205 static gboolean 206 constrat_notify_connect (gpointer user_data) 207 { 208 TnyAccount *self = (TnyAccount *) user_data; 209 TnyConnectionStrategy *strategy = tny_account_get_connection_strategy (self); 210 211 tny_connection_strategy_on_connect (strategy, self); 212 213 g_object_unref (strategy); 214 215 return FALSE; 216 } 217 218 219 static gboolean 220 constrat_notify_broken (gpointer user_data) 221 { 222 TnyAccount *self = (TnyAccount *) user_data; 223 TnyConnectionStrategy *strategy = tny_account_get_connection_strategy (self); 224 225 tny_connection_strategy_on_connection_broken (strategy, self); 226 227 g_object_unref (strategy); 228 229 return FALSE; 230 } 231 232 233 static gboolean 234 constrat_notify_disconnect (gpointer user_data) 235 { 236 TnyAccount *self = (TnyAccount *) user_data; 237 TnyConnectionStrategy *strategy = tny_account_get_connection_strategy (self); 238 239 tny_connection_strategy_on_disconnect (strategy, self); 240 241 g_object_unref (strategy); 242 243 return FALSE; 244 } 245 246 static void 247 constrat_notify_destroy (gpointer user_data) 248 { 249 g_object_unref (user_data); 250 } 205 251 206 252 static void … … 222 268 emit = TRUE; 223 269 apriv->status = TNY_CONNECTION_STATUS_DISCONNECTED; 270 271 272 g_idle_add_full (G_PRIORITY_HIGH, 273 constrat_notify_disconnect, 274 g_object_ref (self), 275 constrat_notify_destroy); 224 276 225 277 if (emit) … … 337 389 } 338 390 339 if (emit) 391 if (emit) { 340 392 tny_camel_store_account_do_emit (TNY_CAMEL_STORE_ACCOUNT (self)); 393 394 if (apriv->status == TNY_CONNECTION_STATUS_DISCONNECTED_BROKEN) 395 g_idle_add_full (G_PRIORITY_HIGH, 396 constrat_notify_broken, 397 g_object_ref (self), 398 constrat_notify_destroy); 399 else if (apriv->status == TNY_CONNECTION_STATUS_CONNECTED) 400 g_idle_add_full (G_PRIORITY_HIGH, 401 constrat_notify_connect, 402 g_object_ref (self), 403 constrat_notify_destroy); 404 else if (apriv->status == TNY_CONNECTION_STATUS_DISCONNECTED) 405 g_idle_add_full (G_PRIORITY_HIGH, 406 constrat_notify_disconnect, 407 g_object_ref (self), 408 constrat_notify_destroy); 409 } 341 410 342 411 } trunk/libtinymail/Makefile.am
r3082 r3118 49 49 tny-password-getter.h \ 50 50 tny-merge-folder.h \ 51 tny-combined-account.h 51 tny-combined-account.h \ 52 tny-connection-strategy.h 52 53 53 54 libtinymail_1_0_la_SOURCES = \ … … 92 93 tny-idle-stopper.c \ 93 94 tny-progress-info.c \ 95 tny-connection-strategy.c \ 94 96 $(private_headers) 95 97 trunk/libtinymail/tny-account.c
r2903 r3118 30 30 31 31 guint tny_account_signals [TNY_ACCOUNT_LAST_SIGNAL]; 32 33 34 /** 35 * tny_account_get_connection_strategy: 36 * @self: a #TnyAccount object 37 * 38 * Get the connection strategy for @self. You must unreference the returned 39 * value when you are finished with used it. 40 * 41 * Return value: connection strategy 42 **/ 43 TnyConnectionStrategy* 44 tny_account_get_connection_strategy (TnyAccount *self) 45 { 46 TnyConnectionStrategy *retval; 47 48 #ifdef DBC /* require */ 49 g_assert (TNY_IS_ACCOUNT (self)); 50 g_assert (TNY_ACCOUNT_GET_IFACE (self)->get_connection_strategy_func != NULL); 51 #endif 52 53 retval = TNY_ACCOUNT_GET_IFACE (self)->get_connection_strategy_func (self); 54 55 #ifdef DBC /* ensure*/ 56 g_assert (TNY_IS_CONNECTION_STRATEGY (retval)); 57 #endif 58 59 return retval; 60 } 61 62 /** 63 * tny_account_set_connection_strategy: 64 * @self: a #TnyAccount object 65 * @strategy: the #TnyConnectionStrategy 66 * 67 * Set the connection strategy for @self. 68 **/ 69 void 70 tny_account_set_connection_strategy (TnyAccount *self, TnyConnectionStrategy *strategy) 71 { 72 #ifdef DBC /* require */ 73 g_assert (TNY_IS_ACCOUNT (self)); 74 g_assert (TNY_IS_CONNECTION_STRATEGY (strategy)); 75 g_assert (TNY_ACCOUNT_GET_IFACE (self)->set_connection_strategy_func != NULL); 76 #endif 77 78 TNY_ACCOUNT_GET_IFACE (self)->set_connection_strategy_func (self, strategy); 79 80 #ifdef DBC /* ensure*/ 81 #endif 82 83 return; 84 } 32 85 33 86 trunk/libtinymail/tny-account.h
r3080 r3118 25 25 #include <tny-shared.h> 26 26 #include <tny-status.h> 27 #include <tny-connection-strategy.h> 27 28 28 29 G_BEGIN_DECLS … … 109 110 void (*stop_operation_func) (TnyAccount *self, gboolean *canceled); 110 111 gboolean (*is_ready_func) (TnyAccount *self); 112 TnyConnectionStrategy* (*get_connection_strategy_func) (TnyAccount *self); 113 void (*set_connection_strategy_func) (TnyAccount *self, TnyConnectionStrategy *strategy); 111 114 112 115 /* Signals*/ … … 147 150 void tny_account_stop_operation (TnyAccount *self, gboolean *canceled); 148 151 gboolean tny_account_is_ready (TnyAccount *self); 152 TnyConnectionStrategy* tny_account_get_connection_strategy (TnyAccount *self); 153 void tny_account_set_connection_strategy (TnyAccount *self, TnyConnectionStrategy *strategy); 149 154 150 155 trunk/libtinymail/tny-shared.h
r3106 r3118 101 101 typedef struct _TnyCombinedAccount TnyCombinedAccount; 102 102 typedef struct _TnyCombinedAccountClass TnyCombinedAccountClass; 103 typedef struct _TnyConnectionStrategy TnyConnectionStrategy; 104 typedef struct _TnyConnectionStrategyIface TnyConnectionStrategyIface; 103 105 104 106 typedef gchar* (*TnyGetPassFunc) (TnyAccount *self, const gchar *prompt, gboolean *cancel); trunk/libtinymail/tny.h
r3086 r3118 36 36 #include <tny-stream.h> 37 37 #include <tny-transport-account.h> 38 #include <tny-connection-strategy.h> 38 39 39 40 #endif
