/**
 * tp_channel_dispatcher_init_known_interfaces:
 *
 * Ensure that the known interfaces for TpChannelDispatcher have been set up.
 * This is done automatically when necessary, but for correct
 * overriding of library interfaces by local extensions, you should
 * call this function before calling
 * tp_proxy_or_subclass_hook_on_interface_add() with first argument
 * %TP_TYPE_CHANNEL_DISPATCHER.
 *
 * Since: 0.7.32
 */
void
tp_channel_dispatcher_init_known_interfaces (void)
{
  static gsize once = 0;

  if (g_once_init_enter (&once))
    {
      GType tp_type = TP_TYPE_CHANNEL_DISPATCHER;

      tp_proxy_init_known_interfaces ();
      tp_proxy_or_subclass_hook_on_interface_add (tp_type,
          tp_cli_channel_dispatcher_add_signals);
      tp_proxy_subclass_add_error_mapping (tp_type,
          TP_ERROR_PREFIX, TP_ERRORS, TP_TYPE_ERROR);

      g_once_init_leave (&once, 1);
    }
}
Beispiel #2
0
/**
 * tp_media_session_handler_init_known_interfaces:
 *
 * Ensure that the known interfaces for TpMediaSessionHandler have been set up.
 * This is done automatically when necessary, but for correct
 * overriding of library interfaces by local extensions, you should
 * call this function before calling
 * tp_proxy_or_subclass_hook_on_interface_add() with first argument
 * %TP_TYPE_MEDIA_SESSION_HANDLER.
 *
 * Since: 0.7.32
 */
void
tp_media_session_handler_init_known_interfaces (void)
{
  static gsize once = 0;

  if (g_once_init_enter (&once))
    {
      GType tp_type = TP_TYPE_MEDIA_SESSION_HANDLER;

      tp_proxy_init_known_interfaces ();
      tp_proxy_or_subclass_hook_on_interface_add (tp_type,
          tp_cli_media_session_handler_add_signals);
      tp_proxy_subclass_add_error_mapping (tp_type,
          TP_ERROR_PREFIX, TP_ERRORS, TP_TYPE_ERROR);

      g_once_init_leave (&once, 1);
    }
}
static void
tp_yts_status_class_init (TpYtsStatusClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  TpProxyClass *proxy_class = TP_PROXY_CLASS (klass);
  GType tp_type = TP_TYPE_YTS_STATUS;

  object_class->constructed = tp_yts_status_constructed;
  object_class->get_property = tp_yts_status_get_property;
  object_class->dispose = tp_yts_status_dispose;
  object_class->finalize = tp_yts_status_finalize;

  proxy_class->interface = TP_YTS_IFACE_QUARK_STATUS;

  g_type_class_add_private (klass, sizeof (TpYtsStatusPrivate));

  /**
   * TpYtsStatus:discovered-services:
   *
   * Get the discovered Ytstenut services. The hash table is of
   * #TP_YTS_HASH_TYPE_SERVICE_MAP type, and has the following contents:
   *
   * <code><literallayout>
   *    GHashTable (
   *        gchar *contact_id,
   *        GHashTable (
   *            gchar *service_name,
   *            GValueArray (
   *                gchar *service_type,
   *                GHashTable (
   *                    gchar *language,
   *                    gchar *localized_name
   *                )
   *                gchar **capabilities
   *            )
   *        )
   *    )
   * </literallayout></code>
   */
  g_object_class_install_property (object_class, PROP_DISCOVERED_SERVICES,
      g_param_spec_boxed ("discovered-services", "Discovered Services",
          "Discovered Ytstenut Service Information",
          TP_YTS_HASH_TYPE_CONTACT_SERVICE_MAP,
          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));

  /**
   * TpYtsStatus:discovered-statuses:
   *
   * Get the discovered Ytstenut statuses for services. The hash table is of
   * #TP_YTS_HASH_TYPE_CONTACT_CAPABILITY_MAP type, and has the following
   * contents:
   *
   * <code><literallayout>
   *    GHashTable (
   *        gchar *contact_id,
   *        GHashTable (
   *            gchar *capability,
   *            GHashTable (
   *                gchar *service_name,
   *                gchar *status_xml
   *            )
   *        )
   *    )
   * </literallayout></code>
   */
  g_object_class_install_property (object_class, PROP_DISCOVERED_STATUSES,
      g_param_spec_boxed ("discovered-statuses", "Discovered Statuses",
          "Discovered Ytstenut Status Information",
          TP_YTS_HASH_TYPE_CONTACT_CAPABILITY_MAP,
          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));

  /**
   * TpYtsStatus::service-added:
   * @status: the #TpYtsStatus
   * @contact_id: The contact for the device on which a service was added.
   * @service_name: The name of the service which was added.
   * @service: Details of the service added.
   *
   * This signal is emitted when we discover that a Ytstenut service
   * has been advertised by a contact. The
   * #TpYtsStatus:discovered-services property will have been updated
   * before this signal is emitted.
   *
   * @service is a #GValueArray like this:
   *
   *
   * <code><literallayout>
   *    GValueArray (
   *        gchar *service_type,
   *            GHashTable (
   *                gchar *language,
   *                gchar *localized_name
   *            )
   *            gchar **capabilities
   *        )
   * </literallayout></code>
   */
  signals[SERVICE_ADDED] =
    g_signal_new ("service-added",
      G_TYPE_FROM_CLASS (klass),
      G_SIGNAL_RUN_LAST, 0,
      NULL, NULL,
      _tp_yts_marshal_VOID__STRING_STRING_BOXED,
      G_TYPE_NONE,
      3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_VALUE_ARRAY);

  /**
   * TpYtsStatus::service-removed:
   * @status: a #TpYtsStatus
   * @contact_id: The contact for the device on which a service was removed.
   * @service_name: The name of the service which was removed.
   *
   * This signal is emitted when we discover that a Ytstenut service
   * has been removed by a Contact. The
   * #TpYtsStatus:discovered-services property will have been updated
   * before this signal is emitted.
   */
  signals[SERVICE_REMOVED] =
    g_signal_new ("service_removed",
      G_TYPE_FROM_CLASS (klass),
      G_SIGNAL_RUN_LAST, 0,
      NULL, NULL,
      _tp_yts_marshal_VOID__STRING_STRING,
      G_TYPE_NONE,
      2, G_TYPE_STRING, G_TYPE_STRING);

  /**
   * TpYtsStatus::status-changed:
   * @status: a #TpYtsStatus
   * @contact_id: The contact for the device on which the status changed.
   * @capability: The capability for which the status changed.
   * @service_name: The name of the service whose status changed.
   * @status: The UTF-8 encoded XML Ytstetus status, or a empty string
   *   if the status was cleared.
   *
   * This signal is emitted when we discover that a Ytstenut service
   * has changed or cleared its status on one one of the devices on
   * the local network. The #TpYtsStatus:discovered-statuses property
   * will have been updated before this signal is emitted.
   */
  signals[STATUS_CHANGED] =
    g_signal_new ("status-changed",
      G_TYPE_FROM_CLASS (klass),
      G_SIGNAL_RUN_LAST, 0,
      NULL, NULL,
      _tp_yts_marshal_VOID__STRING_STRING_STRING_STRING,
      G_TYPE_NONE,
      4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);

  tp_proxy_init_known_interfaces ();
  tp_proxy_or_subclass_hook_on_interface_add (tp_type,
      tp_yts_status_add_signals);
  tp_proxy_subclass_add_error_mapping (tp_type,
      TP_ERROR_PREFIX, TP_ERROR, TP_TYPE_ERROR);
}