2008-08-04 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-script.c:
	(clutter_script_default_connect): Improve wording and debug
	messages in the default autoconnection for signal handlers.
This commit is contained in:
Emmanuele Bassi 2008-08-04 16:33:43 +00:00
parent fbe225d179
commit bd30ac8e28
2 changed files with 35 additions and 21 deletions

View File

@ -1,3 +1,9 @@
2008-08-04 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-script.c:
(clutter_script_default_connect): Improve wording and debug
messages in the default autoconnection for signal handlers.
2008-08-04 Emmanuele Bassi <ebassi@openedhand.com> 2008-08-04 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-script-parser.c: * clutter/clutter-script-parser.c:

View File

@ -2115,41 +2115,51 @@ typedef struct {
/* default signal connection code */ /* default signal connection code */
static void static void
clutter_script_default_connect (ClutterScript *script, clutter_script_default_connect (ClutterScript *script,
GObject *object, GObject *gobject,
const gchar *signal_name, const gchar *signal_name,
const gchar *signal_handler, const gchar *signal_handler,
GObject *connect_object, GObject *connect_gobject,
GConnectFlags flags, GConnectFlags flags,
gpointer user_data) gpointer user_data)
{ {
ConnectData *data = user_data; ConnectData *data = user_data;
GCallback func; GCallback function;
if (!g_module_symbol (data->module, signal_handler, (gpointer)&func)) if (!data->module)
return;
if (!g_module_symbol (data->module, signal_handler, (gpointer) &function))
{ {
g_warning ("Could not find a signal handler '%s' for signal '%s::%s'", g_warning ("Could not find a signal handler '%s' for signal '%s::%s'",
signal_handler, signal_handler,
connect_object ? G_OBJECT_TYPE_NAME (connect_object) connect_gobject ? G_OBJECT_TYPE_NAME (connect_gobject)
: G_OBJECT_TYPE_NAME (object), : G_OBJECT_TYPE_NAME (gobject),
signal_name); signal_name);
return; return;
} }
CLUTTER_NOTE (SCRIPT, CLUTTER_NOTE (SCRIPT,
"connecting %s::%s to %s (afetr:%s, swapped:%s, object:%s)", "connecting %s::%s to %s (afetr:%s, swapped:%s, object:%s)",
(connect_object ? G_OBJECT_TYPE_NAME (connect_object) (connect_gobject ? G_OBJECT_TYPE_NAME (connect_gobject)
: G_OBJECT_TYPE_NAME (object)), : G_OBJECT_TYPE_NAME (gobject)),
signal_name, signal_name,
signal_handler, signal_handler,
(flags & G_CONNECT_AFTER) ? "true" : "false", (flags & G_CONNECT_AFTER) ? "true" : "false",
(flags & G_CONNECT_SWAPPED) ? "true" : "false", (flags & G_CONNECT_SWAPPED) ? "true" : "false",
(connect_object ? G_OBJECT_TYPE_NAME (connect_object) (connect_gobject ? G_OBJECT_TYPE_NAME (connect_gobject)
: "<none>")); : "<none>"));
if (connect_object) if (connect_gobject != NULL)
g_signal_connect_object (object, signal_name, func, connect_object, flags); g_signal_connect_object (gobject,
signal_name, function,
connect_gobject,
flags);
else else
g_signal_connect_data (object, signal_name, func, data->data, NULL, flags); g_signal_connect_data (gobject,
signal_name, function,
data->data,
NULL,
flags);
} }
/** /**
@ -2160,14 +2170,12 @@ clutter_script_default_connect (ClutterScript *script,
* Connects all the signals defined into a UI definition file to their * Connects all the signals defined into a UI definition file to their
* handlers. * handlers.
* *
* This method is a simpler variation of clutter_script_connect_signals_full(). * This method invokes clutter_script_connect_signals_full() internally
* It uses #GModule's introspective features (by opening the module %NULL) * and uses #GModule's introspective features (by opening the current
* to look at the application's symbol table. From here it tries to match * module's scope) to look at the application's symbol table.
* the signal handler names given in the interface description with
* symbols in the application and connects the signals.
* *
* Note that this function will not work correctly if #GModule is not * Note that this function will not work if #GModule is not supported by
* supported on the platform. * the platform Clutter is running on.
* *
* Since: 0.6 * Since: 0.6
*/ */