[seed] seed-signals: allow notify:: signals
- From: Tim Horton <hortont src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seed] seed-signals: allow notify:: signals
- Date: Thu, 18 Feb 2010 23:03:29 +0000 (UTC)
commit 9ff411c674f47b3464777993db4ca6976b94234c
Author: Diego Escalante Urrelo <descalante igalia com>
Date: Wed Feb 17 17:04:54 2010 -0500
seed-signals: allow notify:: signals
g_signal_query/g_signal_lookup don't recognize notify::x signal names,
they do recognize notify signal of course. Take this into account and
enable connecting to notify::x signals like shown by documentation.
Also add a SeedException when signal name is not valid instead of just
returning NULL.
Bug #610311
libseed/seed-signals.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/libseed/seed-signals.c b/libseed/seed-signals.c
index 7c40e93..fe2be47 100644
--- a/libseed/seed-signals.c
+++ b/libseed/seed-signals.c
@@ -1,4 +1,5 @@
/* -*- mode: C; indent-tabs-mode: t; tab-width: 8; c-basic-offset: 2; -*- */
+/* vim: set sw=2 ts=2 sts=2 et: */
/*
* This file is part of Seed, the GObject Introspection<->Javascript bindings.
@@ -47,8 +48,13 @@ seed_gobject_signal_connect (JSContextRef ctx,
GSignalQuery query;
GClosure *closure;
- g_signal_query (g_signal_lookup (signal_name, G_OBJECT_TYPE (on_obj)),
- &query);
+ if (g_str_has_prefix (signal_name, "notify::"))
+ g_signal_query (g_signal_lookup ("notify", G_OBJECT_TYPE (on_obj)),
+ &query);
+ else
+ g_signal_query (g_signal_lookup (signal_name, G_OBJECT_TYPE (on_obj)),
+ &query);
+
#ifdef SEED_ENABLE_DEBUG
{
guint function_arity = seed_value_to_uint (ctx,
@@ -402,8 +408,12 @@ seed_signal_holder_get_property (JSContextRef ctx,
return NULL;
}
- if (!g_signal_lookup (signal_name, G_OBJECT_TYPE (gobj)))
+ if (!g_str_has_prefix (signal_name, "notify::") &&
+ !g_signal_lookup (signal_name, G_OBJECT_TYPE (gobj)))
{
+ seed_make_exception (ctx, exception, "InvalidSignalName",
+ "Failed to connect to %s. "
+ "Invalid signal name.", signal_name);
g_free (signal_name);
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]