Changeset 2225
- Timestamp:
- 06/19/07 17:15:30
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-account-priv.h (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-account.c (modified) (3 diffs)
- trunk/libtinymail-camel/tny-camel-account.h (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-mime-part.c (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-store-account.c (modified) (5 diffs)
- trunk/libtinymail/tny-account.c (modified) (3 diffs)
- trunk/libtinymail/tny-account.h (modified) (4 diffs)
- trunk/libtinymail/tny-combined-account.c (modified) (3 diffs)
- trunk/libtinymail/tny-shared.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r2224 r2225 1 2007-06-19 Philip Van Hoof <pvanhoof@gnome.org> 2 3 * The connection_status_changed signal got extended a little bit 4 5 * This was a major API change 6 1 7 2007-06-19 Jose Dapena Paz <jdapena@igalia.com> 2 8 trunk/libtinymail-camel/tny-camel-account-priv.h
r2221 r2225 75 75 RefreshStatusInfo *csyncop; 76 76 GList *chooks; 77 TnyConnectionStatus status; 77 78 }; 78 79 trunk/libtinymail-camel/tny-camel-account.c
r2221 r2225 498 498 499 499 500 static gboolean501 tny_camel_account_ is_connected(TnyAccount *self)502 { 503 return TNY_CAMEL_ACCOUNT_GET_CLASS (self)-> is_connected_func (self);504 } 505 506 static gboolean507 tny_camel_account_ is_connected_default (TnyAccount *self)508 { 509 TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 510 return priv-> connected;500 static TnyConnectionStatus 501 tny_camel_account_get_connection_status (TnyAccount *self) 502 { 503 return TNY_CAMEL_ACCOUNT_GET_CLASS (self)->get_connection_status_func (self); 504 } 505 506 static TnyConnectionStatus 507 tny_camel_account_get_connection_status_default (TnyAccount *self) 508 { 509 TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 510 return priv->status; 511 511 } 512 512 … … 1180 1180 klass->set_id_func = tny_camel_account_set_id; 1181 1181 klass->get_id_func = tny_camel_account_get_id; 1182 klass-> is_connected_func = tny_camel_account_is_connected;1182 klass->get_connection_status_func = tny_camel_account_get_connection_status; 1183 1183 klass->set_url_string_func = tny_camel_account_set_url_string; 1184 1184 klass->get_url_string_func = tny_camel_account_get_url_string; … … 1218 1218 class->set_id_func = tny_camel_account_set_id_default; 1219 1219 class->get_id_func = tny_camel_account_get_id_default; 1220 class-> is_connected_func = tny_camel_account_is_connected_default;1220 class->get_connection_status_func = tny_camel_account_get_connection_status_default; 1221 1221 class->set_url_string_func = tny_camel_account_set_url_string_default; 1222 1222 class->get_url_string_func = tny_camel_account_get_url_string_default; trunk/libtinymail-camel/tny-camel-account.h
r2193 r2225 50 50 51 51 /* Virtual methods */ 52 gboolean (*is_connected_func)(TnyAccount *self);52 TnyConnectionStatus (*get_connection_status_func)(TnyAccount *self); 53 53 void (*set_id_func) (TnyAccount *self, const gchar *id); 54 54 void (*set_name_func) (TnyAccount *self, const gchar *name); trunk/libtinymail-camel/tny-camel-mime-part.c
r2214 r2225 22 22 #include <glib/gi18n-lib.h> 23 23 24 #include <string.h> 24 25 #ifndef _GNU_SOURCE 25 26 #define _GNU_SOURCE 26 27 #endif /* GNU_SOURCE*/ 27 28 28 #include <string.h> 29 29 30 #include <tny-mime-part.h> 30 31 #include <tny-camel-mime-part.h> trunk/libtinymail-camel/tny-camel-store-account.c
r2222 r2225 86 86 connection_status_idle (gpointer data) 87 87 { 88 g_signal_emit (data, tny_account_signals [TNY_ACCOUNT_CONNECTION_STATUS_CHANGED], 0); 88 TnyAccount *self = (TnyAccount *) data; 89 TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 90 91 g_signal_emit (G_OBJECT (self), 92 tny_account_signals [TNY_ACCOUNT_CONNECTION_STATUS_CHANGED], 93 0, apriv->status); 89 94 90 95 return FALSE; … … 115 120 disconnection (CamelService *service, gpointer data, TnyAccount *self) 116 121 { 122 TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 123 124 if (!service->reconnecting) 125 apriv->status = TNY_CONNECTION_STATUS_DISCONNECTED; 126 117 127 #ifdef DEBUG 118 128 g_print ("TNY_DEBUG: %s disconnected %s\n", … … 126 136 connection (CamelService *service, gpointer data, TnyAccount *self) 127 137 { 138 TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 139 gboolean suc = (gboolean) data; 140 141 if (!service->reconnecting) 142 { 143 if (suc) 144 apriv->status = TNY_CONNECTION_STATUS_CONNECTED; 145 else 146 apriv->status = TNY_CONNECTION_STATUS_CONNECTED_BROKEN; 147 } 148 149 if (service->reconnecting && !suc) 150 apriv->status = TNY_CONNECTION_STATUS_CONNECTED_BROKEN; 151 152 if (CAMEL_IS_DISCO_STORE (service)) 153 { 154 155 if (camel_disco_store_status ((CamelDiscoStore *) service) == CAMEL_DISCO_STORE_ONLINE) 156 { 128 157 #ifdef DEBUG 129 if (CAMEL_IS_DISCO_STORE (service))130 {131 gboolean suc = (gboolean) data;132 133 if (camel_disco_store_status ((CamelDiscoStore *) service) == CAMEL_DISCO_STORE_ONLINE)134 {135 158 g_print ("TNY_DEBUG: %s %s %s\n", 136 159 tny_account_get_name (self), 137 160 suc?"connected":"failed connecting", 138 161 service->reconnecting?"reconnecting":""); 162 #endif 163 164 if (suc) 165 apriv->status = TNY_CONNECTION_STATUS_CONNECTED; 166 else 167 apriv->status = TNY_CONNECTION_STATUS_CONNECTED_BROKEN; 168 139 169 } else { 170 171 #ifdef DEBUG 140 172 g_print ("TNY_DEBUG: %s %s\n", 141 173 tny_account_get_name (self), 142 174 suc?"ready for offline operation": 143 175 "not ready for offline operation"); 176 #endif 177 178 if (suc) 179 apriv->status = TNY_CONNECTION_STATUS_DISCONNECTED; 180 else 181 apriv->status = TNY_CONNECTION_STATUS_DISCONNECTED_BROKEN; 182 144 183 } 145 184 } 146 #endif147 185 } 148 186 … … 150 188 reconnection (CamelService *service, gpointer data, TnyAccount *self) 151 189 { 190 TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 191 gboolean suc = (gboolean) data; 192 193 if (suc) 194 apriv->status = TNY_CONNECTION_STATUS_CONNECTED; 195 else 196 apriv->status = TNY_CONNECTION_STATUS_CONNECTED_BROKEN; 197 152 198 #ifdef DEBUG 153 gboolean suc = (gboolean) data;154 199 155 200 g_print ("TNY_DEBUG: %s reconnecting %s\n", … … 162 207 reconnecting (CamelService *service, gpointer data, TnyAccount *self) 163 208 { 209 TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 210 211 apriv->status = TNY_CONNECTION_STATUS_RECONNECTING; 212 164 213 #ifdef DEBUG 165 214 g_print ("TNY_DEBUG: %s reconnecting\n", trunk/libtinymail/tny-account.c
r2193 r2225 179 179 180 180 /** 181 * tny_account_ is_connected:181 * tny_account_get_connection_status: 182 182 * @self: a #TnyAccount object 183 183 * 184 184 * Get the connection status of @self 185 185 * 186 * Return value: whether or not the account is connected187 **/ 188 gboolean189 tny_account_ is_connected(TnyAccount *self)190 { 191 gbooleanretval;192 193 #ifdef DBC /* require */ 194 g_assert (TNY_IS_ACCOUNT (self)); 195 g_assert (TNY_ACCOUNT_GET_IFACE (self)-> is_connected_func != NULL);196 #endif 197 198 retval = TNY_ACCOUNT_GET_IFACE (self)-> is_connected_func (self);186 * Return value: the status of the connection 187 **/ 188 TnyConnectionStatus 189 tny_account_get_connection_status (TnyAccount *self) 190 { 191 TnyConnectionStatus retval; 192 193 #ifdef DBC /* require */ 194 g_assert (TNY_IS_ACCOUNT (self)); 195 g_assert (TNY_ACCOUNT_GET_IFACE (self)->get_connection_status_func != NULL); 196 #endif 197 198 retval = TNY_ACCOUNT_GET_IFACE (self)->get_connection_status_func (self); 199 199 200 200 #ifdef DBC /* ensure */ … … 888 888 * TnyAccount::connection-status-changed 889 889 * @self: the object on which the signal is emitted 890 * @status: the #TnyConnectionStatus 890 891 * @user_data: user data set when the signal handler was connected. 891 892 * 892 * Emitted when the connection status of an account changes. You can get the 893 * connection status with the tny_account_is_connected API in the handler. 893 * Emitted when the connection status of an account changes. 894 894 **/ 895 895 tny_account_signals[TNY_ACCOUNT_CONNECTION_STATUS_CHANGED] = … … 899 899 G_STRUCT_OFFSET (TnyAccountIface, connection_status_changed), 900 900 NULL, NULL, 901 g_cclosure_marshal_VOID__ VOID,901 g_cclosure_marshal_VOID__INT, 902 902 G_TYPE_NONE, 0); 903 903 trunk/libtinymail/tny-account.h
r2196 r2225 40 40 typedef struct _TnyAccountIface TnyAccountIface; 41 41 typedef enum _TnyAccountSignal TnyAccountSignal; 42 typedef enum _TnyConnectionStatus TnyConnectionStatus; 42 43 #endif 44 45 enum _TnyConnectionStatus 46 { 47 TNY_CONNECTION_STATUS_DISCONNECTED, 48 TNY_CONNECTION_STATUS_DISCONNECTED_BROKEN, 49 TNY_CONNECTION_STATUS_CONNECTED_BROKEN, 50 TNY_CONNECTION_STATUS_CONNECTED, 51 TNY_CONNECTION_STATUS_RECONNECTING 52 }; 43 53 44 54 enum _TnyAccountType … … 62 72 63 73 /* Methods */ 64 gboolean (*is_connected_func)(TnyAccount *self);74 TnyConnectionStatus (*get_connection_status_func)(TnyAccount *self); 65 75 void (*set_id_func) (TnyAccount *self, const gchar *id); 66 76 void (*set_name_func) (TnyAccount *self, const gchar *name); … … 90 100 91 101 /* Signals*/ 92 void (*connection_status_changed) (TnyAccount *self );102 void (*connection_status_changed) (TnyAccount *self, TnyConnectionStatus status); 93 103 }; 94 104 … … 96 106 GType tny_account_type_get_type (void); 97 107 98 gboolean tny_account_is_connected(TnyAccount *self);108 TnyConnectionStatus tny_account_get_connection_status (TnyAccount *self); 99 109 void tny_account_set_id (TnyAccount *self, const gchar *id); 100 110 void tny_account_set_name (TnyAccount *self, const gchar *name); trunk/libtinymail/tny-combined-account.c
r1947 r2225 74 74 } 75 75 76 static gboolean77 tny_combined_account_ is_connected(TnyAccount *self)76 static TnyConnectionStatus 77 tny_combined_account_get_connection_status (TnyAccount *self) 78 78 { 79 79 TnyCombinedAccountPriv *priv = TNY_COMBINED_ACCOUNT_GET_PRIVATE (self); … … 81 81 g_warning ("Don't use tny_account_is_connected on TnyCombinedAccount"); 82 82 83 return tny_account_ is_connected(TNY_ACCOUNT (priv->store_account));83 return tny_account_get_connection_status (TNY_ACCOUNT (priv->store_account)); 84 84 } 85 85 … … 450 450 tny_account_init (TnyAccountIface *klass) 451 451 { 452 klass-> is_connected_func = tny_combined_account_is_connected;452 klass->get_connection_status_func = tny_combined_account_get_connection_status; 453 453 klass->set_id_func = tny_combined_account_set_id; 454 454 klass->set_name_func = tny_combined_account_set_name; trunk/libtinymail/tny-shared.h
r2026 r2225 121 121 typedef struct _TnyCombinedAccount TnyCombinedAccount; 122 122 typedef struct _TnyCombinedAccountClass TnyCombinedAccountClass; 123 typedef enum _TnyConnectionStatus TnyConnectionStatus; 123 124 124 125 G_END_DECLS
