Merge branch 'matthiasc/for-main' into 'main'

Be consistent in preconditions for async API

See merge request GNOME/gtk!5186
This commit is contained in:
Matthias Clasen 2022-10-31 21:15:10 +00:00
commit 1a8ff606f2
5 changed files with 31 additions and 26 deletions

View File

@ -733,11 +733,11 @@ int
gtk_alert_dialog_choose_finish (GtkAlertDialog *self,
GAsyncResult *result)
{
GTask *task = G_TASK (result);
g_return_val_if_fail (GTK_IS_ALERT_DIALOG (self), -1);
g_return_val_if_fail (g_task_is_valid (result, self), -1);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_alert_dialog_choose, -1);
g_return_val_if_fail (g_task_get_source_tag (task) == gtk_alert_dialog_choose, -1);
return (int) g_task_propagate_int (task, NULL);
return (int) g_task_propagate_int (G_TASK (result), NULL);
}
/**

View File

@ -487,6 +487,7 @@ gtk_color_dialog_choose_rgba_finish (GtkColorDialog *self,
GError **error)
{
g_return_val_if_fail (GTK_IS_COLOR_DIALOG (self), NULL);
g_return_val_if_fail (g_task_is_valid (result, self), NULL);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_color_dialog_choose_rgba, NULL);
return g_task_propagate_pointer (G_TASK (result), error);

View File

@ -801,11 +801,11 @@ gtk_file_dialog_open_finish (GtkFileDialog *self,
GAsyncResult *result,
GError **error)
{
GTask *task = G_TASK (result);
g_return_val_if_fail (GTK_IS_FILE_DIALOG (self), NULL);
g_return_val_if_fail (g_task_is_valid (result, self), NULL);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_file_dialog_open, NULL);
g_return_val_if_fail (g_task_get_source_tag (task) == gtk_file_dialog_open, NULL);
return finish_file_op (self, task, error);
return finish_file_op (self, G_TASK (result), error);
}
/**
@ -877,11 +877,11 @@ gtk_file_dialog_select_folder_finish (GtkFileDialog *self,
GAsyncResult *result,
GError **error)
{
GTask *task = G_TASK (result);
g_return_val_if_fail (GTK_IS_FILE_DIALOG (self), NULL);
g_return_val_if_fail (g_task_is_valid (result, self), NULL);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_file_dialog_select_folder, NULL);
g_return_val_if_fail (g_task_get_source_tag (task) == gtk_file_dialog_select_folder, NULL);
return finish_file_op (self, task, error);
return finish_file_op (self, G_TASK (result), error);
}
/**
@ -958,11 +958,11 @@ gtk_file_dialog_save_finish (GtkFileDialog *self,
GAsyncResult *result,
GError **error)
{
GTask *task = G_TASK (result);
g_return_val_if_fail (GTK_IS_FILE_DIALOG (self), NULL);
g_return_val_if_fail (g_task_is_valid (result, self), NULL);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_file_dialog_save, NULL);
g_return_val_if_fail (g_task_get_source_tag (task) == gtk_file_dialog_save, NULL);
return finish_file_op (self, task, error);
return finish_file_op (self, G_TASK (result), error);
}
/**
@ -1032,11 +1032,11 @@ gtk_file_dialog_open_multiple_finish (GtkFileDialog *self,
GAsyncResult *result,
GError **error)
{
GTask *task = G_TASK (result);
g_return_val_if_fail (GTK_IS_FILE_DIALOG (self), NULL);
g_return_val_if_fail (g_task_is_valid (result, self), NULL);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_file_dialog_open_multiple, NULL);
g_return_val_if_fail (g_task_get_source_tag (task) == gtk_file_dialog_open_multiple, NULL);
return finish_multiple_files_op (self, task, error);
return finish_multiple_files_op (self, G_TASK (result), error);
}
/**
@ -1106,11 +1106,11 @@ gtk_file_dialog_select_multiple_folders_finish (GtkFileDialog *self,
GAsyncResult *result,
GError **error)
{
GTask *task = G_TASK (result);
g_return_val_if_fail (GTK_IS_FILE_DIALOG (self), NULL);
g_return_val_if_fail (g_task_is_valid (result, self), NULL);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_file_dialog_select_multiple_folders, NULL);
g_return_val_if_fail (g_task_get_source_tag (task) == gtk_file_dialog_select_multiple_folders, NULL);
return finish_multiple_files_op (self, task, error);
return finish_multiple_files_op (self, G_TASK (result), error);
}
/* }}} */

View File

@ -691,6 +691,7 @@ gtk_font_dialog_choose_family_finish (GtkFontDialog *self,
GError **error)
{
g_return_val_if_fail (GTK_IS_FONT_DIALOG (self), NULL);
g_return_val_if_fail (g_task_is_valid (result, self), NULL);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_font_dialog_choose_family, NULL);
return g_task_propagate_pointer (G_TASK (result), error);
@ -769,6 +770,7 @@ gtk_font_dialog_choose_face_finish (GtkFontDialog *self,
GError **error)
{
g_return_val_if_fail (GTK_IS_FONT_DIALOG (self), NULL);
g_return_val_if_fail (g_task_is_valid (result, self), NULL);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_font_dialog_choose_face, NULL);
return g_task_propagate_pointer (G_TASK (result), NULL);
@ -845,6 +847,7 @@ gtk_font_dialog_choose_font_finish (GtkFontDialog *self,
GError **error)
{
g_return_val_if_fail (GTK_IS_FONT_DIALOG (self), NULL);
g_return_val_if_fail (g_task_is_valid (result, self), NULL);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_font_dialog_choose_font, NULL);
return g_task_propagate_pointer (G_TASK (result), NULL);
@ -932,6 +935,7 @@ gtk_font_dialog_choose_font_and_features_finish (GtkFontDialog *self,
FontResult *font_result;
g_return_val_if_fail (GTK_IS_FONT_DIALOG (self), FALSE);
g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_font_dialog_choose_font_and_features, FALSE);
font_result = g_task_propagate_pointer (G_TASK (result), error);

View File

@ -125,7 +125,7 @@ gtk_show_uri_full (GtkWindow *parent,
data->context = G_APP_LAUNCH_CONTEXT (context);
data->uri = g_strdup (uri);
data->task = g_task_new (parent, cancellable, callback, user_data);
g_task_set_source_tag (data->task, gtk_show_uri);
g_task_set_source_tag (data->task, gtk_show_uri_full);
if (!parent || !gtk_window_export_handle (parent, window_handle_exported, data))
window_handle_exported (parent, NULL, data);
@ -150,7 +150,7 @@ gtk_show_uri_full_finish (GtkWindow *parent,
{
g_return_val_if_fail (parent == NULL || GTK_IS_WINDOW (parent), FALSE);
g_return_val_if_fail (g_task_is_valid (result, parent), FALSE);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_show_uri, FALSE);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_show_uri_full, FALSE);
return g_task_propagate_boolean (G_TASK (result), error);
}