static void request_connection_cb (TpConnectionManager *cm, const char *bus_name, const char *object_path, const GError *in_error, gpointer user_data, GObject *weak_object) { char **argv = (char **) user_data; GError *error = NULL; if (in_error) g_error ("%s", in_error->message); conn = tp_connection_new (bus_daemon, bus_name, object_path, &error); if (error) g_error ("%s", error->message); tp_connection_call_when_ready (conn, conn_ready, argv); tp_cli_connection_connect_to_status_changed (conn, status_changed_cb, NULL, NULL, NULL, &error); handle_error (error); /* initiate the connection */ tp_cli_connection_call_connect (conn, -1, NULL, NULL, NULL, NULL); }
static void tp_contact_list_constructed (GObject *list) { EmpathyTpContactListPriv *priv = GET_PRIV (list); tp_connection_call_when_ready (priv->connection, conn_ready_cb, g_object_ref (list)); }
static void _status_changed (PresenceChooser *self, guint old_status, guint new_status, guint reason, TpAccount *account) { TpConnection *conn = tp_account_get_connection (account); if (conn == NULL) return; else if (new_status == TP_CONNECTION_STATUS_CONNECTED || new_status == TP_CONNECTION_STATUS_DISCONNECTED) { tp_connection_call_when_ready (conn, _connection_ready, self); } }
static GObject * tp_contact_factory_constructor (GType type, guint n_props, GObjectConstructParam *props) { GObject *tp_factory; EmpathyTpContactFactoryPriv *priv; tp_factory = G_OBJECT_CLASS (empathy_tp_contact_factory_parent_class)->constructor (type, n_props, props); priv = GET_PRIV (tp_factory); /* Ensure to keep the self object alive while the call_when_ready is * running */ g_object_ref (tp_factory); tp_connection_call_when_ready (priv->connection, connection_ready_cb, tp_factory); return tp_factory; }
static void _empathy_account_set_connection (EmpathyAccount *account, const gchar *path) { EmpathyAccountPriv *priv = GET_PRIV (account); if (priv->connection != NULL) { const gchar *current; current = tp_proxy_get_object_path (priv->connection); if (!tp_strdiff (current, path)) return; } empathy_account_free_connection (account); if (tp_strdiff ("/", path)) { GError *error = NULL; priv->connection = tp_connection_new (priv->dbus, NULL, path, &error); if (priv->connection == NULL) { DEBUG ("Failed to create a new TpConnection: %s", error->message); g_error_free (error); } else { priv->connection_invalidated_id = g_signal_connect (priv->connection, "invalidated", G_CALLBACK (_empathy_account_connection_invalidated_cb), account); DEBUG ("Readying connection for %s", priv->unique_name); /* notify a change in the connection property when it's ready */ tp_connection_call_when_ready (priv->connection, empathy_account_connection_ready_cb, account); } } g_object_notify (G_OBJECT (account), "connection"); }
static void account_manager_update_connection (EmpathyAccountManager *manager, AccountData *data, McAccount *account) { EmpathyAccountManagerPriv *priv = GET_PRIV (manager); if (data->connection) return; data->connection = mission_control_get_tpconnection (priv->mc, account, NULL); if (data->connection != NULL) { g_signal_connect (data->connection, "invalidated", G_CALLBACK (connection_invalidated_cb), manager); g_hash_table_insert (priv->connections, g_object_ref (data->connection), g_object_ref (account)); tp_connection_call_when_ready (data->connection, connection_ready_cb, manager); } }
static void remmina_tp_channel_handler_account_ready(GObject *account, GAsyncResult *res, gpointer user_data) { RemminaTpChannelHandler *chandler = (RemminaTpChannelHandler *) user_data; GError *error = NULL; if (!tp_account_prepare_finish(TP_ACCOUNT(account), res, &error)) { g_print("tp_account_prepare_finish: %s\n", error->message); remmina_tp_channel_handler_free(chandler); return; } chandler->connection = tp_connection_new(chandler->bus, NULL, chandler->connection_path, &error); if (chandler->connection == NULL) { g_print("tp_connection_new: %s\n", error->message); remmina_tp_channel_handler_free(chandler); return; } tp_connection_call_when_ready(chandler->connection, remmina_tp_channel_handler_connection_ready, chandler); }