[seed] printing gobjects: print the address in memory in addition to the gtype
- From: Alan Knowles <alank src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seed] printing gobjects: print the address in memory in addition to the gtype
- Date: Thu, 1 Aug 2013 02:54:08 +0000 (UTC)
commit e0fa4100054b10707e46f65a793b455d0e0c27dc
Author: Alban Crequy <alban crequy collabora co uk>
Date: Wed Jul 31 15:03:49 2013 +0100
printing gobjects: print the address in memory in addition to the gtype
It is useful for debugging. The output will be this:
> print (file_chooser);
[gobject GtkFileChooserDialog 0x211c230]
https://bugzilla.gnome.org/show_bug.cgi?id=705205
libseed/seed-engine.c | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/libseed/seed-engine.c b/libseed/seed-engine.c
index 473850e..461198f 100644
--- a/libseed/seed-engine.c
+++ b/libseed/seed-engine.c
@@ -1346,6 +1346,29 @@ seed_gobject_set_property (JSContextRef context,
}
static JSValueRef
+seed_gobject_convert_to_type (JSContextRef ctx,
+ JSObjectRef object,
+ JSType type, JSValueRef * exception)
+{
+ GObject *obj;
+ gchar *as_string;
+
+ if (type == kJSTypeString)
+ {
+ JSValueRef ret;
+ obj = (GObject *) JSObjectGetPrivate (object);
+
+ as_string =
+ g_strdup_printf ("[gobject %s %p]", G_OBJECT_TYPE_NAME (obj), obj);
+ ret = seed_value_from_string (ctx, as_string, exception);
+ g_free (as_string);
+
+ return ret;
+ }
+ return FALSE;
+}
+
+static JSValueRef
seed_gobject_constructor_convert_to_type (JSContextRef ctx,
JSObjectRef object,
JSType type, JSValueRef * exception)
@@ -1393,7 +1416,7 @@ JSClassDefinition gobject_def = {
NULL, /* Call As Function */
NULL, /* Call As Constructor */
NULL, /* Has Instance */
- NULL /* Convert To Type */
+ seed_gobject_convert_to_type /* Convert To Type */
};
JSClassDefinition gobject_method_def = {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]