From c80468a7394a2f8f77f7f51ee2f1aa509aba4690 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Sat, 4 Apr 2015 10:17:28 -0400 Subject: [PATCH] callback: Remove all references to callbacks Callbacks have no remaining users and can safely be removed :) Signed-off-by: Anna Schumaker --- DESIGN | 1 - TODO | 2 -- core/callback.cpp | 19 ------------------- core/deck.cpp | 2 -- core/queue.cpp | 1 - gui/queue.cpp | 1 - gui/tabs.cpp | 1 - include/core/callback.h | 36 ------------------------------------ tests/core/Sconscript | 1 - tests/core/deck.cpp | 1 - tests/core/queue.cpp | 2 +- 11 files changed, 1 insertion(+), 66 deletions(-) delete mode 100644 core/callback.cpp delete mode 100644 include/core/callback.h diff --git a/DESIGN b/DESIGN index 64561880..cd290974 100644 --- a/DESIGN +++ b/DESIGN @@ -39,5 +39,4 @@ Core Layers: * Index (include/core/index.h) * Databases (include/core/database.h) * File (include/core/file.h) - * Callbacks (include/core/callback.h) * Version (include/core/version.h) diff --git a/TODO b/TODO index cc9b7506..f9074e21 100644 --- a/TODO +++ b/TODO @@ -58,7 +58,6 @@ Future work: the library? Perhaps create a mirror group? - Extra testing ideas: - - Test callbacks - Create a default main() that deletes data directory - Preferences: @@ -90,7 +89,6 @@ Future work: - Make DatabaseEntry::primary_key() private (only used by Database) - "On demand" databases that load the first time they are accessed? - Queues have their own indexes? - - Remove callbacks (may need "driver" for queues) - Remove glib specifc code from core/ - Virtual file system - Fake filesystem access for testing diff --git a/core/callback.cpp b/core/callback.cpp deleted file mode 100644 index 95048c8d..00000000 --- a/core/callback.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @file - * Copyright 2014 (c) Anna Schumaker. - */ -#include - - -static void no_op(Queue *) {} - - -static struct Callbacks callbacks = { - .on_pq_removed = no_op, -}; - - -struct Callbacks *get_callbacks() -{ - return &callbacks; -} diff --git a/core/deck.cpp b/core/deck.cpp index 04642184..c13fa89b 100644 --- a/core/deck.cpp +++ b/core/deck.cpp @@ -2,7 +2,6 @@ * @file * Copyright 2013 (c) Anna Schumaker. */ -#include #include #include #include @@ -136,7 +135,6 @@ Queue *deck :: create(bool random) static void _destroy(std::list::iterator &it) { - get_callbacks()->on_pq_removed(&(*it)); queue_deck.erase(it); deck :: write(); } diff --git a/core/queue.cpp b/core/queue.cpp index d0b03c5d..a15ce368 100644 --- a/core/queue.cpp +++ b/core/queue.cpp @@ -2,7 +2,6 @@ * @file * Copyright 2013 (c) Anna Schumaker. */ -#include #include #include #include diff --git a/gui/queue.cpp b/gui/queue.cpp index b383ebf4..879d6296 100644 --- a/gui/queue.cpp +++ b/gui/queue.cpp @@ -1,7 +1,6 @@ /* * Copyright 2014 (c) Anna Schumaker. */ -#include #include #include #include diff --git a/gui/tabs.cpp b/gui/tabs.cpp index fb267d21..a4987aaf 100644 --- a/gui/tabs.cpp +++ b/gui/tabs.cpp @@ -1,7 +1,6 @@ /* * Copyright 2014 (c) Anna Schumaker. */ -#include #include #include #include diff --git a/include/core/callback.h b/include/core/callback.h deleted file mode 100644 index a2fe5c05..00000000 --- a/include/core/callback.h +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file - * Copyright 2014 (c) Anna Schumaker. - */ -#ifndef OCARINA_CORE_CALLBACK_H -#define OCARINA_CORE_CALLBACK_H - -#include -#include - - -/** - * A structure for managing callback function pointers - */ -struct Callbacks { - /* Deck callbacks */ - - /** - * Called when a queue is removed. - * - * @param queue The queue that is being removed. - */ - void (*on_pq_removed)(Queue *); - -}; - - -/** - * Called to access the callbacks structure. - * - * @return The current struct Callbacks for this application. - */ -struct Callbacks *get_callbacks(); - - -#endif /* OCARINA_CORE_CALLBACK_H */ diff --git a/tests/core/Sconscript b/tests/core/Sconscript index b86a4009..191ff0c1 100644 --- a/tests/core/Sconscript +++ b/tests/core/Sconscript @@ -24,7 +24,6 @@ test( "tags/track" ) test( "random" ) -objs += [ get_test_obj("callback", "core") ] objs += [ get_test_obj("tags/tags", "core") ] test( "queue" ) test_env.UsePackage("taglib") diff --git a/tests/core/deck.cpp b/tests/core/deck.cpp index c1a03654..8ba5aacd 100644 --- a/tests/core/deck.cpp +++ b/tests/core/deck.cpp @@ -1,7 +1,6 @@ /* * Copyright 2013 (c) Anna Schumaker. */ -#include #include #include #include diff --git a/tests/core/queue.cpp b/tests/core/queue.cpp index a0a0b062..0eb5df50 100644 --- a/tests/core/queue.cpp +++ b/tests/core/queue.cpp @@ -1,7 +1,6 @@ /* * Copyright 2014 (c) Anna Schumaker. */ -#include #include #include #include @@ -31,6 +30,7 @@ class TestQueue : public Queue { public: TestQueue() : Queue() { set_notifier(&test_notifier); } TestQueue(unsigned int f) : Queue(f) { set_notifier(&test_notifier); } + ~TestQueue() {} unsigned int get_cur() { return _cur; } unsigned int get_flags() { return _flags; } QNotifier *get_notify() { return _notify; }