Changeset 2638
- Timestamp:
- 08/15/07 12:00:48
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/libtinymail-maemo/tny-maemo-conic-device.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r2630 r2638 1 2007-08-15 Murray Cumming <murrayc@murrayc.com> 2 3 * libtinymail-maemo/tny-maemo-conic-device.c: 4 (conic_emit_status_idle), (conic_emit_status): 5 If no mainloop is running (for instance, before gtk_main_run()), 6 just emit without using g_idle_add(). Hopefully this will cause the signal 7 to be emitted early enough - when tinymail needs is_online() to be correct. 8 See the comments to see why this is OK for tinymail. 9 1 10 2007-08-14 Murray Cumming <murrayc@murrayc.com> 2 11 trunk/libtinymail-maemo/tny-maemo-conic-device.c
r2631 r2638 87 87 EmitStatusInfo *info = (EmitStatusInfo *) user_data; 88 88 89 /* We lock the gdk thread because tinymail wants implementations to do this 90 * before emitting _any_ signals. 91 * See http://www.tinymail.org/trac/tinymail/wiki/HowTnyLockable 92 */ 89 93 gdk_threads_enter (); 90 94 g_signal_emit (info->self, tny_device_signals [TNY_DEVICE_CONNECTION_CHANGED], … … 107 111 conic_emit_status (TnyDevice *self, gboolean status) 108 112 { 109 EmitStatusInfo *info = g_slice_new (EmitStatusInfo); 110 111 info->self = g_object_ref (self); 112 info->status = status; 113 114 g_idle_add_full (G_PRIORITY_DEFAULT, conic_emit_status_idle, 115 info, conic_emit_status_destroy); 113 /* If there is a mainloop (if gtk_main() has been run, for instance), 114 * then emit the signal via an idle callback, so that it is 115 * always emitted in the main context as required by tinymail 116 * (libconic does not give any guarantee 117 * about this - it would be nice if libconic documented that). 118 * But if there is no mainloop, then just emit it, as tinymail 119 * requires when there is no mainloop: 120 */ 121 if (g_main_loop_is_running (NULL)) 122 { 123 /* Emit it in an idle handler: */ 124 EmitStatusInfo *info = g_slice_new (EmitStatusInfo); 125 126 info->self = g_object_ref (self); 127 info->status = status; 128 129 g_idle_add_full (G_PRIORITY_DEFAULT, conic_emit_status_idle, 130 info, conic_emit_status_destroy); 131 } else { 132 /* Emit it directly: */ 133 134 /* We lock the gdk thread because tinymail wants implementations to do this 135 * before emitting _any_ signals. 136 * See http://www.tinymail.org/trac/tinymail/wiki/HowTnyLockable 137 */ 138 gdk_threads_enter (); 139 g_signal_emit (self, tny_device_signals [TNY_DEVICE_CONNECTION_CHANGED], 140 0, status); 141 gdk_threads_leave (); 142 } 116 143 117 144 return; … … 572 599 return result; 573 600 #else 574 priv 575 = TNY_MAEMO_CONIC_DEVICE_GET_PRIVATE (self); 601 priv = TNY_MAEMO_CONIC_DEVICE_GET_PRIVATE (self); 576 602 g_return_val_if_fail (priv->cnx, NULL); 577 603
