[retro-gtk/wip/aplazas/options: 2/3] option: Add the 'value-changed' signal
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk/wip/aplazas/options: 2/3] option: Add the 'value-changed' signal
- Date: Fri, 24 Nov 2017 10:40:59 +0000 (UTC)
commit cd782a0b8a604fc829c18302e37b7d98aa79fe5e
Author: Adrien Plazas <kekun plazas laposte net>
Date: Fri Nov 24 10:55:20 2017 +0100
option: Add the 'value-changed' signal
retro-gtk/retro-option.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/retro-gtk/retro-option.c b/retro-gtk/retro-option.c
index 1430f0c..8c8a7ce 100644
--- a/retro-gtk/retro-option.c
+++ b/retro-gtk/retro-option.c
@@ -13,6 +13,13 @@ struct _RetroOption
G_DEFINE_TYPE (RetroOption, retro_option, G_TYPE_OBJECT)
+enum {
+ SIG_VALUE_CHANGED,
+ N_SIGNALS,
+};
+
+static guint signals[N_SIGNALS];
+
#define RETRO_OPTION_ERROR (retro_option_error_quark ())
enum {
@@ -43,6 +50,13 @@ retro_option_class_init (RetroOptionClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = retro_option_finalize;
+
+ signals[SIG_VALUE_CHANGED] =
+ g_signal_new ("value-changed", RETRO_TYPE_OPTION, G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE,
+ 0);
}
static void
@@ -111,6 +125,8 @@ retro_option_set_value (RetroOption *self,
}
self->value = i;
+
+ g_signal_emit (self, signals[SIG_VALUE_CHANGED], 0);
}
RetroOption *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]