kwo pushed a commit to branch master.

http://git.enlightenment.org/e16/e16.git/commit/?id=95d47591cf3d98d9b02d9c94fe61a38d89be3480

commit 95d47591cf3d98d9b02d9c94fe61a38d89be3480
Author: Kim Woelders <[email protected]>
Date:   Thu Mar 10 19:15:12 2022 +0100

    containers: Configuration saving tweaks
    
    - Don't save configuration on exit.
      We already save it whenever it changes.
    - Update configuration file atomically.
---
 src/container.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/src/container.c b/src/container.c
index 5d39b992..b032b910 100644
--- a/src/container.c
+++ b/src/container.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various 
contributors
- * Copyright (C) 2004-2021 Kim Woelders
+ * Copyright (C) 2004-2022 Kim Woelders
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
@@ -31,6 +31,7 @@
 #include "emodule.h"
 #include "eobj.h"
 #include "ewins.h"
+#include "file.h"
 #include "hints.h"
 #include "iclass.h"
 #include "icons.h"
@@ -1212,15 +1213,6 @@ ContainersShow(void)
      }
 }
 
-static void
-ContainersDestroy(void)
-{
-   Container          *ct, *tmp;
-
-   LIST_FOR_EACH_SAFE(Container, &container_list, ct, tmp)
-      ContainerDestroy(ct, 1);
-}
-
 static void
 ContainerEventScrollWin(Win win __UNUSED__, XEvent * ev, void *prm)
 {
@@ -1842,11 +1834,11 @@ ContainersConfigLoad(void)
 static void
 ContainersConfigSave(void)
 {
-   char                s[FILEPATH_LEN_MAX];
+   char                s[FILEPATH_LEN_MAX], st[FILEPATH_LEN_MAX];
    FILE               *fs;
    Container          *ct;
 
-   Esnprintf(s, sizeof(s), "%s.ibox", EGetSavePrefix());
+   Etmp(st);
    fs = fopen(s, "w");
    if (!fs)
       return;
@@ -1873,6 +1865,9 @@ ContainersConfigSave(void)
    }
 
    fclose(fs);
+
+   Esnprintf(s, sizeof(s), "%s.ibox", EGetSavePrefix());
+   E_mv(st, s);
 }
 
 /*
@@ -1890,9 +1885,6 @@ ContainersSighan(int sig, void *prm)
        ContainersConfigLoad();
        ContainersShow();
        break;
-     case ESIGNAL_EXIT:
-       ContainersDestroy();
-       break;
      }
 
 #if 0                          /* FIXME */

-- 


Reply via email to