Changeset 3125
- Timestamp:
- 12/14/07 02:33:49
- 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) (4 diffs)
- trunk/libtinymail-camel/tny-camel-default-connection-policy.c (moved) (moved from trunk/libtinymail-camel/tny-camel-default-connection-strategy.c) (10 diffs)
- trunk/libtinymail-camel/tny-camel-default-connection-policy.h (moved) (moved from trunk/libtinymail-camel/tny-camel-default-connection-strategy.h) (3 diffs)
- trunk/libtinymail-camel/tny-camel-folder.c (modified) (5 diffs)
- trunk/libtinymail-camel/tny-camel-recover-connection-policy.c (moved) (moved from trunk/libtinymail-camel/tny-camel-recover-connection-strategy.c) (15 diffs)
- trunk/libtinymail-camel/tny-camel-recover-connection-policy.h (moved) (moved from trunk/libtinymail-camel/tny-camel-recover-connection-strategy.h) (3 diffs)
- 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-policy.c (moved) (moved from trunk/libtinymail/tny-connection-strategy.c) (12 diffs)
- trunk/libtinymail/tny-connection-policy.h (moved) (moved from trunk/libtinymail/tny-connection-strategy.h) (2 diffs)
- trunk/libtinymail/tny-shared.h (modified) (1 diff)
- trunk/libtinymail/tny.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r3119 r3125 1 1 2007-12-13 Philip Van Hoof <pvanhoof@gnome.org> 2 2 3 * Added the TnyConnection Strategy type for coping with connectivity3 * Added the TnyConnectionPolicy type for coping with connectivity 4 4 changes (for example sheduling a reconnect or asking the user what to 5 5 do about the event of a lost connection) 6 * Added two connection strategies. One that retries every five seconds6 * Added two connection policies. One that retries every five seconds 7 7 to reconnect, and recovers the state (the selected folder) 8 8 trunk/libtinymail-camel/Makefile.am
r3119 r3125 39 39 tny-camel-bs-mime-part.h \ 40 40 tny-camel-bs-msg-receive-strategy.h \ 41 tny-camel-default-connection- strategy.h \42 tny-camel-recover-connection- strategy.h41 tny-camel-default-connection-policy.h \ 42 tny-camel-recover-connection-policy.h 43 43 44 44 libtinymail_camel_priv_headers = \ … … 96 96 tny-camel-bs-msg-receive-strategy.c \ 97 97 tny-camel-bs-msg-header.c \ 98 tny-camel-default-connection- strategy.c \99 tny-camel-recover-connection- strategy.c98 tny-camel-default-connection-policy.c \ 99 tny-camel-recover-connection-policy.c 100 100 101 101 libtinymail_camel_1_0_la_LIBADD = \ trunk/libtinymail-camel/tny-camel-account-priv.h
r3119 r3125 76 76 gchar *delete_this; 77 77 TnyCamelQueue *queue; 78 TnyConnection Strategy *con_strat;78 TnyConnectionPolicy *con_strat; 79 79 }; 80 80 trunk/libtinymail-camel/tny-camel-account.c
r3119 r3125 48 48 #include <tny-status.h> 49 49 50 #include <tny-camel-default-connection- strategy.h>50 #include <tny-camel-default-connection-policy.h> 51 51 52 52 #include "tny-session-camel-priv.h" … … 1371 1371 1372 1372 priv->retry_connect = FALSE; 1373 priv->con_strat = tny_camel_default_connection_ strategy_new ();1373 priv->con_strat = tny_camel_default_connection_policy_new (); 1374 1374 priv->queue = _tny_camel_queue_new (self); 1375 1375 priv->delete_this = NULL; … … 1744 1744 1745 1745 1746 static TnyConnection Strategy*1747 tny_camel_account_get_connection_ strategy (TnyAccount *self)1748 { 1749 TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 1750 return TNY_CONNECTION_ STRATEGY (g_object_ref (priv->con_strat));1746 static TnyConnectionPolicy* 1747 tny_camel_account_get_connection_policy (TnyAccount *self) 1748 { 1749 TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 1750 return TNY_CONNECTION_POLICY (g_object_ref (priv->con_strat)); 1751 1751 } 1752 1752 1753 1753 static void 1754 tny_camel_account_set_connection_ strategy (TnyAccount *self, TnyConnectionStrategy *strategy)1754 tny_camel_account_set_connection_policy (TnyAccount *self, TnyConnectionPolicy *policy) 1755 1755 { 1756 1756 TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 1757 1757 g_object_unref (priv->con_strat); 1758 priv->con_strat = TNY_CONNECTION_ STRATEGY (g_object_ref (strategy));1758 priv->con_strat = TNY_CONNECTION_POLICY (g_object_ref (policy)); 1759 1759 return; 1760 1760 } … … 2113 2113 klass->stop_operation_func = tny_camel_account_stop_operation; 2114 2114 klass->is_ready_func = tny_camel_account_is_ready; 2115 klass->set_connection_ strategy_func = tny_camel_account_set_connection_strategy;2116 klass->get_connection_ strategy_func = tny_camel_account_get_connection_strategy;2115 klass->set_connection_policy_func = tny_camel_account_set_connection_policy; 2116 klass->get_connection_policy_func = tny_camel_account_get_connection_policy; 2117 2117 2118 2118 return; trunk/libtinymail-camel/tny-camel-default-connection-policy.c
r3119 r3125 5 5 #include <glib/gi18n-lib.h> 6 6 7 #include <tny-camel-default-connection- strategy.h>7 #include <tny-camel-default-connection-policy.h> 8 8 9 9 static GObjectClass *parent_class = NULL; 10 10 11 11 static void 12 tny_camel_default_connection_ strategy_set_current (TnyConnectionStrategy *self, TnyAccount *account, TnyFolder *folder)12 tny_camel_default_connection_policy_set_current (TnyConnectionPolicy *self, TnyAccount *account, TnyFolder *folder) 13 13 { 14 14 return; … … 16 16 17 17 static void 18 tny_camel_default_connection_ strategy_on_connect (TnyConnectionStrategy *self, TnyAccount *account)18 tny_camel_default_connection_policy_on_connect (TnyConnectionPolicy *self, TnyAccount *account) 19 19 { 20 20 return; … … 22 22 23 23 static void 24 tny_camel_default_connection_ strategy_on_connection_broken (TnyConnectionStrategy *self, TnyAccount *account)24 tny_camel_default_connection_policy_on_connection_broken (TnyConnectionPolicy *self, TnyAccount *account) 25 25 { 26 26 return; … … 28 28 29 29 static void 30 tny_camel_default_connection_ strategy_on_disconnect (TnyConnectionStrategy *self, TnyAccount *account)30 tny_camel_default_connection_policy_on_disconnect (TnyConnectionPolicy *self, TnyAccount *account) 31 31 { 32 32 return; … … 34 34 35 35 static void 36 tny_camel_default_connection_ strategy_finalize (GObject *object)36 tny_camel_default_connection_policy_finalize (GObject *object) 37 37 { 38 38 parent_class->finalize (object); … … 40 40 41 41 static void 42 tny_camel_default_connection_ strategy_instance_init (GTypeInstance *instance, gpointer g_class)42 tny_camel_default_connection_policy_instance_init (GTypeInstance *instance, gpointer g_class) 43 43 { 44 44 } 45 45 46 46 static void 47 tny_connection_ strategy_init (TnyConnectionStrategyIface *klass)47 tny_connection_policy_init (TnyConnectionPolicyIface *klass) 48 48 { 49 klass->on_connect_func = tny_camel_default_connection_ strategy_on_connect;50 klass->on_connection_broken_func = tny_camel_default_connection_ strategy_on_connection_broken;51 klass->on_disconnect_func = tny_camel_default_connection_ strategy_on_disconnect;52 klass->set_current_func = tny_camel_default_connection_ strategy_set_current;49 klass->on_connect_func = tny_camel_default_connection_policy_on_connect; 50 klass->on_connection_broken_func = tny_camel_default_connection_policy_on_connection_broken; 51 klass->on_disconnect_func = tny_camel_default_connection_policy_on_disconnect; 52 klass->set_current_func = tny_camel_default_connection_policy_set_current; 53 53 } 54 54 55 55 static void 56 tny_camel_default_connection_ strategy_class_init (TnyCamelDefaultConnectionStrategyClass *klass)56 tny_camel_default_connection_policy_class_init (TnyCamelDefaultConnectionPolicyClass *klass) 57 57 { 58 58 GObjectClass *object_class; … … 60 60 parent_class = g_type_class_peek_parent (klass); 61 61 object_class = (GObjectClass*) klass; 62 object_class->finalize = tny_camel_default_connection_ strategy_finalize;62 object_class->finalize = tny_camel_default_connection_policy_finalize; 63 63 } 64 64 … … 66 66 67 67 /** 68 * tny_camel_default_connection_ strategy_new:68 * tny_camel_default_connection_policy_new: 69 69 * 70 * A connection strategy that does nothing special70 * A connection policy that does nothing special 71 71 * 72 * Return value: A new #TnyConnection Strategy instance72 * Return value: A new #TnyConnectionPolicy instance 73 73 **/ 74 TnyConnection Strategy*75 tny_camel_default_connection_ strategy_new (void)74 TnyConnectionPolicy* 75 tny_camel_default_connection_policy_new (void) 76 76 { 77 return TNY_CONNECTION_ STRATEGY (g_object_new (TNY_TYPE_CAMEL_DEFAULT_CONNECTION_STRATEGY, NULL));77 return TNY_CONNECTION_POLICY (g_object_new (TNY_TYPE_CAMEL_DEFAULT_CONNECTION_POLICY, NULL)); 78 78 } 79 79 80 80 GType 81 tny_camel_default_connection_ strategy_get_type (void)81 tny_camel_default_connection_policy_get_type (void) 82 82 { 83 83 static GType type = 0; … … 86 86 static const GTypeInfo info = 87 87 { 88 sizeof (TnyCamelDefaultConnection StrategyClass),88 sizeof (TnyCamelDefaultConnectionPolicyClass), 89 89 NULL, /* base_init */ 90 90 NULL, /* base_finalize */ 91 (GClassInitFunc) tny_camel_default_connection_ strategy_class_init, /* class_init */91 (GClassInitFunc) tny_camel_default_connection_policy_class_init, /* class_init */ 92 92 NULL, /* class_finalize */ 93 93 NULL, /* class_data */ 94 sizeof (TnyCamelDefaultConnection Strategy),94 sizeof (TnyCamelDefaultConnectionPolicy), 95 95 0, /* n_preallocs */ 96 tny_camel_default_connection_ strategy_instance_init, /* instance_init */96 tny_camel_default_connection_policy_instance_init, /* instance_init */ 97 97 NULL 98 98 }; 99 99 100 100 101 static const GInterfaceInfo tny_connection_ strategy_info =101 static const GInterfaceInfo tny_connection_policy_info = 102 102 { 103 (GInterfaceInitFunc) tny_connection_ strategy_init, /* interface_init */103 (GInterfaceInitFunc) tny_connection_policy_init, /* interface_init */ 104 104 NULL, /* interface_finalize */ 105 105 NULL /* interface_data */ … … 107 107 108 108 type = g_type_register_static (G_TYPE_OBJECT, 109 "TnyCamelDefaultConnection Strategy",109 "TnyCamelDefaultConnectionPolicy", 110 110 &info, 0); 111 111 112 g_type_add_interface_static (type, TNY_TYPE_CONNECTION_ STRATEGY,113 &tny_connection_ strategy_info);112 g_type_add_interface_static (type, TNY_TYPE_CONNECTION_POLICY, 113 &tny_connection_policy_info); 114 114 115 115 } trunk/libtinymail-camel/tny-camel-default-connection-policy.h
r3118 r3125 1 #ifndef TNY_CAMEL_DEFAULT_CONNECTION_ STRATEGY_H2 #define TNY_CAMEL_DEFAULT_CONNECTION_ STRATEGY_H1 #ifndef TNY_CAMEL_DEFAULT_CONNECTION_POLICY_H 2 #define TNY_CAMEL_DEFAULT_CONNECTION_POLICY_H 3 3 4 4 /* libtinymail-camel - The Tiny Mail base library for Camel … … 23 23 #include <glib-object.h> 24 24 25 #include <tny-connection- strategy.h>25 #include <tny-connection-policy.h> 26 26 27 27 G_BEGIN_DECLS 28 28 29 #define TNY_TYPE_CAMEL_DEFAULT_CONNECTION_ STRATEGY (tny_camel_default_connection_strategy_get_type ())30 #define TNY_CAMEL_DEFAULT_CONNECTION_ STRATEGY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TNY_TYPE_CAMEL_DEFAULT_CONNECTION_STRATEGY, TnyCamelDefaultConnectionStrategy))31 #define TNY_CAMEL_DEFAULT_CONNECTION_ STRATEGY_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), TNY_TYPE_CAMEL_DEFAULT_CONNECTION_STRATEGY, TnyCamelDefaultConnectionStrategyClass))32 #define TNY_IS_CAMEL_DEFAULT_CONNECTION_ STRATEGY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TNY_TYPE_CAMEL_DEFAULT_CONNECTION_STRATEGY))33 #define TNY_IS_CAMEL_DEFAULT_CONNECTION_ STRATEGY_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), TNY_TYPE_CAMEL_DEFAULT_CONNECTION_STRATEGY))34 #define TNY_CAMEL_DEFAULT_CONNECTION_ STRATEGY_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), TNY_TYPE_CAMEL_DEFAULT_CONNECTION_STRATEGY, TnyCamelDefaultConnectionStrategyClass))29 #define TNY_TYPE_CAMEL_DEFAULT_CONNECTION_POLICY (tny_camel_default_connection_policy_get_type ()) 30 #define TNY_CAMEL_DEFAULT_CONNECTION_POLICY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TNY_TYPE_CAMEL_DEFAULT_CONNECTION_POLICY, TnyCamelDefaultConnectionPolicy)) 31 #define TNY_CAMEL_DEFAULT_CONNECTION_POLICY_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), TNY_TYPE_CAMEL_DEFAULT_CONNECTION_POLICY, TnyCamelDefaultConnectionPolicyClass)) 32 #define TNY_IS_CAMEL_DEFAULT_CONNECTION_POLICY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TNY_TYPE_CAMEL_DEFAULT_CONNECTION_POLICY)) 33 #define TNY_IS_CAMEL_DEFAULT_CONNECTION_POLICY_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), TNY_TYPE_CAMEL_DEFAULT_CONNECTION_POLICY)) 34 #define TNY_CAMEL_DEFAULT_CONNECTION_POLICY_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), TNY_TYPE_CAMEL_DEFAULT_CONNECTION_POLICY, TnyCamelDefaultConnectionPolicyClass)) 35 35 36 typedef struct _TnyCamelDefaultConnection Strategy TnyCamelDefaultConnectionStrategy;37 typedef struct _TnyCamelDefaultConnection StrategyClass TnyCamelDefaultConnectionStrategyClass;36 typedef struct _TnyCamelDefaultConnectionPolicy TnyCamelDefaultConnectionPolicy; 37 typedef struct _TnyCamelDefaultConnectionPolicyClass TnyCamelDefaultConnectionPolicyClass; 38 38 39 struct _TnyCamelDefaultConnection Strategy39 struct _TnyCamelDefaultConnectionPolicy 40 40 { 41 41 GObject parent; … … 43 43 }; 44 44 45 struct _TnyCamelDefaultConnection StrategyClass45 struct _TnyCamelDefaultConnectionPolicyClass 46 46 { 47 47 GObjectClass parent_class; 48 48 }; 49 49 50 GType tny_camel_default_connection_ strategy_get_type (void);51 TnyConnection Strategy* tny_camel_default_connection_strategy_new (void);50 GType tny_camel_default_connection_policy_get_type (void); 51 TnyConnectionPolicy* tny_camel_default_connection_policy_new (void); 52 52 53 53 G_END_DECLS trunk/libtinymail-camel/tny-camel-folder.c
r3119 r3125 48 48 #include <tny-simple-list.h> 49 49 #include <tny-merge-folder.h> 50 #include <tny-connection- strategy.h>50 #include <tny-connection-policy.h> 51 51 52 52 … … 1641 1641 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 1642 1642 TnyFolderChange *change = tny_folder_change_new (self); 1643 TnyConnection Strategy *constrat;1643 TnyConnectionPolicy *constrat; 1644 1644 1645 1645 tny_folder_change_set_new_all_count (change, priv->cached_length); … … 1654 1654 } 1655 1655 1656 constrat = tny_account_get_connection_ strategy (priv->account);1657 tny_connection_ strategy_set_current (constrat, priv->account, self);1656 constrat = tny_account_get_connection_policy (priv->account); 1657 tny_connection_policy_set_current (constrat, priv->account, self); 1658 1658 g_object_unref (constrat); 1659 1659 … … 1837 1837 guint oldlen, oldurlen; 1838 1838 TnyFolderChange *change = NULL; 1839 TnyConnection Strategy *constrat;1839 TnyConnectionPolicy *constrat; 1840 1840 1841 1841 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), … … 1882 1882 g_object_unref (change); 1883 1883 1884 constrat = tny_account_get_connection_ strategy (priv->account);1885 tny_connection_ strategy_set_current (constrat, priv->account, self);1884 constrat = tny_account_get_connection_policy (priv->account); 1885 tny_connection_policy_set_current (constrat, priv->account, self); 1886 1886 g_object_unref (constrat); 1887 1887 trunk/libtinymail-camel/tny-camel-recover-connection-policy.c
r3124 r3125 7 7 #include <tny-folder.h> 8 8 9 #include <tny-camel-recover-connection- strategy.h>9 #include <tny-camel-recover-connection-policy.h> 10 10 #include <tny-camel-account.h> 11 11 … … 13 13 14 14 15 typedef struct _TnyCamelRecoverConnection StrategyPriv TnyCamelRecoverConnectionStrategyPriv;16 17 struct _TnyCamelRecoverConnection StrategyPriv15 typedef struct _TnyCamelRecoverConnectionPolicyPriv TnyCamelRecoverConnectionPolicyPriv; 16 17 struct _TnyCamelRecoverConnectionPolicyPriv 18 18 { 19 19 TnyFolder *folder; … … 22 22 }; 23 23 24 #define TNY_CAMEL_RECOVER_CONNECTION_ STRATEGY_GET_PRIVATE(o) \25 (G_TYPE_INSTANCE_GET_PRIVATE ((o), TNY_TYPE_CAMEL_RECOVER_CONNECTION_ STRATEGY, TnyCamelRecoverConnectionStrategyPriv))26 27 28 static void 29 tny_camel_recover_connection_ strategy_on_connect (TnyConnectionStrategy *self, TnyAccount *account)30 { 31 TnyCamelRecoverConnection StrategyPriv *priv = TNY_CAMEL_RECOVER_CONNECTION_STRATEGY_GET_PRIVATE (self);24 #define TNY_CAMEL_RECOVER_CONNECTION_POLICY_GET_PRIVATE(o) \ 25 (G_TYPE_INSTANCE_GET_PRIVATE ((o), TNY_TYPE_CAMEL_RECOVER_CONNECTION_POLICY, TnyCamelRecoverConnectionPolicyPriv)) 26 27 28 static void 29 tny_camel_recover_connection_policy_on_connect (TnyConnectionPolicy *self, TnyAccount *account) 30 { 31 TnyCamelRecoverConnectionPolicyPriv *priv = TNY_CAMEL_RECOVER_CONNECTION_POLICY_GET_PRIVATE (self); 32 32 33 33 if (priv->folder && priv->recover && priv->recov_folder) … … 55 55 56 56 /** 57 * tny_camel_recover_connection_ strategy_set_recover_active_folder:58 * @self: a #TnyCamelRecoverConnection Strategy instance57 * tny_camel_recover_connection_policy_set_recover_active_folder: 58 * @self: a #TnyCamelRecoverConnectionPolicy instance 59 59 * @setting: whether to recover the active folder 60 60 * … … 65 65 **/ 66 66 void 67 tny_camel_recover_connection_ strategy_set_recover_active_folder (TnyCamelRecoverConnectionStrategy *self, gboolean setting)68 { 69 TnyCamelRecoverConnection StrategyPriv *priv = TNY_CAMEL_RECOVER_CONNECTION_STRATEGY_GET_PRIVATE (self);67 tny_camel_recover_connection_policy_set_recover_active_folder (TnyCamelRecoverConnectionPolicy *self, gboolean setting) 68 { 69 TnyCamelRecoverConnectionPolicyPriv *priv = TNY_CAMEL_RECOVER_CONNECTION_POLICY_GET_PRIVATE (self); 70 70 priv->recov_folder = setting; 71 71 } … … 73 73 74 74 /** 75 * tny_camel_recover_connection_ strategy_set_reconnect_delay:76 * @self: a #TnyCamelRecoverConnection Strategy instance75 * tny_camel_recover_connection_policy_set_reconnect_delay: 76 * @self: a #TnyCamelRecoverConnectionPolicy instance 77 77 * @milliseconds: delay before a reconnect attempt happens, use -1 to disable 78 78 * … … 81 81 **/ 82 82 void 83 tny_camel_recover_connection_ strategy_set_reconnect_delay (TnyCamelRecoverConnectionStrategy *self, gint milliseconds)84 { 85 TnyCamelRecoverConnection StrategyPriv *priv = TNY_CAMEL_RECOVER_CONNECTION_STRATEGY_GET_PRIVATE (self);83 tny_camel_recover_connection_policy_set_reconnect_delay (TnyCamelRecoverConnectionPolicy *self, gint milliseconds) 84 { 85 TnyCamelRecoverConnectionPolicyPriv *priv = TNY_CAMEL_RECOVER_CONNECTION_POLICY_GET_PRIVATE (self); 86 86 priv->recon_delay = milliseconds; 87 87 } 88 88 89 89 static void 90 tny_camel_recover_connection_ strategy_on_connection_broken (TnyConnectionStrategy *self, TnyAccount *account)91 { 92 TnyCamelRecoverConnection StrategyPriv *priv = TNY_CAMEL_RECOVER_CONNECTION_STRATEGY_GET_PRIVATE (self);90 tny_camel_recover_connection_policy_on_connection_broken (TnyConnectionPolicy *self, TnyAccount *account) 91 { 92 TnyCamelRecoverConnectionPolicyPriv *priv = TNY_CAMEL_RECOVER_CONNECTION_POLICY_GET_PRIVATE (self); 93 93 94 94 priv->recover = TRUE; … … 102 102 103 103 static void 104 tny_camel_recover_connection_ strategy_on_disconnect (TnyConnectionStrategy *self, TnyAccount *account)104 tny_camel_recover_connection_policy_on_disconnect (TnyConnectionPolicy *self, TnyAccount *account) 105 105 { 106 106 return; … … 110 110 notify_folder_del (gpointer user_data, GObject *account) 111 111 { 112 TnyCamelRecoverConnection StrategyPriv *priv = TNY_CAMEL_RECOVER_CONNECTION_STRATEGY_GET_PRIVATE (user_data);112 TnyCamelRecoverConnectionPolicyPriv *priv = TNY_CAMEL_RECOVER_CONNECTION_POLICY_GET_PRIVATE (user_data); 113 113 priv->folder = NULL; 114 114 } 115 115 116 116 static void 117 tny_camel_recover_connection_ strategy_set_current (TnyConnectionStrategy *self, TnyAccount *account, TnyFolder *folder)118 { 119 TnyCamelRecoverConnection StrategyPriv *priv = TNY_CAMEL_RECOVER_CONNECTION_STRATEGY_GET_PRIVATE (self);117 tny_camel_recover_connection_policy_set_current (TnyConnectionPolicy *self, TnyAccount *account, TnyFolder *folder) 118 { 119 TnyCamelRecoverConnectionPolicyPriv *priv = TNY_CAMEL_RECOVER_CONNECTION_POLICY_GET_PRIVATE (self); 120 120 if (priv->folder) 121 121 g_object_weak_unref (G_OBJECT (priv->folder), notify_folder_del, self); … … 125 125 126 126 static void 127 tny_camel_recover_connection_ strategy_finalize (GObject *object)128 { 129 TnyCamelRecoverConnection StrategyPriv *priv = TNY_CAMEL_RECOVER_CONNECTION_STRATEGY_GET_PRIVATE (object);127 tny_camel_recover_connection_policy_finalize (GObject *object) 128 { 129 TnyCamelRecoverConnectionPolicyPriv *priv = TNY_CAMEL_RECOVER_CONNECTION_POLICY_GET_PRIVATE (object); 130 130 131 131 if (priv->folder) … … 136 136 137 137 static void 138 tny_camel_recover_connection_ strategy_instance_init (GTypeInstance *instance, gpointer g_class)139 { 140 TnyCamelRecoverConnection StrategyPriv *priv = TNY_CAMEL_RECOVER_CONNECTION_STRATEGY_GET_PRIVATE (instance);138 tny_camel_recover_connection_policy_instance_init (GTypeInstance *instance, gpointer g_class) 139 { 140 TnyCamelRecoverConnectionPolicyPriv *priv = TNY_CAMEL_RECOVER_CONNECTION_POLICY_GET_PRIVATE (instance); 141 141 priv->folder = NULL; 142 142 priv->recover = FALSE; … … 146 146 147 147 static void 148 tny_connection_ strategy_init (TnyConnectionStrategyIface *klass)149 { 150 klass->on_connect_func = tny_camel_recover_connection_ strategy_on_connect;151 klass->on_connection_broken_func = tny_camel_recover_connection_ strategy_on_connection_broken;152 klass->on_disconnect_func = tny_camel_recover_connection_ strategy_on_disconnect;153 klass->set_current_func = tny_camel_recover_connection_ strategy_set_current;154 } 155 156 static void 157 tny_camel_recover_connection_ strategy_class_init (TnyCamelRecoverConnectionStrategyClass *klass)148 tny_connection_policy_init (TnyConnectionPolicyIface *klass) 149 { 150 klass->on_connect_func = tny_camel_recover_connection_policy_on_connect; 151 klass->on_connection_broken_func = tny_camel_recover_connection_policy_on_connection_broken; 152 klass->on_disconnect_func = tny_camel_recover_connection_policy_on_disconnect; 153 klass->set_current_func = tny_camel_recover_connection_policy_set_current; 154 } 155 156 static void 157 tny_camel_recover_connection_policy_class_init (TnyCamelRecoverConnectionPolicyClass *klass) 158 158 { 159 159 GObjectClass *object_class; … … 161 161 parent_class = g_type_class_peek_parent (klass); 162 162 object_class = (GObjectClass*) klass; 163 object_class->finalize = tny_camel_recover_connection_ strategy_finalize;164 165 g_type_class_add_private (object_class, sizeof (TnyCamelRecoverConnection StrategyPriv));163 object_class->finalize = tny_camel_recover_connection_policy_finalize; 164 165 g_type_class_add_private (object_class, sizeof (TnyCamelRecoverConnectionPolicyPriv)); 166 166 167 167 } 168 168 169 169 /** 170 * tny_camel_recover_connection_ strategy_new:170 * tny_camel_recover_connection_policy_new: 171 171 * 172 * A connection strategy that tries to camel_recover the connection and the currently172 * A connection policy that tries to camel_recover the connection and the currently 173 173 * selected folder. 174 174 * 175 * Return value: A new #TnyConnection Strategy instance175 * Return value: A new #TnyConnectionPolicy instance 176 176 **/ 177 TnyConnection Strategy*178 tny_camel_recover_connection_ strategy_new (void)179 { 180 return TNY_CONNECTION_ STRATEGY (g_object_new (TNY_TYPE_CAMEL_RECOVER_CONNECTION_STRATEGY, NULL));177 TnyConnectionPolicy* 178 tny_camel_recover_connection_policy_new (void) 179 { 180 return TNY_CONNECTION_POLICY (g_object_new (TNY_TYPE_CAMEL_RECOVER_CONNECTION_POLICY, NULL)); 181 181 } 182 182 183 183 184 184 GType 185 tny_camel_recover_connection_ strategy_get_type (void)185 tny_camel_recover_connection_policy_get_type (void) 186 186 { 187 187 static GType type = 0; … … 190 190 static const GTypeInfo info = 191 191 { 192 sizeof (TnyCamelRecoverConnection StrategyClass),192 sizeof (TnyCamelRecoverConnectionPolicyClass), 193 193 NULL, /* base_init */ 194 194 NULL, /* base_finalize */ 195 (GClassInitFunc) tny_camel_recover_connection_ strategy_class_init, /* class_init */195 (GClassInitFunc) tny_camel_recover_connection_policy_class_init, /* class_init */ 196 196 NULL, /* class_finalize */ 197 197 NULL, /* class_data */ 198 sizeof (TnyCamelRecoverConnection Strategy),198 sizeof (TnyCamelRecoverConnectionPolicy), 199 199 0, /* n_preallocs */ 200 tny_camel_recover_connection_ strategy_instance_init, /* instance_init */200 tny_camel_recover_connection_policy_instance_init, /* instance_init */ 201 201 NULL 202 202 }; 203 203 204 204 205 static const GInterfaceInfo tny_connection_ strategy_info =205 static const GInterfaceInfo tny_connection_policy_info = 206 206 { 207 (GInterfaceInitFunc) tny_connection_ strategy_init, /* interface_init */207 (GInterfaceInitFunc) tny_connection_policy_init, /* interface_init */ 208 208 NULL, /* interface_finalize */ 209 209 NULL /* interface_data */ … … 211 211 212 212 type = g_type_register_static (G_TYPE_OBJECT, 213 "TnyCamelRecoverConnection Strategy",213 "TnyCamelRecoverConnectionPolicy", 214 214 &info, 0); 215 215 216 g_type_add_interface_static (type, TNY_TYPE_CONNECTION_ STRATEGY,217 &tny_connection_ strategy_info);216 g_type_add_interface_static (type, TNY_TYPE_CONNECTION_POLICY, 217 &tny_connection_policy_info); 218 218 219 219 } trunk/libtinymail-camel/tny-camel-recover-connection-policy.h
r3121 r3125 1 #ifndef TNY_CAMEL_RECOVER_CONNECTION_ STRATEGY_H2 #define TNY_CAMEL_RECOVER_CONNECTION_ STRATEGY_H1 #ifndef TNY_CAMEL_RECOVER_CONNECTION_POLICY_H 2 #define TNY_CAMEL_RECOVER_CONNECTION_POLICY_H 3 3 4 4 /* libtinymail - The Tiny Mail base library … … 23 23 #include <glib-object.h> 24 24 25 #include <tny-connection- strategy.h>25 #include <tny-connection-policy.h> 26 26 27 27 G_BEGIN_DECLS 28 28 29 #define TNY_TYPE_CAMEL_RECOVER_CONNECTION_ STRATEGY (tny_camel_recover_connection_strategy_get_type ())30 #define TNY_CAMEL_RECOVER_CONNECTION_ STRATEGY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TNY_TYPE_CAMEL_RECOVER_CONNECTION_STRATEGY, TnyCamelRecoverConnectionStrategy))31 #define TNY_CAMEL_RECOVER_CONNECTION_ STRATEGY_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), TNY_TYPE_CAMEL_RECOVER_CONNECTION_STRATEGY, TnyCamelRecoverConnectionStrategyClass))32 #define TNY_IS_CAMEL_RECOVER_CONNECTION_ STRATEGY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TNY_TYPE_CAMEL_RECOVER_CONNECTION_STRATEGY))33 #define TNY_IS_CAMEL_RECOVER_CONNECTION_ STRATEGY_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), TNY_TYPE_CAMEL_RECOVER_CONNECTION_STRATEGY))34 #define TNY_CAMEL_RECOVER_CONNECTION_ STRATEGY_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), TNY_TYPE_CAMEL_RECOVER_CONNECTION_STRATEGY, TnyCamelRecoverConnectionStrategyClass))29 #define TNY_TYPE_CAMEL_RECOVER_CONNECTION_POLICY (tny_camel_recover_connection_policy_get_type ()) 30 #define TNY_CAMEL_RECOVER_CONNECTION_POLICY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TNY_TYPE_CAMEL_RECOVER_CONNECTION_POLICY, TnyCamelRecoverConnectionPolicy)) 31 #define TNY_CAMEL_RECOVER_CONNECTION_POLICY_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), TNY_TYPE_CAMEL_RECOVER_CONNECTION_POLICY, TnyCamelRecoverConnectionPolicyClass)) 32 #define TNY_IS_CAMEL_RECOVER_CONNECTION_POLICY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TNY_TYPE_CAMEL_RECOVER_CONNECTION_POLICY)) 33 #define TNY_IS_CAMEL_RECOVER_CONNECTION_POLICY_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), TNY_TYPE_CAMEL_RECOVER_CONNECTION_POLICY)) 34 #define TNY_CAMEL_RECOVER_CONNECTION_POLICY_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), TNY_TYPE_CAMEL_RECOVER_CONNECTION_POLICY, TnyCamelRecoverConnectionPolicyClass)) 35 35 36 typedef struct _TnyCamelRecoverConnection Strategy TnyCamelRecoverConnectionStrategy;37 typedef struct _TnyCamelRecoverConnection StrategyClass TnyCamelRecoverConnectionStrategyClass;36 typedef struct _TnyCamelRecoverConnectionPolicy TnyCamelRecoverConnectionPolicy; 37 typedef struct _TnyCamelRecoverConnectionPolicyClass TnyCamelRecoverConnectionPolicyClass; 38 38 39 struct _TnyCamelRecoverConnection Strategy39 struct _TnyCamelRecoverConnectionPolicy 40 40 { 41 41 GObject parent; … … 43 43 }; 44 44 45 struct _TnyCamelRecoverConnection StrategyClass45 struct _TnyCamelRecoverConnectionPolicyClass 46 46 { 47 47 GObjectClass parent_class; 48 48 }; 49 49 50 GType tny_camel_recover_connection_ strategy_get_type (void);51 TnyConnection Strategy* tny_camel_recover_connection_strategy_new (void);50 GType tny_camel_recover_connection_policy_get_type (void); 51 TnyConnectionPolicy* tny_camel_recover_connection_policy_new (void); 52 52 53 void tny_camel_recover_connection_ strategy_set_reconnect_delay (TnyCamelRecoverConnectionStrategy *self, gint milliseconds);54 void tny_camel_recover_connection_ strategy_set_recover_active_folder (TnyCamelRecoverConnectionStrategy *self, gboolean setting);53 void tny_camel_recover_connection_policy_set_reconnect_delay (TnyCamelRecoverConnectionPolicy *self, gint milliseconds); 54 void tny_camel_recover_connection_policy_set_recover_active_folder (TnyCamelRecoverConnectionPolicy *self, gboolean setting); 55 55 56 56 G_END_DECLS trunk/libtinymail-camel/tny-camel-store-account.c
r3119 r3125 207 207 { 208 208 TnyAccount *self = (TnyAccount *) user_data; 209 TnyConnection Strategy *strategy = tny_account_get_connection_strategy (self);210 211 tny_connection_ strategy_on_connect (strategy, self);209 TnyConnectionPolicy *strategy = tny_account_get_connection_policy (self); 210 211 tny_connection_policy_on_connect (strategy, self); 212 212 213 213 g_object_unref (strategy); … … 221 221 { 222 222 TnyAccount *self = (TnyAccount *) user_data; 223 TnyConnection Strategy *strategy = tny_account_get_connection_strategy (self);224 225 tny_connection_ strategy_on_connection_broken (strategy, self);223 TnyConnectionPolicy *strategy = tny_account_get_connection_policy (self); 224 225 tny_connection_policy_on_connection_broken (strategy, self); 226 226 227 227 g_object_unref (strategy); … … 235 235 { 236 236 TnyAccount *self = (TnyAccount *) user_data; 237 TnyConnection Strategy *strategy = tny_account_get_connection_strategy (self);238 239 tny_connection_ strategy_on_disconnect (strategy, self);237 TnyConnectionPolicy *strategy = tny_account_get_connection_policy (self); 238 239 tny_connection_policy_on_disconnect (strategy, self); 240 240 241 241 g_object_unref (strategy); trunk/libtinymail/Makefile.am
r3118 r3125 50 50 tny-merge-folder.h \ 51 51 tny-combined-account.h \ 52 tny-connection- strategy.h52 tny-connection-policy.h 53 53 54 54 libtinymail_1_0_la_SOURCES = \ … … 93 93 tny-idle-stopper.c \ 94 94 tny-progress-info.c \ 95 tny-connection- strategy.c \95 tny-connection-policy.c \ 96 96 $(private_headers) 97 97 trunk/libtinymail/tny-account.c
r3118 r3125 33 33 34 34 /** 35 * tny_account_get_connection_ strategy:36 * @self: a #TnyAccount object 37 * 38 * Get the connection strategy for @self. You must unreference the returned35 * tny_account_get_connection_policy: 36 * @self: a #TnyAccount object 37 * 38 * Get the connection policy for @self. You must unreference the returned 39 39 * value when you are finished with used it. 40 40 * 41 * Return value: connection strategy42 **/ 43 TnyConnection Strategy*44 tny_account_get_connection_ strategy (TnyAccount *self)45 { 46 TnyConnection Strategy *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);41 * Return value: connection policy 42 **/ 43 TnyConnectionPolicy* 44 tny_account_get_connection_policy (TnyAccount *self) 45 { 46 TnyConnectionPolicy *retval; 47 48 #ifdef DBC /* require */ 49 g_assert (TNY_IS_ACCOUNT (self)); 50 g_assert (TNY_ACCOUNT_GET_IFACE (self)->get_connection_policy_func != NULL); 51 #endif 52 53 retval = TNY_ACCOUNT_GET_IFACE (self)->get_connection_policy_func (self); 54 54 55 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 #TnyConnectionStrategy56 g_assert (TNY_IS_CONNECTION_POLICY (retval)); 57 #endif 58 59 return retval; 60 } 61 62 /** 63 * tny_account_set_connection_policy: 64 * @self: a #TnyAccount object 65 * @policy: the #TnyConnectionStrategy 66 66 * 67 67 * Set the connection strategy for @self. 68 68 **/ 69 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);70 tny_account_set_connection_policy (TnyAccount *self, TnyConnectionPolicy *policy) 71 { 72 #ifdef DBC /* require */ 73 g_assert (TNY_IS_ACCOUNT (self)); 74 g_assert (TNY_IS_CONNECTION_POLICY (policy)); 75 g_assert (TNY_ACCOUNT_GET_IFACE (self)->set_connection_policy_func != NULL); 76 #endif 77 78 TNY_ACCOUNT_GET_IFACE (self)->set_connection_policy_func (self, policy); 79 79 80 80 #ifdef DBC /* ensure*/ trunk/libtinymail/tny-account.h
r3118 r3125 25 25 #include <tny-shared.h> 26 26 #include <tny-status.h> 27 #include <tny-connection- strategy.h>27 #include <tny-connection-policy.h> 28 28 29 29 G_BEGIN_DECLS … … 110 110 void (*stop_operation_func) (TnyAccount *self, gboolean *canceled); 111 111 gboolean (*is_ready_func) (TnyAccount *self); 112 TnyConnection Strategy* (*get_connection_strategy_func) (TnyAccount *self);113 void (*set_connection_ strategy_func) (TnyAccount *self, TnyConnectionStrategy *strategy);112 TnyConnectionPolicy* (*get_connection_policy_func) (TnyAccount *self); 113 void (*set_connection_policy_func) (TnyAccount *self, TnyConnectionPolicy *policy); 114 114 115 115 /* Signals*/ … … 150 150 void tny_account_stop_operation (TnyAccount *self, gboolean *canceled); 151 151 gboolean tny_account_is_ready (TnyAccount *self); 152 TnyConnection Strategy* tny_account_get_connection_strategy (TnyAccount *self);153 void tny_account_set_connection_ strategy (TnyAccount *self, TnyConnectionStrategy *strategy);152 TnyConnectionPolicy* tny_account_get_connection_policy (TnyAccount *self); 153 void tny_account_set_connection_policy (TnyAccount *self, TnyConnectionPolicy *policy); 154 154 155 155 trunk/libtinymail/tny-connection-policy.c
r3119 r3125 21 21 #include <tny-account.h> 22 22 #include <tny-folder.h> 23 #include <tny-connection- strategy.h>23 #include <tny-connection-policy.h> 24 24 #include <tny-list.h> 25 25 26 26 27 27 /** 28 * tny_connection_ strategy_set_current:29 * @self: A #TnyConnection Strategy instance28 * tny_connection_policy_set_current: 29 * @self: A #TnyConnectionPolicy instance 30 30 * @account: the current #TnyAccount instance 31 31 * @folder: the current #TnyFolder instance … … 35 35 **/ 36 36 void 37 tny_connection_ strategy_set_current (TnyConnectionStrategy *self, TnyAccount *account, TnyFolder *folder)37 tny_connection_policy_set_current (TnyConnectionPolicy *self, TnyAccount *account, TnyFolder *folder) 38 38 { 39 39 #ifdef DBC /* require */ 40 g_assert (TNY_IS_CONNECTION_ STRATEGY (self));40 g_assert (TNY_IS_CONNECTION_POLICY (self)); 41 41 g_assert (TNY_IS_ACCOUNT (account)); 42 42 g_assert (TNY_IS_FOLDER (folder)); 43 43 44 g_assert (TNY_CONNECTION_ STRATEGY_GET_IFACE (self)->set_current_func != NULL);44 g_assert (TNY_CONNECTION_POLICY_GET_IFACE (self)->set_current_func != NULL); 45 45 #endif 46 46 47 TNY_CONNECTION_ STRATEGY_GET_IFACE (self)->set_current_func (self, account, folder);47 TNY_CONNECTION_POLICY_GET_IFACE (self)->set_current_func (self, account, folder); 48 48 49 49
