diff options
author | Bastien Nocera <hadess@hadess.net> | 2013-10-30 02:04:54 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-10-30 03:22:35 +0800 |
commit | bc0d5d40ed39c92dcdf62ae891a2e99c25237d74 (patch) | |
tree | a07763eeaa20602bd4c0620b2fe67c443c52d29c /mail | |
parent | d3e0f96c73dde49acde92f6347b9e362d85e94aa (diff) | |
download | gsoc2013-evolution-bc0d5d40ed39c92dcdf62ae891a2e99c25237d74.tar gsoc2013-evolution-bc0d5d40ed39c92dcdf62ae891a2e99c25237d74.tar.gz gsoc2013-evolution-bc0d5d40ed39c92dcdf62ae891a2e99c25237d74.tar.bz2 gsoc2013-evolution-bc0d5d40ed39c92dcdf62ae891a2e99c25237d74.tar.lz gsoc2013-evolution-bc0d5d40ed39c92dcdf62ae891a2e99c25237d74.tar.xz gsoc2013-evolution-bc0d5d40ed39c92dcdf62ae891a2e99c25237d74.tar.zst gsoc2013-evolution-bc0d5d40ed39c92dcdf62ae891a2e99c25237d74.zip |
Bug 710797 - Name all the timeouts added with g_timeout_add()
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-backend.c | 12 | ||||
-rw-r--r-- | mail/e-mail-reader.c | 25 | ||||
-rw-r--r-- | mail/em-folder-tree.c | 30 | ||||
-rw-r--r-- | mail/em-subscription-editor.c | 14 | ||||
-rw-r--r-- | mail/importers/elm-importer.c | 3 | ||||
-rw-r--r-- | mail/importers/evolution-mbox-importer.c | 3 | ||||
-rw-r--r-- | mail/importers/pine-importer.c | 7 | ||||
-rw-r--r-- | mail/mail-send-recv.c | 14 |
8 files changed, 64 insertions, 44 deletions
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c index f15e7f8efb..0d1c4bf5f1 100644 --- a/mail/e-mail-backend.c +++ b/mail/e-mail-backend.c @@ -265,7 +265,7 @@ mail_backend_delete_junk (CamelService *service, /* Helper for mail_backend_prepare_for_quit_cb() */ static gboolean -mail_backend_poll_to_quit (EActivity *activity) +mail_backend_poll_to_quit (gpointer user_data) { return mail_msg_active (); } @@ -358,12 +358,14 @@ mail_backend_prepare_for_quit_cb (EShell *shell, /* Now we poll until all activities are actually cancelled or finished. * Reffing the activity delays quitting; the reference count * acts like a counting semaphore. */ - if (mail_msg_active ()) - g_timeout_add_seconds_full ( - G_PRIORITY_DEFAULT, QUIT_POLL_INTERVAL, - (GSourceFunc) mail_backend_poll_to_quit, + if (mail_msg_active ()) { + e_named_timeout_add_seconds_full ( + G_PRIORITY_DEFAULT, + QUIT_POLL_INTERVAL, + mail_backend_poll_to_quit, g_object_ref (activity), (GDestroyNotify) g_object_unref); + } } static void diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 761fa5842e..24ef087aac 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -2556,8 +2556,9 @@ mail_reader_key_press_cb (EMailReader *reader, } static gboolean -mail_reader_message_seen_cb (EMailReaderClosure *closure) +mail_reader_message_seen_cb (gpointer user_data) { + EMailReaderClosure *closure = user_data; EMailReader *reader; GtkWidget *message_list; EMailPartList *parts; @@ -2631,11 +2632,12 @@ schedule_timeout_mark_seen (EMailReader *reader) timeout_closure->reader = g_object_ref (reader); timeout_closure->message_uid = g_strdup (message_uid); - MESSAGE_LIST (message_list)->seen_id = g_timeout_add_full ( - G_PRIORITY_DEFAULT, timeout_interval, - (GSourceFunc) mail_reader_message_seen_cb, - timeout_closure, (GDestroyNotify) - mail_reader_closure_free); + MESSAGE_LIST (message_list)->seen_id = + e_named_timeout_add_full ( + G_PRIORITY_DEFAULT, timeout_interval, + mail_reader_message_seen_cb, + timeout_closure, (GDestroyNotify) + mail_reader_closure_free); } return schedule_timeout; @@ -2731,8 +2733,9 @@ exit: } static gboolean -mail_reader_message_selected_timeout_cb (EMailReader *reader) +mail_reader_message_selected_timeout_cb (gpointer user_data) { + EMailReader *reader; EMailReaderPrivate *priv; EMailDisplay *display; GtkWidget *message_list; @@ -2740,6 +2743,7 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader) const gchar *format_uid; EMailPartList *parts; + reader = E_MAIL_READER (user_data); priv = E_MAIL_READER_GET_PRIVATE (reader); message_list = e_mail_reader_get_message_list (reader); @@ -2845,15 +2849,16 @@ mail_reader_message_selected_cb (EMailReader *reader, display = e_mail_reader_get_mail_display (reader); e_mail_display_set_part_list (display, NULL); e_web_view_clear (E_WEB_VIEW (display)); + } else if (priv->restoring_message_selection) { /* Skip the timeout if we're restoring the previous message * selection. The timeout is there for when we're scrolling * rapidly through the message list. */ mail_reader_message_selected_timeout_cb (reader); + } else { - priv->message_selected_timeout_id = g_timeout_add ( - 100, (GSourceFunc) - mail_reader_message_selected_timeout_cb, reader); + priv->message_selected_timeout_id = e_named_timeout_add ( + 100, mail_reader_message_selected_timeout_cb, reader); } e_mail_reader_changed (reader); diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 16bb94d0e6..fb2441b1d5 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -2677,8 +2677,9 @@ tree_drag_leave (GtkWidget *widget, #define SCROLL_EDGE_SIZE 15 static gboolean -tree_autoscroll (EMFolderTree *folder_tree) +tree_autoscroll (gpointer user_data) { + EMFolderTree *folder_tree; GtkAdjustment *adjustment; GtkTreeView *tree_view; GtkScrollable *scrollable; @@ -2690,6 +2691,8 @@ tree_autoscroll (EMFolderTree *folder_tree) gdouble value; gint offset, y; + folder_tree = EM_FOLDER_TREE (user_data); + /* Get the y pointer position relative to the treeview. */ tree_view = GTK_TREE_VIEW (folder_tree); window = gtk_tree_view_get_bin_window (tree_view); @@ -2723,13 +2726,15 @@ tree_autoscroll (EMFolderTree *folder_tree) } static gboolean -tree_autoexpand (EMFolderTree *folder_tree) +tree_autoexpand (gpointer user_data) { - EMFolderTreePrivate *priv = folder_tree->priv; + EMFolderTreePrivate *priv; GtkTreeView *tree_view; GtkTreePath *path; - tree_view = GTK_TREE_VIEW (folder_tree); + tree_view = GTK_TREE_VIEW (user_data); + priv = EM_FOLDER_TREE_GET_PRIVATE (tree_view); + path = gtk_tree_row_reference_get_path (priv->autoexpand_row); gtk_tree_view_expand_row (tree_view, path, FALSE); gtk_tree_path_free (path); @@ -2763,9 +2768,10 @@ tree_drag_motion (GtkWidget *widget, if (!gtk_tree_view_get_dest_row_at_pos (tree_view, x, y, &path, &pos)) return FALSE; - if (priv->autoscroll_id == 0) - priv->autoscroll_id = g_timeout_add ( - 150, (GSourceFunc) tree_autoscroll, folder_tree); + if (priv->autoscroll_id == 0) { + priv->autoscroll_id = e_named_timeout_add ( + 150, tree_autoscroll, folder_tree); + } gtk_tree_model_get_iter (model, &iter, path); @@ -2783,16 +2789,14 @@ tree_drag_motion (GtkWidget *widget, priv->autoexpand_row = gtk_tree_row_reference_new (model, path); g_source_remove (priv->autoexpand_id); - priv->autoexpand_id = g_timeout_add ( - 600, (GSourceFunc) - tree_autoexpand, folder_tree); + priv->autoexpand_id = e_named_timeout_add ( + 600, tree_autoexpand, folder_tree); } gtk_tree_path_free (autoexpand_path); } else { - priv->autoexpand_id = g_timeout_add ( - 600, (GSourceFunc) - tree_autoexpand, folder_tree); + priv->autoexpand_id = e_named_timeout_add ( + 600, tree_autoexpand, folder_tree); priv->autoexpand_row = gtk_tree_row_reference_new (model, path); } diff --git a/mail/em-subscription-editor.c b/mail/em-subscription-editor.c index e210652d37..77fb6b2bb1 100644 --- a/mail/em-subscription-editor.c +++ b/mail/em-subscription-editor.c @@ -1187,8 +1187,11 @@ subscription_editor_update_view (EMSubscriptionEditor *editor) } static gboolean -subscription_editor_timeout_cb (EMSubscriptionEditor *editor) +subscription_editor_timeout_cb (gpointer user_data) { + EMSubscriptionEditor *editor; + + editor = EM_SUBSCRIPTION_EDITOR (user_data); subscription_editor_update_view (editor); editor->priv->timeout_id = 0; @@ -1234,11 +1237,12 @@ subscription_editor_entry_changed_cb (GtkEntry *entry, text = gtk_entry_get_text (entry); - if (text != NULL && *text != '\0') - editor->priv->timeout_id = g_timeout_add_seconds ( - 1, (GSourceFunc) subscription_editor_timeout_cb, editor); - else + if (text != NULL && *text != '\0') { + editor->priv->timeout_id = e_named_timeout_add_seconds ( + 1, subscription_editor_timeout_cb, editor); + } else { subscription_editor_update_view (editor); + } } static void diff --git a/mail/importers/elm-importer.c b/mail/importers/elm-importer.c index 6a20bf4120..97ee58d474 100644 --- a/mail/importers/elm-importer.c +++ b/mail/importers/elm-importer.c @@ -292,7 +292,8 @@ mail_importer_elm_import (EImport *ei, m->import = ei; g_object_ref (m->import); m->target = (EImportTargetHome *) target; - m->status_timeout_id = g_timeout_add (100, elm_status_timeout, m); + m->status_timeout_id = + e_named_timeout_add (100, elm_status_timeout, m); g_mutex_init (&m->status_lock); m->status = camel_operation_new (); diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c index 1e8a09460e..3149441ff9 100644 --- a/mail/importers/evolution-mbox-importer.c +++ b/mail/importers/evolution-mbox-importer.c @@ -274,7 +274,8 @@ mbox_import (EImport *ei, importer->import = ei; importer->target = target; g_mutex_init (&importer->status_lock); - importer->status_timeout_id = g_timeout_add (100, mbox_status_timeout, importer); + importer->status_timeout_id = + e_named_timeout_add (100, mbox_status_timeout, importer); importer->cancellable = camel_operation_new (); g_signal_connect ( diff --git a/mail/importers/pine-importer.c b/mail/importers/pine-importer.c index c37d3bd809..4fd5f37e93 100644 --- a/mail/importers/pine-importer.c +++ b/mail/importers/pine-importer.c @@ -318,8 +318,9 @@ pine_status (CamelOperation *op, } static gboolean -pine_status_timeout (struct _pine_import_msg *importer) +pine_status_timeout (gpointer user_data) { + struct _pine_import_msg *importer = user_data; gint pc; gchar *what; @@ -358,8 +359,8 @@ mail_importer_pine_import (EImport *ei, m->import = ei; g_object_ref (m->import); m->target = target; - m->status_timeout_id = g_timeout_add ( - 100, (GSourceFunc) pine_status_timeout, m); + m->status_timeout_id = e_named_timeout_add ( + 100, pine_status_timeout, m); g_mutex_init (&m->status_lock); m->cancellable = camel_operation_new (); diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index 072641bf3c..76859c687e 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -616,7 +616,7 @@ build_dialog (GtkWindow *parent, info->keep_on_server = get_keep_on_server (service); info->cancellable = camel_operation_new (); info->state = allow_send ? SEND_ACTIVE : SEND_COMPLETE; - info->timeout_id = g_timeout_add ( + info->timeout_id = e_named_timeout_add ( STATUS_TIMEOUT, operation_status_timeout, info); g_signal_connect ( @@ -631,9 +631,10 @@ build_dialog (GtkWindow *parent, /* incase we get the same source pop up again */ continue; - } else if (info->timeout_id == 0) - info->timeout_id = g_timeout_add ( + } else if (info->timeout_id == 0) { + info->timeout_id = e_named_timeout_add ( STATUS_TIMEOUT, operation_status_timeout, info); + } recv_icon = gtk_image_new_from_icon_name ( "mail-inbox", SEND_RECV_ICON_SIZE); @@ -704,7 +705,7 @@ build_dialog (GtkWindow *parent, info->keep_on_server = FALSE; info->cancellable = camel_operation_new (); info->state = SEND_ACTIVE; - info->timeout_id = g_timeout_add ( + info->timeout_id = e_named_timeout_add ( STATUS_TIMEOUT, operation_status_timeout, info); g_signal_connect ( @@ -714,9 +715,10 @@ build_dialog (GtkWindow *parent, g_hash_table_insert ( data->active, g_strdup (SEND_URI_KEY), info); list = g_list_prepend (list, info); - } else if (info->timeout_id == 0) - info->timeout_id = g_timeout_add ( + } else if (info->timeout_id == 0) { + info->timeout_id = e_named_timeout_add ( STATUS_TIMEOUT, operation_status_timeout, info); + } send_icon = gtk_image_new_from_icon_name ( "mail-outbox", SEND_RECV_ICON_SIZE); |