]> uap-core.de Git - mizunara.git/commitdiff
handle error in filebrowser_op_finished master
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Thu, 9 Jul 2026 19:18:54 +0000 (21:18 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Thu, 9 Jul 2026 19:18:54 +0000 (21:18 +0200)
mizunara/filebrowser.c
mizunara/window.c

index 51603fa91242a1a881e94052a413212d13aff473..fb98d4c43f2e0d315bd9187033e42914bbbde3be 100644 (file)
@@ -35,6 +35,7 @@
 #include <sys/stat.h>
 
 #include <cx/array_list.h>
+#include <cx/printf.h>
 
 
 FileBrowser* filebrowser_new(const char *url) {
@@ -148,8 +149,6 @@ void filebrowser_op_finished(UiEvent *event, void *data) {
             memset(section, 0, sizeof(FilesSection));
             section->files = op->result;
             section->parent_url = op->url;
-            op->result = NULL;
-            op->url = NULL;
               
             // update_grid takes ownership of section
             if(browser->update_grid) {
@@ -164,12 +163,20 @@ void filebrowser_op_finished(UiEvent *event, void *data) {
                 ui_list_append(browser->list_files, file);
             }
             browser->list_files_parent = op->url;
-            op->url = NULL;
             ui_list_update(browser->list_files);
-            op->result = NULL;
         }
+        
+        op->result = NULL;
+        op->url = NULL;
     } else {
-        // TODO: error msg
+        cxmutstr errormsg = cx_asprintf("Cannot open directory: %s", strerror(op->error));
+        
+        ui_dialog(browser->window->obj,
+                .title = "Error",
+                .content = errormsg.ptr,
+                .closebutton_label = "OK");
+        
+        free(errormsg.ptr);
     }
     
     cxListFree(op->result);
index 9ff4f6781a09adb237def280ae7832a555299a53..b564f6c19b37ff1d8f18b4ad10dc080ceea4193f 100644 (file)
@@ -55,14 +55,6 @@ void window_update_gridview(
     mz_update_files_view((MzFilesView*)win->files_gridview, sections, numsections);
 }
 
-#ifdef UI_LIBADWAITA
-
-void libadwaita_headerbar_add() {
-    
-}
-
-#endif
-
 UiObject* window_create(const char *url) {
     // toplevel window object
     UiObject *obj = ui_sidebar_window("Mizunara");