Don't eat application launch errors

This commit is contained in:
Přemysl Eric Janouch 2022-07-23 17:28:55 +02:00
parent f94171fcf2
commit 4e84d6a802
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 6 additions and 3 deletions

View File

@ -45,12 +45,15 @@ open_context_launch(GtkWidget *widget, OpenContext *self)
gdk_app_launch_context_set_screen(context, gtk_widget_get_screen(widget));
gdk_app_launch_context_set_timestamp(context, gtk_get_current_event_time());
// TODO(p): Display errors.
GList *files = g_list_append(NULL, self->file);
GError *error = NULL;
if (g_app_info_launch(
self->app_info, files, G_APP_LAUNCH_CONTEXT(context), NULL)) {
g_app_info_set_as_last_used_for_type(
self->app_info, files, G_APP_LAUNCH_CONTEXT(context), &error)) {
(void) g_app_info_set_as_last_used_for_type(
self->app_info, self->content_type, NULL);
} else {
g_warning("%s", error->message);
g_error_free(error);
}
g_list_free(files);
g_object_unref(context);