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_create ((GThreadFunc)other_thread_cb,
50 static void test_thread_init (TestThread *self) {}
51 static void test_thread_class_init (TestThreadClass *klass)
53 test_thread_signals[SIGNAL_EMIT_SIGNAL] =
54 g_signal_new ("emit-signal", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
55 G_STRUCT_OFFSET (TestThreadClass, emit_signal),
56 NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
57 test_thread_signals[SIGNAL_FROM_THREAD] =
58 g_signal_new ("from-thread", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
59 G_STRUCT_OFFSET (TestThreadClass, from_thread),
60 NULL, NULL, g_cclosure_marshal_VOID__BOXED, G_TYPE_NONE, 1,
61 test_thread_enum_get_type ());
63 klass->emit_signal = test_thread_emit_signal;