Changeset 1884
- Timestamp:
- 05/04/07 10:42:29
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/libtinymail-camel/tny-camel-folder-priv.h (modified) (3 diffs)
- trunk/libtinymail-camel/tny-camel-folder.c (modified) (27 diffs)
- trunk/libtinymail-camel/tny-camel-header.c (modified) (2 diffs)
- trunk/libtinymail-queues/tny-get-msg-queue-priv.h (modified) (1 diff)
- trunk/libtinymail-queues/tny-get-msg-queue.c (modified) (8 diffs)
- trunk/libtinymail-queues/tny-get-msg-queue.h (modified) (2 diffs)
- trunk/libtinymail/tny-enums.h (modified) (1 diff)
- trunk/libtinymail/tny-status.c (modified) (2 diffs)
- trunk/libtinymail/tny-status.h (modified) (2 diffs)
- trunk/tests/c-demo/Makefile.am (modified) (2 diffs)
- trunk/tests/c-demo/tny-demoui-summary-view.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r1882 r1884 1 2007-05-04 Philip Van Hoof <pvanhoof@gnome.org> 2 3 * Massive changes to TnyGetMsgQueue (unfinished, experimental) 4 * Fix for urgent ticket #43 5 1 6 2007-05-03 Sergio Villar Senin <svillar@igalia.com> 2 7 * tests/functional/folder-lister-async.c: Fixed a build error in the trunk/libtinymail-camel/tny-camel-folder-priv.h
r1760 r1884 33 33 GType headers_list_type; 34 34 guint folder_changed_id; 35 guint headers_managed; 35 guint reason_to_live; 36 GMutex *reason_lock; 36 37 GStaticRecMutex *folder_lock, *obs_lock; 37 38 CamelFolder *folder; … … 58 59 void _tny_camel_folder_set_name (TnyCamelFolder *self, const gchar *name); 59 60 void _tny_camel_folder_set_folder_type (TnyCamelFolder *folder, CamelFolderInfo *folder_info); 60 void _tny_camel_folder_check_uncache (TnyCamelFolder *self, TnyCamelFolderPriv *priv);61 61 void _tny_camel_folder_set_iter (TnyCamelFolder *folder, CamelFolderInfo *iter); 62 62 void _tny_camel_folder_set_account (TnyCamelFolder *self, TnyAccount *account); … … 69 69 void _tny_camel_folder_set_all_count (TnyCamelFolder *self, guint len); 70 70 void _tny_camel_folder_check_unread_count (TnyCamelFolder *self); 71 72 void _tny_camel_folder_unreason (TnyCamelFolderPriv *priv); 73 void _tny_camel_folder_reason (TnyCamelFolderPriv *priv); 71 74 72 75 #define TNY_CAMEL_FOLDER_GET_PRIVATE(o) \ trunk/libtinymail-camel/tny-camel-folder.c
r1879 r1884 718 718 RefreshFolderInfo *info = thr_user_data; 719 719 TnyFolder *self = info->self; 720 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 721 722 _tny_camel_folder_unreason (priv); 720 723 721 724 /* thread reference */ … … 762 765 { 763 766 ProgressInfo *info = data; 767 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->minfo->self); 764 768 765 769 /* gidle reference */ 770 _tny_camel_folder_unreason (priv); 766 771 g_object_unref (G_OBJECT (info->minfo->self)); 767 772 g_free (info->what); … … 813 818 RefreshFolderInfo *oinfo = thr_user_data; 814 819 ProgressInfo *info = g_slice_new (ProgressInfo); 820 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (oinfo->self); 815 821 816 822 /* Camel will shredder what and thr_user_data, so we need to copy it */ … … 838 844 /* gidle reference */ 839 845 g_object_ref (G_OBJECT (info->minfo->self)); 846 _tny_camel_folder_reason (priv); 840 847 841 848 if (oinfo->depth > 0) … … 916 923 tny_camel_folder_refresh_async_destroyer (info); 917 924 } 918 } else /* Thread reference */925 } else { /* Thread reference */ 919 926 g_object_unref (G_OBJECT (self)); 920 927 _tny_camel_folder_unreason (priv); 928 929 } 921 930 g_thread_exit (NULL); 922 931 … … 972 981 /* thread reference */ 973 982 g_object_ref (G_OBJECT (self)); 983 _tny_camel_folder_reason (priv); 974 984 975 985 thread = g_thread_create (tny_camel_folder_refresh_async_thread, 976 986 info, FALSE, NULL); 977 987 978 979 988 return; 980 989 } … … 1170 1179 GetMsgInfo *info = (GetMsgInfo *) thr_user_data; 1171 1180 TnyFolderChange *change; 1181 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->self); 1172 1182 1173 1183 if (info->msg) … … 1182 1192 1183 1193 /* thread reference */ 1194 _tny_camel_folder_unreason (priv); 1184 1195 g_object_unref (G_OBJECT (info->self)); 1185 1196 … … 1208 1219 { 1209 1220 GetMsgInfo *info = (GetMsgInfo *) thr_user_data; 1221 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->self); 1210 1222 GError *err = NULL; 1211 1223 … … 1234 1246 tny_camel_folder_get_msg_async_destroyer (info); 1235 1247 } 1236 } else /* thread reference */ 1248 } else {/* thread reference */ 1249 _tny_camel_folder_unreason (priv); 1237 1250 g_object_unref (G_OBJECT (info->self)); 1251 } 1238 1252 1239 1253 g_thread_exit (NULL); … … 1310 1324 1311 1325 /* thread reference */ 1326 _tny_camel_folder_reason (priv); 1312 1327 g_object_ref (G_OBJECT (info->self)); 1313 1328 g_object_ref (G_OBJECT (info->header)); … … 1800 1815 { 1801 1816 TransferMsgsInfo *info = thr_user_data; 1817 TnyCamelFolderPriv *priv_src = TNY_CAMEL_FOLDER_GET_PRIVATE (info->self); 1818 TnyCamelFolderPriv *priv_dst = TNY_CAMEL_FOLDER_GET_PRIVATE (info->folder_dst); 1802 1819 1803 1820 inform_observers_about_transfer (info->self, info->folder_dst, info->delete_originals, … … 1805 1822 1806 1823 /* thread reference */ 1824 _tny_camel_folder_unreason (priv_src); 1807 1825 g_object_unref (G_OBJECT (info->self)); 1808 1826 g_object_unref (G_OBJECT (info->header_list)); 1827 _tny_camel_folder_unreason (priv_dst); 1809 1828 g_object_unref (G_OBJECT (info->folder_dst)); 1810 1829 … … 1976 1995 } else { 1977 1996 /* thread reference (TNY TODO: inform observer?) */ 1997 _tny_camel_folder_unreason (priv_src); 1978 1998 g_object_unref (G_OBJECT (info->self)); 1979 1999 g_object_unref (G_OBJECT (info->header_list)); 2000 _tny_camel_folder_unreason (priv_dst); 1980 2001 g_object_unref (G_OBJECT (info->folder_dst)); 1981 2002 } … … 2000 2021 GError *err = NULL; 2001 2022 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 2023 TnyCamelFolderPriv *priv_src = priv; 2024 TnyCamelFolderPriv *priv_dst = TNY_CAMEL_FOLDER_GET_PRIVATE (folder_dst); 2002 2025 2003 2026 if (!_tny_session_check_operation (TNY_FOLDER_PRIV_GET_SESSION(priv), &err, … … 2022 2045 /* thread reference */ 2023 2046 g_object_ref (G_OBJECT (info->header_list)); 2047 _tny_camel_folder_reason (priv_src); 2024 2048 g_object_ref (G_OBJECT (info->self)); 2049 _tny_camel_folder_reason (priv_dst); 2025 2050 g_object_ref (G_OBJECT (info->folder_dst)); 2026 2051 … … 2249 2274 { 2250 2275 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 2251 GError *err = NULL;2252 2276 2253 2277 if (G_LIKELY (priv->folder != NULL)) … … 2257 2281 } 2258 2282 2259 2260 2283 void 2261 _tny_camel_folder_check_uncache (TnyCamelFolder *self, TnyCamelFolderPriv *priv) 2262 { 2263 if (priv->headers_managed == 0) 2264 tny_camel_folder_uncache (self); 2265 } 2266 2284 _tny_camel_folder_unreason (TnyCamelFolderPriv *priv) 2285 { 2286 g_mutex_lock (priv->reason_lock); 2287 priv->reason_to_live--; 2288 if (priv->reason_to_live == 0) 2289 tny_camel_folder_uncache ((TnyCamelFolder *)priv->self); 2290 g_mutex_unlock (priv->reason_lock); 2291 } 2292 2293 void 2294 _tny_camel_folder_reason (TnyCamelFolderPriv *priv) 2295 { 2296 g_mutex_lock (priv->reason_lock); 2297 priv->reason_to_live++; 2298 g_mutex_unlock (priv->reason_lock); 2299 } 2267 2300 2268 2301 static TnyMsgRemoveStrategy* … … 2654 2687 { 2655 2688 GetFoldersInfo *info = thr_user_data; 2689 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->self); 2656 2690 2657 2691 /* thread reference */ 2692 _tny_camel_folder_unreason (priv); 2658 2693 g_object_unref (G_OBJECT (info->self)); 2659 2694 g_object_unref (G_OBJECT (info->list)); … … 2684 2719 { 2685 2720 GetFoldersInfo *info = (GetFoldersInfo*) thr_user_data; 2721 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (info->self); 2722 2686 2723 GError *err = NULL; 2687 2724 … … 2711 2748 } else { 2712 2749 /* thread reference */ 2750 _tny_camel_folder_unreason (priv); 2713 2751 g_object_unref (G_OBJECT (info->self)); 2714 2752 g_object_unref (G_OBJECT (info->list)); … … 2753 2791 2754 2792 /* thread reference */ 2793 _tny_camel_folder_reason (priv); 2755 2794 g_object_ref (G_OBJECT (info->self)); 2756 2795 g_object_ref (G_OBJECT (info->list)); … … 2841 2880 } 2842 2881 2882 /* _tny_camel_folder_unreason (priv); */ 2883 2843 2884 return FALSE; 2844 2885 } … … 2855 2896 TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 2856 2897 GObject *info = g_object_ref (G_OBJECT (self)); 2898 2899 /* _tny_camel_folder_reason (priv); */ 2857 2900 2858 2901 if (g_main_depth () > 0) … … 3130 3173 priv->obs_lock = NULL; 3131 3174 3175 g_mutex_free (priv->reason_lock); 3132 3176 3133 3177 if (priv->folder_name) … … 3267 3311 priv->iter = NULL; 3268 3312 priv->iter_parented = FALSE; 3269 priv-> headers_managed= 0;3313 priv->reason_to_live = 0; 3270 3314 priv->loaded = FALSE; 3271 3315 priv->folder_changed_id = 0; … … 3275 3319 priv->remove_strat = tny_camel_msg_remove_strategy_new (); 3276 3320 priv->receive_strat = tny_camel_full_msg_receive_strategy_new (); 3321 priv->reason_lock = g_mutex_new (); 3277 3322 3278 3323 priv->folder_lock = g_new0 (GStaticRecMutex, 1); trunk/libtinymail-camel/tny-camel-header.c
r1866 r1884 301 301 { 302 302 TnyCamelFolderPriv *fpriv = TNY_CAMEL_FOLDER_GET_PRIVATE (self->folder); 303 fpriv->headers_managed--; 304 _tny_camel_folder_check_uncache (((TnyCamelFolder*)self->folder), fpriv); 303 _tny_camel_folder_unreason (fpriv); 305 304 } 306 305 … … 325 324 { 326 325 TnyCamelHeader *me = TNY_CAMEL_HEADER (self); 327 fpriv->headers_managed++;326 _tny_camel_folder_reason (fpriv); 328 327 me->folder = (TnyCamelFolder*) folder; 329 328 trunk/libtinymail-queues/tny-get-msg-queue-priv.h
r1816 r1884 27 27 OAsyncWorker *queue; 28 28 GMutex *lock; 29 guint total; 29 30 }; 30 31 trunk/libtinymail-queues/tny-get-msg-queue.c
r1822 r1884 22 22 #include <glib/gi18n-lib.h> 23 23 24 #include <tny-status.h> 25 #include <tny-simple-list.h> 26 #include <tny-msg.h> 27 #include <tny-folder.h> 28 #include <tny-folder-observer.h> 29 24 30 #include <tny-get-msg-queue.h> 25 31 #include <oasyncworker/oasyncworker.h> 26 32 27 33 static GObjectClass *parent_class = NULL; 34 static GObjectClass *int_parent_class = NULL; 28 35 29 36 #include "tny-get-msg-queue-priv.h" 37 30 38 31 39 typedef struct { … … 35 43 TnyStatusCallback status_callback; 36 44 gpointer user_data; 45 guint i; 37 46 GError *err; 38 47 } GetMsgInfo; … … 44 53 TnyMsg *retval = NULL; 45 54 GetMsgInfo *info = (GetMsgInfo *) arguments; 55 TnyGetMsgQueuePriv *priv = TNY_GET_MSG_QUEUE_GET_PRIVATE (info->self); 46 56 TnyFolder *folder; 47 57 48 58 info->err = NULL; 49 59 60 g_print ("Getting message (%d of %d): %s\n", info->i, priv->total, 61 tny_header_get_subject (info->header)); 50 62 folder = tny_header_get_folder (info->header); 63 64 if (info->status_callback) { 65 66 TnyStatus *status = tny_status_new (TNY_GET_MSG_QUEUE_STATUS, 67 TNY_GET_MSG_QUEUE_STATUS_GET_MSG, 68 info->i, priv->total, "Receiving message"); 69 70 /* This could also be the status of the message retrieval itself, 71 * rather than the status of the queue receiving messages. */ 72 73 info->status_callback (G_OBJECT (info->self), status, info->user_data); 74 75 tny_status_free (status); 76 } 77 51 78 retval = tny_folder_get_msg (folder, info->header, &info->err); 52 79 … … 60 87 { 61 88 GetMsgInfo *info = o_async_worker_task_get_arguments (task); 89 TnyGetMsgQueuePriv *priv = TNY_GET_MSG_QUEUE_GET_PRIVATE (info->self); 62 90 TnyMsg *msg = (TnyMsg *) func_result; 63 91 TnyFolder *folder; … … 106 134 GetMsgInfo *info = g_slice_new (GetMsgInfo); 107 135 136 priv->total++; 137 info->i = priv->total; 108 138 info->self = TNY_GET_MSG_QUEUE (g_object_ref (self)); 109 139 info->header = TNY_HEADER (g_object_ref (header)); … … 122 152 } 123 153 154 typedef struct { 155 GObject parent; 156 TnyGetMsgQueue *queue; 157 TnyGetMsgCallback callback; 158 TnyStatusCallback status_callback; 159 gpointer user_data; 160 } IntFolderMonitor; 161 162 typedef struct { 163 GObjectClass parent; 164 } IntFolderMonitorClass; 165 166 167 static void 168 get_messages (TnyGetMsgQueue *self, TnyList *list, TnyGetMsgCallback callback, TnyStatusCallback status_callback, gpointer user_data) 169 { 170 TnyIterator *iter; 171 iter = tny_list_create_iterator (list); 172 while (!tny_iterator_is_done (iter)) 173 { 174 GError *err = NULL; 175 TnyHeader *header = TNY_HEADER (tny_iterator_get_current (iter)); 176 177 tny_get_msg_queue_get_msg (self, header, callback, status_callback, user_data); 178 179 g_object_unref (G_OBJECT (header)); 180 tny_iterator_next (iter); 181 } 182 g_object_unref (G_OBJECT (iter)); 183 } 184 185 static void 186 int_folder_monitor_update (TnyFolderObserver *self, TnyFolderChange *change) 187 { 188 TnyFolderChangeChanged changed; 189 IntFolderMonitor *mon = (IntFolderMonitor *) self; 190 191 g_object_ref (self); 192 193 changed = tny_folder_change_get_changed (change); 194 195 if (changed & TNY_FOLDER_CHANGE_CHANGED_ADDED_HEADERS) 196 { 197 TnyList *list = tny_simple_list_new (); 198 tny_folder_change_get_added_headers (change, list); 199 get_messages (mon->queue, list, mon->callback, mon->status_callback, mon->user_data); 200 g_object_unref (G_OBJECT (list)); 201 } 202 203 g_object_unref (self); 204 205 return; 206 } 207 208 static void 209 int_folder_monitor_instance_init (GTypeInstance *instance, gpointer g_class) { } 210 static void 211 int_folder_monitor_finalize (GObject *object) { 212 IntFolderMonitor *self = (IntFolderMonitor *) object; 213 g_object_unref (self->queue); 214 int_parent_class->finalize (object); 215 } 216 static void 217 int_tny_folder_observer_init (TnyFolderObserverIface *klass) { 218 klass->update_func = int_folder_monitor_update; 219 } 220 static void 221 int_folder_monitor_class_init (TnyFolderMonitorClass *klass) { 222 GObjectClass *object_class; 223 int_parent_class = g_type_class_peek_parent (klass); 224 object_class = (GObjectClass*) klass; 225 object_class->finalize = int_folder_monitor_finalize; 226 } 227 static GType 228 int_folder_monitor_get_type (void) 229 { 230 static GType type = 0; 231 if (G_UNLIKELY(type == 0)) { 232 static const GTypeInfo info = { sizeof (IntFolderMonitorClass), 233 NULL, NULL, (GClassInitFunc) int_folder_monitor_class_init, 234 NULL, NULL, sizeof (IntFolderMonitor), 0, 235 int_folder_monitor_instance_init, NULL }; 236 static const GInterfaceInfo tny_folder_observer_info = { 237 (GInterfaceInitFunc) int_tny_folder_observer_init, 238 NULL, NULL }; 239 type = g_type_register_static (G_TYPE_OBJECT, 240 "IntFolderMonitor", &info, 0); 241 g_type_add_interface_static (type, TNY_TYPE_FOLDER_OBSERVER, 242 &tny_folder_observer_info); } 243 return type; 244 } 245 246 static void 247 refresh_done (TnyFolder *folder, gboolean cancelled, GError **err, gpointer user_data) 248 { 249 IntFolderMonitor *mon = user_data; 250 tny_folder_remove_observer (folder, TNY_FOLDER_OBSERVER (mon)); 251 g_object_unref (mon); 252 } 253 static void 254 status_update (GObject *sender, TnyStatus *status, gpointer user_data) { } 255 256 static void 257 tny_get_msg_queue_full_msg_retrieval_default (TnyGetMsgQueue *self, TnyFolder *folder, TnyList *headers, TnyGetMsgCallback callback, TnyStatusCallback status_callback, gpointer user_data) 258 { 259 TnyList *list = NULL; 260 261 if (headers) 262 list = g_object_ref (headers); 263 else { 264 265 IntFolderMonitor *mon = g_object_new (int_folder_monitor_get_type (), NULL); 266 267 mon->queue = TNY_GET_MSG_QUEUE (g_object_ref (self)); 268 mon->callback = callback; 269 mon->status_callback = status_callback; 270 mon->user_data = user_data; 271 272 tny_folder_add_observer (folder, TNY_FOLDER_OBSERVER (mon)); 273 tny_folder_refresh_async (folder, refresh_done, status_update, 274 g_object_ref (mon)); 275 276 list = tny_simple_list_new (); 277 tny_folder_get_headers (folder, list, FALSE, NULL); 278 279 g_object_unref (mon); 280 } 281 282 get_messages (self, list, callback, status_callback, user_data); 283 284 g_object_unref (G_OBJECT (list)); 285 286 } 287 288 /** 289 * tny_get_msg_queue_full_msg_retrieval: 290 * @self: a #TnyGetMsgQueue object 291 * @folder: a #TnyFolder object 292 * @headers: a #TnyList with #TnyHeader instances or NULL 293 * @callback: The callback handler 294 * @status_callback: The status_callback handler 295 * @user_data: user data for the callback 296 * 297 * Queue getting full messages of @folder. If @headers is NULL, all messages 298 * will be retrieved while getting the summary. 299 * 300 **/ 301 void 302 tny_get_msg_queue_full_msg_retrieval (TnyGetMsgQueue *self, TnyFolder *folder, TnyList *headers, TnyGetMsgCallback callback, TnyStatusCallback status_callback, gpointer user_data) 303 { 304 TNY_GET_MSG_QUEUE_GET_CLASS (self)->full_msg_retrieval_func (self, folder, headers, callback, status_callback, user_data); 305 return; 306 } 307 124 308 /** 125 309 * tny_get_msg_queue_new: … … 158 342 159 343 priv->lock = g_mutex_new (); 160 344 priv->total = 0; 161 345 g_mutex_lock (priv->lock); 162 346 priv->queue = o_async_worker_new (); … … 175 359 176 360 klass->get_msg_func = tny_get_msg_queue_get_msg_default; 361 klass->full_msg_retrieval_func = tny_get_msg_queue_full_msg_retrieval_default; 177 362 178 363 object_class->finalize = tny_get_msg_queue_finalize; trunk/libtinymail-queues/tny-get-msg-queue.h
r1822 r1884 48 48 /* virtual methods */ 49 49 void (*get_msg_func) (TnyGetMsgQueue *self, TnyHeader *header, TnyGetMsgCallback callback, TnyStatusCallback status_callback, gpointer user_data); 50 void (*full_msg_retrieval_func) (TnyGetMsgQueue *self, TnyFolder *folder, TnyList *headers, TnyGetMsgCallback callback, TnyStatusCallback status_callback, gpointer user_data); 50 51 }; 51 52 … … 54 55 55 56 void tny_get_msg_queue_get_msg (TnyGetMsgQueue *self, TnyHeader *header, TnyGetMsgCallback callback, TnyStatusCallback status_callback, gpointer user_data); 57 void tny_get_msg_queue_full_msg_retrieval (TnyGetMsgQueue *self, TnyFolder *folder, TnyList *headers, TnyGetMsgCallback callback, TnyStatusCallback status_callback, gpointer user_data); 56 58 57 59 trunk/libtinymail/tny-enums.h
r1862 r1884 9 9 { 10 10 TNY_FOLDER_STATUS_CODE_REFRESH = 1, 11 TNY_FOLDER_STATUS_CODE_GET_MSG = 2 11 TNY_FOLDER_STATUS_CODE_GET_MSG = 2, 12 TNY_GET_MSG_QUEUE_STATUS_GET_MSG = 3 12 13 } TnyStatusCode; 13 14 14 15 typedef enum 15 16 { 16 TNY_FOLDER_STATUS = 1 17 TNY_FOLDER_STATUS = 1, 18 TNY_GET_MSG_QUEUE_STATUS = 2 17 19 } TnyStatusDomain; 18 20 trunk/libtinymail/tny-status.c
r1866 r1884 35 35 if (etype == 0) { 36 36 static const GEnumValue values[] = { 37 { TNY_FOLDER_STATUS, "TNY_FOLDER_STTUS", "folder_status" }, 37 { TNY_FOLDER_STATUS, "TNY_FOLDER_STATUS", "folder_status" }, 38 { TNY_GET_MSG_QUEUE_STATUS, "TNY_GET_MSG_QUEUE_STATUS", "get_msg_queue_status" }, 39 38 40 { 0, NULL, NULL } 39 41 }; … … 59 61 { TNY_FOLDER_STATUS_CODE_REFRESH, "TNY_FOLDER_STATUS_CODE_REFRESH", "folder_status_code_refresh" }, 60 62 { TNY_FOLDER_STATUS_CODE_GET_MSG, "TNY_FOLDER_STATUS_CODE_GET_MSG", "folder_status_code_get_msg" }, 63 { TNY_GET_MSG_QUEUE_STATUS_GET_MSG, "TNY_GET_MSG_QUEUE_STATUS_GET_MSG", "get_msg_queue_status_get_msg" }, 61 64 { 0, NULL, NULL } 62 65 }; trunk/libtinymail/tny-status.h
r1830 r1884 33 33 enum _TnyStatusDomain 34 34 { 35 TNY_FOLDER_STATUS = 1 35 TNY_FOLDER_STATUS = 1, 36 TNY_GET_MSG_QUEUE_STATUS = 2 36 37 }; 37 38 … … 41 42 { 42 43 TNY_FOLDER_STATUS_CODE_REFRESH = 1, 43 TNY_FOLDER_STATUS_CODE_GET_MSG = 2 44 TNY_FOLDER_STATUS_CODE_GET_MSG = 2, 45 TNY_GET_MSG_QUEUE_STATUS_GET_MSG = 3, 44 46 }; 45 47 trunk/tests/c-demo/Makefile.am
r1467 r1884 11 11 if BUILD_GNOME 12 12 INCLUDES += -DGNOME 13 endif 14 15 if BUILD_QUEUES 16 INCLUDES += -DQUEUES -I$(top_srcdir)/libtinymail-queues 13 17 endif 14 18 … … 33 37 $(top_builddir)/$(PLATFORMDIR)/$(PLATFORMDIR)-$(API_VERSION).la 34 38 39 if BUILD_QUEUES 40 tny_demoui_LDADD += $(top_builddir)/libtinymail-queues/libtinymail-queues-$(API_VERSION).la 41 endif 42 trunk/tests/c-demo/tny-demoui-summary-view.c
r1829 r1884 77 77 #include <tny-folder-monitor.h> 78 78 79 80 #ifdef QUEUES 81 #include <tny-get-msg-queue.h> 82 #endif 83 79 84 static TnySendQueue *queue = NULL; 80 85 … … 470 475 471 476 TnyDemouiSummaryViewPriv *priv = user_data; 472 477 478 if (!user_data) 479 return; 480 473 481 gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->progress), 474 482 tny_status_get_fraction (status)); … … 736 744 } 737 745 746 #ifdef QUEUES 747 static TnyGetMsgQueue *fullqueue = NULL; 748 749 static void 750 on_full_download_folder_activate (GtkMenuItem *mitem, gpointer user_data) 751 { 752 TnyDemouiSummaryView *self = user_data; 753 TnyDemouiSummaryViewPriv *priv = TNY_DEMOUI_SUMMARY_VIEW_GET_PRIVATE (self); 754 GtkTreeIter iter; 755 GtkTreeModel *model; 756 757 if (gtk_tree_selection_get_selected (priv->mailbox_select, &model, &iter)) 758 { 759 gint type; 760 761 gtk_tree_model_get (model, &iter, 762 TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN, 763 &type, -1); 764 765 if (type != TNY_FOLDER_TYPE_ROOT) 766 { 767 TnyFolder *folder; 768 769 gtk_tree_model_get (model, &iter, 770 TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, 771 &folder, -1); 772 773 if (!fullqueue) 774 fullqueue = tny_get_msg_queue_new (); 775 776 tny_get_msg_queue_full_msg_retrieval (fullqueue, folder, 777 NULL, NULL, refresh_current_folder_status_update, priv); 778 779 g_object_unref (G_OBJECT (folder)); 780 781 } 782 } 783 } 784 #endif 738 785 739 786 static void … … 1057 1104 1058 1105 1059 1060 1106 static void 1061 1107 mailbox_view_do_popup_menu (GtkWidget *my_widget, GdkEventButton *event, gpointer user_data) … … 1064 1110 TnyDemouiSummaryViewPriv *priv = TNY_DEMOUI_SUMMARY_VIEW_GET_PRIVATE (self); 1065 1111 GtkWidget *menu; 1066 GtkWidget *mrename, *mdelete, *mcreate, *mmerge;1067 1112 int button, event_time; 1068 1113 GtkSelectionMode mode; 1114 GtkWidget *mrename, *mdelete, *mcreate, *mmerge; 1115 #ifdef QUEUES 1116 GtkWidget *fdown; 1117 #endif 1069 1118 1070 1119 menu = gtk_menu_new (); … … 1074 1123 mdelete = gtk_menu_item_new_with_label (_("Delete folder")); 1075 1124 1125 #ifdef QUEUES 1126 fdown = gtk_menu_item_new_with_label (_("Download entire folder")); 1127 #endif 1076 1128 1077 1129 mode = gtk_tree_selection_get_mode (priv->mailbox_select); … … 1090 1142 g_signal_connect (G_OBJECT (mmerge), "activate", 1091 1143 G_CALLBACK (on_merge_view_activate), user_data); 1144 #ifdef QUEUES 1145 g_signal_connect (G_OBJECT (fdown), "activate", 1146 G_CALLBACK (on_full_download_folder_activate), user_data); 1147 #endif 1092 1148 1093 1149 gtk_menu_prepend (menu, mrename); … … 1095 1151 gtk_menu_prepend (menu, mdelete); 1096 1152 gtk_menu_prepend (menu, mmerge); 1097 1153 #ifdef QUEUES 1154 gtk_menu_prepend (menu, fdown); 1155 1156 gtk_widget_show (fdown); 1157 #endif 1098 1158 gtk_widget_show (mrename); 1099 1159 gtk_widget_show (mcreate);
