/**
 * empathy_ft_handler_new_incoming:
 * @tp_file: the #EmpathyTpFile wrapping the incoming channel
 * @callback: callback to be called when the handler has been created
 * @user_data: user data to be passed to @callback
 *
 * Triggers the creation of a new #EmpathyFTHandler for an incoming transfer.
 * Note that for the handler to be useful, you will have to set a destination
 * file with empathy_ft_handler_incoming_set_destination() after the handler
 * is ready.
 */
void
empathy_ft_handler_new_incoming (EmpathyTpFile *tp_file,
    EmpathyFTHandlerReadyCallback callback,
    gpointer user_data)
{
  EmpathyFTHandler *handler;
  TpChannel *channel;
  CallbacksData *data;

  g_return_if_fail (EMPATHY_IS_TP_FILE (tp_file));

  handler = g_object_new (EMPATHY_TYPE_FT_HANDLER,
      "tp-file", tp_file, NULL);

  g_object_get (tp_file, "channel", &channel, NULL);

  data = g_slice_new0 (CallbacksData);
  data->callback = callback;
  data->user_data = user_data;
  data->handler = g_object_ref (handler);

  tp_cli_dbus_properties_call_get_all (channel,
      -1, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER,
      channel_get_all_properties_cb, data, NULL, G_OBJECT (handler));
}
Пример #2
0
static void
polari_room_set_channel (PolariRoom *room,
                         TpChannel  *channel)
{
  PolariRoomPrivate *priv;

  g_return_if_fail (POLARI_IS_ROOM (room));
  g_return_if_fail (channel == NULL || TP_IS_TEXT_CHANNEL (channel));

  priv = room->priv;

  if (priv->channel == channel)
    return;

  if (priv->channel)
    {
      g_signal_handler_disconnect (priv->channel, priv->identifier_notify_id);
      g_signal_handler_disconnect (priv->channel, priv->group_contacts_changed_id);

      tp_proxy_signal_connection_disconnect (priv->properties_changed_id);

      g_clear_object (&priv->channel);
    }

  if (channel)
    {
      priv->channel = g_object_ref (channel);

      if (priv->id == NULL)
        priv->id = g_strdup (tp_proxy_get_object_path (TP_PROXY (channel)));

      tp_cli_dbus_properties_call_get_all (channel, -1,
                                     TP_IFACE_CHANNEL_INTERFACE_SUBJECT,
                                     (tp_properties_get_all_cb)subject_get_all,
                                     room, NULL, NULL);


      priv->identifier_notify_id =
        g_signal_connect (channel, "notify::identifier",
                          G_CALLBACK (on_identifier_notify), room);
      priv->group_contacts_changed_id =
        g_signal_connect (channel, "group-contacts-changed",
                          G_CALLBACK (on_group_contacts_changed), room);
      priv->properties_changed_id =
        tp_cli_dbus_properties_connect_to_properties_changed (
                                 channel,
                                 (tp_properties_changed_cb) properties_changed,
                                 room, NULL, NULL, NULL);
    }

    g_object_freeze_notify (G_OBJECT (room));

    update_identifier (room);
    update_icon (room);

    g_object_notify_by_pspec (G_OBJECT (room), props[PROP_CHANNEL]);

    g_object_thaw_notify (G_OBJECT (room));
}
static void
tp_yts_status_init_async (GAsyncInitable *initable,
    int io_priority,
    GCancellable *cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data)
{
  TpYtsStatus *self = TP_YTS_STATUS (initable);
  GSimpleAsyncResult *res;

  res = g_simple_async_result_new (G_OBJECT (self), callback, user_data,
      tp_yts_status_init_async);

  tp_cli_dbus_properties_call_get_all (self, -1, TP_YTS_IFACE_STATUS,
      on_properties_get_all_returned, res, g_object_unref, G_OBJECT (self));
}
Пример #4
0
void
empathy_account_refresh_properties (EmpathyAccount *account)
{
  EmpathyAccountPriv *priv;

  g_return_if_fail (EMPATHY_IS_ACCOUNT (account));

  priv = GET_PRIV (account);

  tp_cli_dbus_properties_call_get_all (priv->account, -1,
    TP_IFACE_ACCOUNT,
    empathy_account_got_all_cb,
    NULL,
    NULL,
    G_OBJECT (account));
}
Пример #5
0
static void
tp_call_stream_constructed (GObject *obj)
{
  TpCallStream *self = (TpCallStream *) obj;

  ((GObjectClass *) tp_call_stream_parent_class)->constructed (obj);

  /* Connect signals for mutable properties */
  tp_cli_call_stream_connect_to_remote_members_changed (self,
      remote_members_changed_cb, NULL, NULL, G_OBJECT (self), NULL);
  tp_cli_call_stream_connect_to_local_sending_state_changed (self,
      local_sending_state_changed_cb, NULL, NULL, G_OBJECT (self), NULL);

  tp_cli_dbus_properties_call_get_all (self, -1,
      TP_IFACE_CALL_STREAM,
      got_all_properties_cb, NULL, NULL, G_OBJECT (self));
}
void hev_impathy_tls_certificate_prepare_async(HevImpathyTLSCertificate *self,
			GAsyncReadyCallback callback, gpointer user_data)
{
	HevImpathyTLSCertificatePrivate *priv = NULL;

	g_debug("%s:%d[%s]", __FILE__, __LINE__, __FUNCTION__);

	g_return_if_fail(HEV_IS_IMPATHY_TLS_CERTIFICATE(self));
	priv = HEV_IMPATHY_TLS_CERTIFICATE_GET_PRIVATE(self);

	/* emit an error if we're already preparing the object */
	if(NULL != priv->async_prepare_res)
	{
		g_simple_async_report_error_in_idle(G_OBJECT(self),
					callback, user_data,
					G_IO_ERROR, G_IO_ERROR_PENDING,
					"%s",
					"Prepare operation already in progress"
					" on the TLS certificate.");
		return;
	}

	/* if the object is already prepared, just complete in idle */
	if(priv->is_prepared)
	{
		tp_simple_async_report_success_in_idle(G_OBJECT(self),
					callback, user_data,
					hev_impathy_tls_certificate_prepare_async);
		return;
	}

	priv->async_prepare_res = g_simple_async_result_new(G_OBJECT(self),
				callback, user_data,
				hev_impathy_tls_certificate_prepare_async);

	/* call GetAll() on the certificate */
	tp_cli_dbus_properties_call_get_all(self,
				-1, TP_IFACE_AUTHENTICATION_TLS_CERTIFICATE,
				tls_certificate_got_all_handler, NULL, NULL,
				G_OBJECT(self));
}
void
empathy_tls_certificate_prepare_async (EmpathyTLSCertificate *self,
    GAsyncReadyCallback callback,
    gpointer user_data)
{
  EmpathyTLSCertificatePriv *priv = GET_PRIV (self);

  /* emit an error if we're already preparing the object */
  if (priv->async_prepare_res != NULL)
    {
      g_simple_async_report_error_in_idle (G_OBJECT (self),
          callback, user_data,
          G_IO_ERROR, G_IO_ERROR_PENDING,
          "%s",
          "Prepare operation already in progress on the TLS certificate.");

      return;
    }

  /* if the object is already prepared, just complete in idle */
  if (priv->is_prepared)
    {
      tp_simple_async_report_success_in_idle (G_OBJECT (self),
          callback, user_data, empathy_tls_certificate_prepare_async);

      return;
    }

  priv->async_prepare_res = g_simple_async_result_new (G_OBJECT (self),
      callback, user_data, empathy_tls_certificate_prepare_async);

  /* call GetAll() on the certificate */
  tp_cli_dbus_properties_call_get_all (self,
      -1, EMP_IFACE_AUTHENTICATION_TLS_CERTIFICATE,
      tls_certificate_got_all_cb, NULL, NULL,
      G_OBJECT (self));
}
static void
tpy_call_channel_prepare_core_async (TpProxy *proxy,
    const TpProxyFeature *feature,
    GAsyncReadyCallback callback,
    gpointer user_data)
{
  TpyCallChannel *self = (TpyCallChannel *) proxy;
  GSimpleAsyncResult *result;
  GError *err = NULL;

  result = g_simple_async_result_new ((GObject *) proxy, callback, user_data,
      tpy_call_channel_prepare_core_async);

  tpy_cli_channel_type_call_connect_to_content_added (TP_PROXY (self),
      on_content_added_cb, NULL, NULL, NULL, &err);

  if (err != NULL)
    {
      g_critical ("Failed to connect to ContentAdded signal: %s",
          err->message);

      goto failed;
    }

  tpy_cli_channel_type_call_connect_to_content_removed (TP_PROXY (self),
      on_content_removed_cb, NULL, NULL, NULL, &err);

  if (err != NULL)
    {
      g_critical ("Failed to connect to ContentRemoved signal: %s",
          err->message);

      goto failed;
    }

  tpy_cli_channel_type_call_connect_to_call_state_changed (TP_PROXY (self),
      on_call_state_changed_cb, NULL, NULL, NULL, &err);

  if (err != NULL)
    {
      g_critical ("Failed to connect to CallStateChanged signal: %s",
          err->message);

      goto failed;
    }

  tpy_cli_channel_type_call_connect_to_call_members_changed (TP_PROXY (self),
      on_call_members_changed_cb, NULL, NULL, NULL, &err);

  if (err != NULL)
    {
      g_critical ("Failed to connect to CallMembersChanged signal: %s",
          err->message);

      goto failed;
    }

  tp_cli_dbus_properties_call_get_all (self, -1,
      TPY_IFACE_CHANNEL_TYPE_CALL,
      on_call_channel_get_all_properties_cb, result, g_object_unref, NULL);

  return;

failed:
  g_simple_async_result_take_error (result, err);
  g_simple_async_result_complete_in_idle (result);
  g_object_unref (result);
}