From 4e84d6a802f663153aca673f9bccbc45de8e5616 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Sat, 23 Jul 2022 17:28:55 +0200 Subject: Don't eat application launch errors --- fiv-context-menu.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fiv-context-menu.c b/fiv-context-menu.c index 387969b..1a4b022 100644 --- a/fiv-context-menu.c +++ b/fiv-context-menu.c @@ -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); -- cgit v1.2.3-70-g09d2