]> git.babelmonkeys.de Git - jubjub.git/commitdiff
Move JubGObjectMap functions to a .m file
authorFlorian Zeitz <florob@babelmonkeys.de>
Wed, 26 Dec 2012 01:13:39 +0000 (02:13 +0100)
committerFlorian Zeitz <florob@babelmonkeys.de>
Wed, 26 Dec 2012 01:14:29 +0000 (02:14 +0100)
src/gui/gtk/JubGObjectMap.h
src/gui/gtk/JubGObjectMap.m [new file with mode: 0644]
src/gui/gtk/Makefile

index fef08a1d35f36a7df61d1ad6bb9d30cb46ca70a7..f5fd27e2a8d3b485cdd69a49169e6e4478a354d3 100644 (file)
@@ -1,86 +1,3 @@
-#import <ObjFW/ObjFW.h>
-#include <gtk/gtk.h>
-
-static void *copy(void *value)
-{
-       return [(id)value copy];
-}
-
-static void release(void *value)
-{
-       [(id)value release];
-}
-
-static uint32_t hash(void *value)
-{
-       return [(id)value hash];
-}
-
-static BOOL equal(void *value1, void *value2)
-{
-       return [(id)value1 isEqual: (id)value2];
-}
-
-static void *g_retain(void *value)
-{
-       return g_object_ref(value);
-}
-
-static void g_release(void *value)
-{
-       g_object_unref(value);
-}
-
-static void *default_retain(void *value)
-{
-       return value;
-}
-
-static uint32_t default_hash(void *value)
-{
-#define NUM (sizeof(void*)/sizeof(uint32_t))
-       int i;
-       uint32_t hash = 0;
-       union {
-               void *v;
-               uint32_t i[NUM];
-       } u = { value };
-
-       for (i = 0; i < NUM; i++)
-               hash ^= u.i[i];
-
-       return hash;
-#undef NUM
-}
-
-static BOOL default_equal(void *value1, void *value2)
-{
-       return (value1 == value2);
-}
-
-
-static void rowref_release(void *value)
-{
-       gtk_tree_row_reference_free(value);
-}
-
-static of_map_table_functions_t keyFunctions = {
-       .retain = copy,
-       .release = release,
-       .hash = hash,
-       .equal = equal
-};
-
-static of_map_table_functions_t gObjectFunctions __attribute__((unused)) = {
-       .retain = g_retain,
-       .release = g_release,
-       .hash = default_hash,
-       .equal = default_equal
-};
-
-static of_map_table_functions_t rowRefFunctions = {
-       .retain = default_retain,
-       .release = rowref_release,
-       .hash = default_hash,
-       .equal = default_equal
-};
+extern of_map_table_functions_t keyFunctions;
+extern of_map_table_functions_t gObjectFunctions __attribute__((unused));
+extern of_map_table_functions_t rowRefFunctions;
diff --git a/src/gui/gtk/JubGObjectMap.m b/src/gui/gtk/JubGObjectMap.m
new file mode 100644 (file)
index 0000000..ce6217a
--- /dev/null
@@ -0,0 +1,86 @@
+#import <ObjFW/ObjFW.h>
+#include <gtk/gtk.h>
+
+static void *copy(void *value)
+{
+       return [(id)value copy];
+}
+
+static void release(void *value)
+{
+       [(id)value release];
+}
+
+static uint32_t hash(void *value)
+{
+       return [(id)value hash];
+}
+
+static BOOL equal(void *value1, void *value2)
+{
+       return [(id)value1 isEqual: (id)value2];
+}
+
+static void *g_retain(void *value)
+{
+       return g_object_ref(value);
+}
+
+static void g_release(void *value)
+{
+       g_object_unref(value);
+}
+
+static void *default_retain(void *value)
+{
+       return value;
+}
+
+static uint32_t default_hash(void *value)
+{
+#define NUM (sizeof(void*)/sizeof(uint32_t))
+       int i;
+       uint32_t hash = 0;
+       union {
+               void *v;
+               uint32_t i[NUM];
+       } u = { value };
+
+       for (i = 0; i < NUM; i++)
+               hash ^= u.i[i];
+
+       return hash;
+#undef NUM
+}
+
+static BOOL default_equal(void *value1, void *value2)
+{
+       return (value1 == value2);
+}
+
+
+static void rowref_release(void *value)
+{
+       gtk_tree_row_reference_free(value);
+}
+
+of_map_table_functions_t keyFunctions = {
+       .retain = copy,
+       .release = release,
+       .hash = hash,
+       .equal = equal
+};
+
+of_map_table_functions_t gObjectFunctions = {
+       .retain = g_retain,
+       .release = g_release,
+       .hash = default_hash,
+       .equal = default_equal
+};
+
+of_map_table_functions_t rowRefFunctions = {
+       .retain = default_retain,
+       .release = rowref_release,
+       .hash = default_hash,
+       .equal = default_equal
+};
index c50589634a3f9c09780db1688e8999b2f4f1ab88..56c27e5732644c71274e366303b1b90d912cad52 100644 (file)
@@ -2,7 +2,8 @@ STATIC_LIB_NOINST = gtk.a
 SRCS = JubGtkUI.m      \
        JubGtkChatUI.m   \
        JubGtkRosterUI.m \
-       JubGtkHelper.m
+       JubGtkHelper.m \
+       JubGObjectMap.m
 
 include ../../../buildsys.mk