void ol_scroll_module_free (struct OlDisplayModule *module) { ol_assert (module != NULL); OlScrollModule *priv = ol_display_module_get_data (module); ol_assert (priv != NULL); if (_config_is_setting) return; if (module == NULL) return; if (priv->scroll != NULL) { gtk_widget_destroy (GTK_WIDGET (priv->scroll)); priv->scroll = NULL; } if (priv->message_timer > 0) g_source_remove (priv->message_timer); if (priv->player != NULL) { g_signal_handlers_disconnect_by_func (priv->player, _metadata_changed_cb, priv); g_signal_handlers_disconnect_by_func (priv->player, _caps_changed_cb, priv); g_object_unref (priv->player); priv->player = NULL; } if (priv->metadata != NULL) { ol_metadata_free (priv->metadata); priv->metadata = NULL; } if (priv->lrc) { g_object_unref (priv->lrc); priv->lrc = NULL; } while (priv->config_bindings != NULL) { _unbind_config (priv->config_bindings->data); priv->config_bindings = g_list_delete_link (priv->config_bindings, priv->config_bindings); } g_free (priv); }
static void ol_osd_module_free (struct OlDisplayModule *module) { ol_log_func (); ol_assert (module != NULL); OlOsdModule *priv = ol_display_module_get_data (module); ol_assert (priv != NULL); if (priv->lrc) { g_object_unref (priv->lrc); priv->lrc = NULL; } if (priv->toolbar) { g_object_unref (priv->toolbar); priv->toolbar = NULL; } if (priv->window != NULL) { gtk_widget_destroy (GTK_WIDGET (priv->window)); priv->window = NULL; } if (priv->message_source > 0) { g_source_remove (priv->message_source); priv->message_source = 0; } if (priv->metadata != NULL) { ol_metadata_free (priv->metadata); priv->metadata = NULL; } g_signal_handlers_disconnect_by_func (priv->player, _metadata_changed_cb, priv); g_object_unref (priv->player); priv->player = NULL; while (priv->config_bindings != NULL) { _unbind_config (priv->config_bindings->data); priv->config_bindings = g_list_delete_link (priv->config_bindings, priv->config_bindings); } g_free (priv); }
static void test_search_default (void) { task_cnt++; OlMetadata *metadata = ol_metadata_new (); ol_metadata_set_title (metadata, "Heal the world"); OlLyricSourceSearchTask *task = ol_lyric_source_search_default (source, metadata); g_signal_connect (G_OBJECT (task), "complete", (GCallback) search_complete_cb, (gpointer) OL_LYRIC_SOURCE_STATUS_SUCCESS); g_signal_connect (G_OBJECT (task), "started", (GCallback) search_started_cb, NULL); ol_metadata_free (metadata); }
static void test_empty_source (void) { task_cnt++; OlMetadata *metadata = ol_metadata_new (); ol_metadata_set_title (metadata, "empty"); OlLyricSourceSearchTask *task = ol_lyric_source_search (source, metadata, NULL); g_signal_connect (G_OBJECT (task), "complete", (GCallback) search_complete_cb, (gpointer)OL_LYRIC_SOURCE_STATUS_FALIURE); g_signal_connect (G_OBJECT (task), "started", (GCallback) search_started_cb, NULL); ol_lyric_source_task_cancel (OL_LYRIC_SOURCE_TASK (task)); ol_metadata_free (metadata); }
static void test_search_cancel (void) { task_cnt++; OlMetadata *metadata = ol_metadata_new (); ol_metadata_set_title (metadata, "放弃"); GList *ids = get_default_sourcid_list (); OlLyricSourceSearchTask *task = ol_lyric_source_search (source, metadata, ids); g_signal_connect (G_OBJECT (task), "complete", (GCallback) search_complete_cb, (gpointer) OL_LYRIC_SOURCE_STATUS_CANCELLED); g_signal_connect (G_OBJECT (task), "started", (GCallback) search_started_cb, NULL); ol_lyric_source_task_cancel (OL_LYRIC_SOURCE_TASK (task)); ol_metadata_free (metadata); free_sourceid_list (ids); }