# HG changeset patch # User Olaf Wintermann # Date 1784138613 -7200 # Node ID 943fc009bd1c42e98968d9dd64d3b4278b250499 # Parent c1d4c331c28bb4ce9fd36957eb827046e529a6d0 add ui_open_file (GTK) diff -r c1d4c331c28b -r 943fc009bd1c application/main.c --- a/application/main.c Sat Jul 04 17:46:17 2026 +0200 +++ b/application/main.c Wed Jul 15 20:03:33 2026 +0200 @@ -698,7 +698,6 @@ ui_list_append(menu_list, "menu list item 3"); - UiObject *obj = ui_splitview_window("Test", TRUE); MyDocument *doc = create_doc(); diff -r c1d4c331c28b -r 943fc009bd1c ui/gtk/toolkit.c --- a/ui/gtk/toolkit.c Sat Jul 04 17:46:17 2026 +0200 +++ b/ui/gtk/toolkit.c Wed Jul 15 20:03:33 2026 +0200 @@ -579,3 +579,10 @@ // TODO: call xdg-open #endif } + +void ui_open_file(const char *path) { + GFile *file = g_file_new_for_path(path); + GError *error = NULL; + g_app_info_launch_default_for_uri(g_file_get_uri(file), NULL, &error); + g_object_unref(file); +} diff -r c1d4c331c28b -r 943fc009bd1c ui/ui/toolkit.h --- a/ui/ui/toolkit.h Sat Jul 04 17:46:17 2026 +0200 +++ b/ui/ui/toolkit.h Wed Jul 15 20:03:33 2026 +0200 @@ -795,6 +795,7 @@ UIEXPORT void ui_app_unref(void); UIEXPORT void ui_open_uri(const char *uri); +UIEXPORT void ui_open_file(const char *path); #ifdef __cplusplus }