static void dialog_response_cb ( GtkWidget *dialog, gint response_id, gpointer user_data) { TpSimpleApprover *self = TP_SIMPLE_APPROVER (g_object_get_data (G_OBJECT (dialog), "client")); TpChannelDispatchOperation *cdo = TP_CHANNEL_DISPATCH_OPERATION (user_data); (void)self; /* suppress unused-parameter warning (could remove TP_SIMPLE_APPROVER above?) */ if (response_id == GTK_RESPONSE_ACCEPT) { g_print ("Approve channels\n"); tp_channel_dispatch_operation_handle_with_async (cdo, NULL, handle_with_cb, dialog); gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT, FALSE); gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_REJECT, FALSE); } else { g_print ("Reject channels\n"); tp_channel_dispatch_operation_close_channels_async (cdo, close_cb, dialog); gtk_widget_destroy (dialog); } g_object_unref (cdo); }
static void close_cb (GObject *source, GAsyncResult *result, gpointer user_data) { TpChannelDispatchOperation *cdo = TP_CHANNEL_DISPATCH_OPERATION (source); GError *error = NULL; (void)user_data; /* suppress unused-parameter warning */ if (!tp_channel_dispatch_operation_close_channels_finish (cdo, result, &error)) { g_print ("Rejecting channels failed: %s\n", error->message); g_error_free (error); return; } g_print ("Rejected all the things!\n"); }
static void claim_and_leave_cb (GObject *source, GAsyncResult *result, gpointer user_data) { AutoRejectCtx *ctx = user_data; GError *error = NULL; if (!tp_channel_dispatch_operation_leave_channels_finish ( TP_CHANNEL_DISPATCH_OPERATION (source), result, &error)) { DEBUG ("Failed to reject call: %s", error->message); g_error_free (error); goto out; } display_reject_notification (ctx->self, ctx->main_channel); out: auto_reject_ctx_free (ctx); }
static void handle_with_cb (GObject *source, GAsyncResult *result, gpointer user_data) { TpChannelDispatchOperation *cdo = TP_CHANNEL_DISPATCH_OPERATION (source); GtkMessageDialog *dialog = GTK_MESSAGE_DIALOG (user_data); GError *error = NULL; if (!tp_channel_dispatch_operation_handle_with_finish (cdo, result, &error)) { g_print ("HandleWith() failed: %s\n", error->message); gtk_message_dialog_format_secondary_markup (dialog, "<b>Error</b>\n\nAsking LibreOffice to accept the session failed: <i>%s</i>", error->message); g_error_free (error); return; } g_print ("HandleWith() succeeded\n"); gtk_widget_destroy (GTK_WIDGET (dialog)); }