1 #include "test-thread.h"
11 static guint test_thread_signals[LAST_SIGNAL] = { 0 };
19 test_thread_enum_get_type (void)
21 static GType enum_type = 0;
22 static GEnumValue enum_values[] = {
23 {TEST_THREAD_A, "TEST_THREAD_A", "a as in apple"},
29 g_enum_register_static ("TestThreadEnum", enum_values);
34 G_DEFINE_TYPE(TestThread, test_thread, G_TYPE_OBJECT);
37 other_thread_cb (TestThread *self)
39 g_signal_emit_by_name (self, "from-thread", 0, NULL);
44 test_thread_emit_signal (TestThread *self)
46 self->thread = g_thread_new ("t", (GThreadFunc)other_thread_cb, self);
49 static void test_thread_init (TestThread *self) {}
50 static void test_thread_class_init (TestThreadClass *klass)
52 test_thread_signals[SIGNAL_EMIT_SIGNAL] =
53 g_signal_new ("emit-signal", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
54 G_STRUCT_OFFSET (TestThreadClass, emit_signal),
55 NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
56 test_thread_signals[SIGNAL_FROM_THREAD] =
57 g_signal_new ("from-thread", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
58 G_STRUCT_OFFSET (TestThreadClass, from_thread),
59 NULL, NULL, g_cclosure_marshal_VOID__BOXED, G_TYPE_NONE, 1,
60 test_thread_enum_get_type ());
62 klass->emit_signal = test_thread_emit_signal;