1344
1345 g_return_val_if_fail (signal_name != NULL, 0);
1346
1347 va_start (args, n_params);
1348
1349 signal_id = g_signal_new_valist (signal_name, itype, signal_flags,
1350 class_offset ? g_signal_type_cclosure_new (itype, class_offset) : NULL,
1351 accumulator, accu_data, c_marshaller,
1352 return_type, n_params, args);
1353
1354 va_end (args);
1355
1356 /* optimize NOP emissions with NULL class handlers */
1357 if (signal_id && G_TYPE_IS_INSTANTIATABLE (itype) && return_type == G_TYPE_NONE &&
1358 class_offset && class_offset < MAX_TEST_CLASS_OFFSET)
1359 {
1360 SignalNode *node;
1361
1362 SIGNAL_LOCK ();
1363 node = LOOKUP_SIGNAL_NODE (signal_id);
1364 node->test_class_offset = class_offset;
1365 SIGNAL_UNLOCK ();
1366 }
1367
1368 return signal_id;
1369 }
1370
1371 /**
1372 * g_signal_new_class_handler:
1373 * @signal_name: the name for the signal
1374 * @itype: the type this signal pertains to. It will also pertain to
1375 * types which are derived from this type.
1376 * @signal_flags: a combination of #GSignalFlags specifying detail of when
1377 * the default handler is to be invoked. You should at least specify
1378 * %G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST.
1379 * @class_handler: a #GCallback which acts as class implementation of
1380 * this signal. Used to invoke a class method generically. Pass %NULL to
1381 * not associate a class method with this signal.
1382 * @accumulator: the accumulator for this signal; may be %NULL.
1383 * @accu_data: user data for the @accumulator.
|
1344
1345 g_return_val_if_fail (signal_name != NULL, 0);
1346
1347 va_start (args, n_params);
1348
1349 signal_id = g_signal_new_valist (signal_name, itype, signal_flags,
1350 class_offset ? g_signal_type_cclosure_new (itype, class_offset) : NULL,
1351 accumulator, accu_data, c_marshaller,
1352 return_type, n_params, args);
1353
1354 va_end (args);
1355
1356 /* optimize NOP emissions with NULL class handlers */
1357 if (signal_id && G_TYPE_IS_INSTANTIATABLE (itype) && return_type == G_TYPE_NONE &&
1358 class_offset && class_offset < MAX_TEST_CLASS_OFFSET)
1359 {
1360 SignalNode *node;
1361
1362 SIGNAL_LOCK ();
1363 node = LOOKUP_SIGNAL_NODE (signal_id);
1364 #ifdef GSTREAMER_LITE
1365 if (node == NULL) {
1366 SIGNAL_UNLOCK ();
1367 return 0;
1368 }
1369 #endif // GSTREAMER_LITE
1370 node->test_class_offset = class_offset;
1371 SIGNAL_UNLOCK ();
1372 }
1373
1374 return signal_id;
1375 }
1376
1377 /**
1378 * g_signal_new_class_handler:
1379 * @signal_name: the name for the signal
1380 * @itype: the type this signal pertains to. It will also pertain to
1381 * types which are derived from this type.
1382 * @signal_flags: a combination of #GSignalFlags specifying detail of when
1383 * the default handler is to be invoked. You should at least specify
1384 * %G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST.
1385 * @class_handler: a #GCallback which acts as class implementation of
1386 * this signal. Used to invoke a class method generically. Pass %NULL to
1387 * not associate a class method with this signal.
1388 * @accumulator: the accumulator for this signal; may be %NULL.
1389 * @accu_data: user data for the @accumulator.
|