Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package otpclient for openSUSE:Factory 
checked in at 2023-10-25 18:03:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/otpclient (Old)
 and      /work/SRC/openSUSE:Factory/.otpclient.new.24901 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "otpclient"

Wed Oct 25 18:03:51 2023 rev:29 rq:1120185 version:3.2.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/otpclient/otpclient.changes      2023-07-03 
17:44:47.157425257 +0200
+++ /work/SRC/openSUSE:Factory/.otpclient.new.24901/otpclient.changes   
2023-10-25 18:04:40.998197539 +0200
@@ -1,0 +2,10 @@
+Wed Oct 25 07:32:29 UTC 2023 - Paolo Stivanin <i...@paolostivanin.com>
+
+- Update to 3.2.0:
+  * NEW: add file chooser dialog on export (#305).
+  * FIX: overwrite exported file instead of appending it (#305).
+  * FIX: exported file will be accessible only by the current user (#305).
+  * FIX: multiple issues related to failed first launch (#303).
+  * FIX: couple of issues with secret-service.
+
+-------------------------------------------------------------------

Old:
----
  v3.1.9.tar.gz
  v3.1.9.tar.gz.asc

New:
----
  v3.2.0.tar.gz
  v3.2.0.tar.gz.asc

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ otpclient.spec ++++++
--- /var/tmp/diff_new_pack.YGCrCb/_old  2023-10-25 18:04:42.642252831 +0200
+++ /var/tmp/diff_new_pack.YGCrCb/_new  2023-10-25 18:04:42.646252966 +0200
@@ -18,7 +18,7 @@
 
 %define uclname OTPClient
 Name:           otpclient
-Version:        3.1.9
+Version:        3.2.0
 Release:        0
 Summary:        Simple GTK+ client for managing TOTP and HOTP
 License:        GPL-3.0-or-later


++++++ v3.1.9.tar.gz -> v3.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OTPClient-3.1.9/CMakeLists.txt 
new/OTPClient-3.2.0/CMakeLists.txt
--- old/OTPClient-3.1.9/CMakeLists.txt  2023-07-03 15:34:59.000000000 +0200
+++ new/OTPClient-3.2.0/CMakeLists.txt  2023-10-25 09:29:16.000000000 +0200
@@ -1,5 +1,5 @@
 cmake_minimum_required(VERSION 3.16)
-project(OTPClient VERSION "3.1.9" LANGUAGES "C")
+project(OTPClient VERSION "3.2.0" LANGUAGES "C")
 include(GNUInstallDirs)
 
 configure_file("src/common/version.h.in" "version.h")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OTPClient-3.1.9/SECURITY.md 
new/OTPClient-3.2.0/SECURITY.md
--- old/OTPClient-3.1.9/SECURITY.md     2023-07-03 15:34:59.000000000 +0200
+++ new/OTPClient-3.2.0/SECURITY.md     2023-10-25 09:29:16.000000000 +0200
@@ -6,7 +6,8 @@
 
 | Version | Supported          | EOL         |
 |---------|--------------------|-------------|
-| 3.1.x   | :heavy_check_mark: | -           |
+| 3.2.x   | :white_check_mark: | -           |
+| 3.1.x   | :white_check_mark: | 30-Nov-2023 |
 | 3.0.x   | :x:                | 31-Dec-2022 |
 | 2.6.x   | :x:                | 15-Jan-2023 |
 | 2.5.x   | :x:                | 31-Aug-2022 |
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/OTPClient-3.1.9/data/com.github.paolostivanin.OTPClient.appdata.xml 
new/OTPClient-3.2.0/data/com.github.paolostivanin.OTPClient.appdata.xml
--- old/OTPClient-3.1.9/data/com.github.paolostivanin.OTPClient.appdata.xml     
2023-07-03 15:34:59.000000000 +0200
+++ new/OTPClient-3.2.0/data/com.github.paolostivanin.OTPClient.appdata.xml     
2023-10-25 09:29:16.000000000 +0200
@@ -84,6 +84,18 @@
   </content_rating>
 
   <releases>
+    <release version="3.2.0" date="2023-10-25">
+      <description>
+        <p>OTPClient 3.2.0 fixes a couple of issues.</p>
+        <ul>
+          <li>NEW: add file chooser dialog on export (#305)</li>
+          <li>FIX: overwrite exported file instead of appending it (#305)</li>
+          <li>FIX: exported file will be accessible only by the current user 
(#305)</li>
+          <li>FIX: multiple issues related to failed first launch (#303)</li>
+          <li>FIX: couple of issues with secret-service</li>
+        </ul>
+      </description>
+    </release>
     <release version="3.1.9" date="2023-07-03">
       <description>
         <p>OTPClient 3.1.9 brings a couple of fixes:</p>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OTPClient-3.1.9/src/app.c 
new/OTPClient-3.2.0/src/app.c
--- old/OTPClient-3.1.9/src/app.c       2023-07-03 15:34:59.000000000 +0200
+++ new/OTPClient-3.2.0/src/app.c       2023-10-25 09:29:16.000000000 +0200
@@ -25,7 +25,6 @@
 #include "show-qr-cb.h"
 #include "dbinfo-cb.h"
 
-
 #ifndef USE_FLATPAK_APP_FOLDER
 static gchar     *get_db_path               (AppData            *app_data);
 #endif
@@ -214,8 +213,6 @@
                 g_free (app_data);
                 g_application_quit (G_APPLICATION(app));
                 return;
-            } else {
-                goto retry;
             }
         }
     }
@@ -606,12 +603,12 @@
     }
     new_db: ; // empty statement workaround
     GtkFileChooserNative *dialog = gtk_file_chooser_native_new (_("Select 
database location"),
-                                                                GTK_WINDOW 
(app_data->main_window),
+                                                                
GTK_WINDOW(app_data->main_window),
                                                                 
app_data->open_db_file_action,
                                                                 "OK",
                                                                 "Cancel");
 
-    GtkFileChooser *chooser = GTK_FILE_CHOOSER (dialog);
+    GtkFileChooser *chooser = GTK_FILE_CHOOSER(dialog);
     gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);
     gtk_file_chooser_set_select_multiple (chooser, FALSE);
     if (app_data->open_db_file_action == GTK_FILE_CHOOSER_ACTION_SAVE) {
@@ -629,6 +626,9 @@
         }
     }
 
+    // clear any password that may have been previously set, thus avoiding 
using a wrong password with a new database
+    secret_password_clear (OTPCLIENT_SCHEMA, NULL, on_password_cleared, NULL, 
"string", "main_pwd", NULL);
+
     g_object_unref (dialog);
 
     end:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OTPClient-3.1.9/src/change-db-cb.c 
new/OTPClient-3.2.0/src/change-db-cb.c
--- old/OTPClient-3.1.9/src/change-db-cb.c      2023-07-03 15:34:59.000000000 
+0200
+++ new/OTPClient-3.2.0/src/change-db-cb.c      2023-10-25 09:29:16.000000000 
+0200
@@ -1,10 +1,12 @@
 #include <gtk/gtk.h>
 #include <gcrypt.h>
+#include <libsecret/secret.h>
 #include "data.h"
 #include "message-dialogs.h"
 #include "db-misc.h"
 #include "password-cb.h"
 #include "db-actions.h"
+#include "secret-schema.h"
 
 
 void
@@ -36,6 +38,7 @@
                 update_cfg_file (app_data);
                 gcry_free (app_data->db_data->key);
                 app_data->db_data->key = prompt_for_password (app_data, NULL, 
NULL, FALSE);
+                secret_password_store (OTPCLIENT_SCHEMA, 
SECRET_COLLECTION_DEFAULT, "main_pwd", app_data->db_data->key, NULL, 
on_password_stored, NULL, "string", "main_pwd", NULL);
                 GError *err = NULL;
                 load_new_db (app_data, &err);
                 if (err != NULL) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OTPClient-3.1.9/src/change-file-cb.c 
new/OTPClient-3.2.0/src/change-file-cb.c
--- old/OTPClient-3.1.9/src/change-file-cb.c    2023-07-03 15:34:59.000000000 
+0200
+++ new/OTPClient-3.2.0/src/change-file-cb.c    2023-10-25 09:29:16.000000000 
+0200
@@ -1,61 +1,32 @@
 #include <gtk/gtk.h>
-#include <glib/gi18n.h>
+#include "new-db-cb.h"
+#include "change-db-cb.h"
 #include "db-misc.h"
 #include "message-dialogs.h"
 
 gboolean
 change_file (AppData *app_data)
 {
-    gboolean res = FALSE;
     GtkWidget *label = GTK_WIDGET(gtk_builder_get_object (app_data->builder, 
"diag_changefile_label_id"));
     gchar *partial_msg_start = g_markup_printf_escaped ("%s <span 
font_family=\"monospace\">%s</span>", "The currently selected file is:\n", 
app_data->db_data->db_path);
-    const gchar *partial_msg_end = "\n\nDo you want to change it?\n\n"
-                               "If you select <b>Yes</b>, you will be asked to 
pick another\n"
-                               "database and then you will be prompted for 
the\n"
-                               "decryption password.\n\n"
-                               "\nIf you select <b>No</b>, then the app will 
close.";
+    const gchar *partial_msg_end = "\n\nWhat would you like to do?";
     gchar *msg = g_strconcat (partial_msg_start, partial_msg_end, NULL);
     gtk_label_set_markup (GTK_LABEL(label), msg);
     g_free (msg);
     g_free (partial_msg_start);
 
-    GtkFileChooserNative *fl_diag;
+    gboolean res = FALSE;
     GtkWidget *diag_changefile = GTK_WIDGET(gtk_builder_get_object 
(app_data->builder, "diag_changefile_id"));
     gint result = gtk_dialog_run (GTK_DIALOG(diag_changefile));
     switch (result) {
+        case GTK_RESPONSE_ACCEPT:
+            // select an existing DB.
+            change_db_cb (NULL, NULL, app_data);
+            res = TRUE;
+            break;
         case GTK_RESPONSE_OK:
-            fl_diag = gtk_file_chooser_native_new ("Open File",
-                                            GTK_WINDOW(app_data->main_window),
-                                            GTK_FILE_CHOOSER_ACTION_OPEN,
-                                            "Open",
-                                            "Cancel");
-
-            gint native_diag_res = gtk_native_dialog_run 
(GTK_NATIVE_DIALOG(fl_diag));
-            if (native_diag_res == GTK_RESPONSE_ACCEPT) {
-                GtkFileChooser *chooser = GTK_FILE_CHOOSER(fl_diag);
-                gchar *db_path = gtk_file_chooser_get_filename (chooser);
-                GKeyFile *kf = g_key_file_new ();
-                gchar *cfg_file_path;
-#ifndef USE_FLATPAK_APP_FOLDER
-                cfg_file_path = g_build_filename (g_get_user_config_dir (), 
"otpclient.cfg", NULL);
-#else
-                cfg_file_path = g_build_filename (g_get_user_data_dir (), 
"otpclient.cfg", NULL);
-#endif
-                g_key_file_set_string (kf, "config", "db_path", db_path);
-                GError *err = NULL;
-                if (!g_key_file_save_to_file (kf, cfg_file_path, &err)) {
-                    gchar *err_msg = g_strconcat (_("Couldn't save the config 
file: "), err->message, NULL);
-                    show_message_dialog (app_data->main_window, err_msg, 
GTK_MESSAGE_ERROR);
-                    g_free (err_msg);
-                    g_clear_error (&err);
-                }
-                g_free (app_data->db_data->db_path);
-                app_data->db_data->db_path = g_strdup (db_path);
-                g_free (db_path);
-                g_free (cfg_file_path);
-                g_key_file_free (kf);
-            }
-            g_object_unref (fl_diag);
+            // create a new db.
+            new_db_cb (NULL, NULL, app_data);
             res = TRUE;
             break;
         case GTK_RESPONSE_CANCEL:
@@ -65,4 +36,4 @@
     gtk_widget_hide (diag_changefile);
 
     return res;
-}
\ No newline at end of file
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OTPClient-3.1.9/src/common/aegis.c 
new/OTPClient-3.2.0/src/common/aegis.c
--- old/OTPClient-3.1.9/src/common/aegis.c      2023-07-03 15:34:59.000000000 
+0200
+++ new/OTPClient-3.2.0/src/common/aegis.c      2023-10-25 09:29:16.000000000 
+0200
@@ -372,20 +372,36 @@
         gcry_cipher_close (hd);
     }
 
-    FILE *fp = fopen (export_path, "w");
-    if (fp == NULL) {
-        g_set_error (&err, generic_error_gquark (), GENERIC_ERRCODE, "couldn't 
create the file object");
-    } else {
-        if (json_dumpf (root, fp, JSON_COMPACT) == -1) {
+    GFile *out_gfile = g_file_new_for_path (export_path);
+    GFileOutputStream *out_stream = g_file_replace (out_gfile, NULL, FALSE, 
G_FILE_CREATE_REPLACE_DESTINATION | G_FILE_CREATE_PRIVATE, NULL, &err);
+    if (err == NULL) {
+        gsize jbuf_size = json_dumpb (root, NULL, 0, 0);
+        if (jbuf_size == 0) {
+            goto cleanup_and_exit;
+        }
+        gchar *jbuf = g_malloc0 (jbuf_size);
+        if (json_dumpb (root, jbuf, jbuf_size, JSON_COMPACT) == -1) {
+            g_set_error (&err, generic_error_gquark (), GENERIC_ERRCODE, 
"couldn't dump json data to buffer");
+            g_free (jbuf);
+            goto cleanup_and_exit;
+        }
+        if (g_output_stream_write (G_OUTPUT_STREAM(out_stream), jbuf, 
jbuf_size, NULL, &err) == -1) {
             g_set_error (&err, generic_error_gquark (), GENERIC_ERRCODE, 
"couldn't dump json data to file");
+            g_free (jbuf);
+            goto cleanup_and_exit;
         }
-        fclose (fp);
+        g_free (jbuf);
+    } else {
+        g_set_error (&err, generic_error_gquark (), GENERIC_ERRCODE, "couldn't 
create the file object");
     }
 
+    cleanup_and_exit:
     json_array_clear (array);
     json_decref (aegis_db_obj);
     json_decref (aegis_header_obj);
     json_decref (root);
+    g_object_unref (out_stream);
+    g_object_unref (out_gfile);
 
     return (err != NULL ? g_strdup (err->message) : NULL);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OTPClient-3.1.9/src/common/andotp.c 
new/OTPClient-3.2.0/src/common/andotp.c
--- old/OTPClient-3.1.9/src/common/andotp.c     2023-07-03 15:34:59.000000000 
+0200
+++ new/OTPClient-3.2.0/src/common/andotp.c     2023-10-25 09:29:16.000000000 
+0200
@@ -220,16 +220,33 @@
 
     // if plaintext export is needed, then write the file and exit
     if (password == NULL) {
-        FILE *fp = fopen (export_path, "w");
-        if (fp == NULL) {
+        GFile *out_gfile = g_file_new_for_path (export_path);
+        GFileOutputStream *out_stream = g_file_replace (out_gfile, NULL, 
FALSE, G_FILE_CREATE_REPLACE_DESTINATION | G_FILE_CREATE_PRIVATE, NULL, &err);
+        if (err == NULL) {
+            gsize jbuf_size = json_dumpb (array, NULL, 0, 0);
+            if (jbuf_size == 0) {
+                g_object_unref (out_stream);
+                g_object_unref (out_gfile);
+                goto end;
+            }
+            gchar *jbuf = g_malloc0 (jbuf_size);
+            if (json_dumpb (array, jbuf, jbuf_size, JSON_COMPACT) == -1) {
+                g_set_error (&err, generic_error_gquark (), GENERIC_ERRCODE, 
"couldn't dump json data to buffer");
+                g_free (jbuf);
+                g_object_unref (out_stream);
+                g_object_unref (out_gfile);
+                goto end;
+            }
+            if (g_output_stream_write (G_OUTPUT_STREAM(out_stream), jbuf, 
jbuf_size, NULL, &err) == -1) {
+                g_set_error (&err, generic_error_gquark (), GENERIC_ERRCODE, 
"couldn't dump json data to file");
+            }
+            g_free (jbuf);
+            g_object_unref (out_stream);
+            g_object_unref (out_gfile);
+        } else {
             g_set_error (&err, generic_error_gquark (), GENERIC_ERRCODE, 
"couldn't create the file object");
-            goto end;
+            g_object_unref (out_gfile);
         }
-        if (json_dumpf (array, fp, JSON_COMPACT) == -1) {
-            g_set_error (&err, generic_error_gquark (), GENERIC_ERRCODE, 
"couldn't dump json data to file");
-        }
-        fclose (fp);
-
         goto end;
     }
 
@@ -276,7 +293,7 @@
     gcry_cipher_close (hd);
 
     GFile *out_gfile = g_file_new_for_path (export_path);
-    GFileOutputStream *out_stream = g_file_append_to (out_gfile, 
G_FILE_CREATE_REPLACE_DESTINATION, NULL, &err);
+    GFileOutputStream *out_stream = g_file_replace (out_gfile, NULL, FALSE, 
G_FILE_CREATE_REPLACE_DESTINATION | G_FILE_CREATE_PRIVATE, NULL, &err);
     if (err != NULL) {
         goto cleanup_before_exiting;
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OTPClient-3.1.9/src/common/freeotp.c 
new/OTPClient-3.2.0/src/common/freeotp.c
--- old/OTPClient-3.1.9/src/common/freeotp.c    2023-07-03 15:34:59.000000000 
+0200
+++ new/OTPClient-3.2.0/src/common/freeotp.c    2023-10-25 09:29:16.000000000 
+0200
@@ -4,6 +4,7 @@
 #include <time.h>
 #include "../file-size.h"
 #include "../parse-uri.h"
+#include "../gquarks.h"
 
 
 GSList *
@@ -38,18 +39,23 @@
     json_t *db_obj;
     gsize index;
 
-    FILE *fp = fopen (export_path, "w");
-    if (fp == NULL) {
-        return g_strdup ("couldn't create the file object");
+    GError *err = NULL;
+    GFile *out_gfile = g_file_new_for_path (export_path);
+    GFileOutputStream *out_stream = g_file_replace (out_gfile, NULL, FALSE, 
G_FILE_CREATE_REPLACE_DESTINATION | G_FILE_CREATE_PRIVATE, NULL, &err);
+    if (err == NULL) {
+        json_array_foreach (json_db_data, index, db_obj) {
+            gchar *uri = get_otpauth_uri (NULL, db_obj);
+            if (g_output_stream_write (G_OUTPUT_STREAM(out_stream), uri, 
g_utf8_strlen (uri, -1) + 1, NULL, &err) == -1) {
+                g_set_error (&err, generic_error_gquark (), GENERIC_ERRCODE, 
"couldn't dump json data to file");
+            }
+            g_free (uri);
+        }
+    } else {
+        g_set_error (&err, generic_error_gquark (), GENERIC_ERRCODE, "couldn't 
create the file object");
     }
 
-    json_array_foreach (json_db_data, index, db_obj) {
-        gchar *uri = get_otpauth_uri (NULL, db_obj);
-        fwrite (uri, strlen (uri), 1, fp);
-        g_free (uri);
-    }
-
-    fclose (fp);
+    g_object_unref (out_stream);
+    g_object_unref (out_gfile);
 
-    return NULL;
+    return (err != NULL ? g_strdup (err->message) : NULL);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OTPClient-3.1.9/src/exports.c 
new/OTPClient-3.2.0/src/exports.c
--- old/OTPClient-3.1.9/src/exports.c   2023-07-03 15:34:59.000000000 +0200
+++ new/OTPClient-3.2.0/src/exports.c   2023-10-25 09:29:16.000000000 +0200
@@ -6,7 +6,9 @@
 #include "common/exports.h"
 
 
-static void show_ret_msg_dialog (GtkWidget  *mainwin, gchar *fpath, gchar 
*ret_msg);
+static void show_ret_msg_dialog (GtkWidget   *mainwin,
+                                 const gchar *fpath,
+                                 const gchar *ret_msg);
 
 
 void
@@ -24,13 +26,49 @@
     base_dir = g_get_user_data_dir ();
 #endif
 
-    gchar *password = NULL, *exported_file_path = NULL, *ret_msg = NULL;
     gboolean encrypted;
     if ((g_strcmp0 (action_name, "export_andotp") == 0) || (g_strcmp0 
(action_name, "export_aegis") == 0)) {
         encrypted = TRUE;
     } else {
         encrypted = FALSE;
     }
+
+    GtkFileChooserNative *fl_diag = gtk_file_chooser_native_new ("Export file",
+                                                                 
GTK_WINDOW(app_data->main_window),
+                                                                 
GTK_FILE_CHOOSER_ACTION_SAVE,
+                                                                 "OK",
+                                                                 "Cancel");
+    gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER(fl_diag), base_dir);
+    gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER(fl_diag), 
TRUE);
+    gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER(fl_diag), FALSE);
+
+    const gchar *filename = NULL;
+    if (g_strcmp0 (action_name, ANDOTP_EXPORT_ACTION_NAME) == 0 || g_strcmp0 
(action_name, ANDOTP_EXPORT_PLAIN_ACTION_NAME) == 0) {
+        filename = (encrypted == TRUE) ? "andotp_exports.json.aes" : 
"andotp_exports.json";
+    } else if (g_strcmp0 (action_name, FREEOTPPLUS_EXPORT_ACTION_NAME) == 0) {
+        filename = "freeotpplus-exports.txt";
+    } else if (g_strcmp0 (action_name, AEGIS_EXPORT_ACTION_NAME) == 0 || 
g_strcmp0 (action_name, AEGIS_EXPORT_PLAIN_ACTION_NAME) == 0) {
+        filename = (encrypted == TRUE) ? "aegis_encrypted.json" : 
"aegis_export_plain.json";
+    } else {
+        show_message_dialog (app_data->main_window, "Invalid export action.", 
GTK_MESSAGE_ERROR);
+        return;
+    }
+
+    gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER(fl_diag), filename);
+
+    gchar *export_file_abs_path = NULL;
+    gint native_diag_res = gtk_native_dialog_run (GTK_NATIVE_DIALOG(fl_diag));
+    if (native_diag_res == GTK_RESPONSE_ACCEPT) {
+        export_file_abs_path = gtk_file_chooser_get_filename 
(GTK_FILE_CHOOSER(fl_diag));
+    }
+    g_object_unref (fl_diag);
+
+    if (export_file_abs_path == NULL) {
+        show_message_dialog (app_data->main_window, "Invalid export file 
name/path.", GTK_MESSAGE_ERROR);
+        return;
+    }
+
+    gchar *password = NULL, *ret_msg = NULL;
     if (g_strcmp0 (action_name, ANDOTP_EXPORT_ACTION_NAME) == 0 || g_strcmp0 
(action_name, ANDOTP_EXPORT_PLAIN_ACTION_NAME) == 0) {
         if (encrypted == TRUE) {
             password = prompt_for_password (app_data, NULL, NULL, TRUE);
@@ -38,13 +76,11 @@
                 return;
             }
         }
-        exported_file_path = g_build_filename (base_dir, encrypted == TRUE ? 
"andotp_exports.json.aes" : "andotp_exports.json", NULL);
-        ret_msg = export_andotp (exported_file_path, password, 
app_data->db_data->json_data);
-        show_ret_msg_dialog (app_data->main_window, exported_file_path, 
ret_msg);
+        ret_msg = export_andotp (export_file_abs_path, password, 
app_data->db_data->json_data);
+        show_ret_msg_dialog (app_data->main_window, export_file_abs_path, 
ret_msg);
     } else if (g_strcmp0 (action_name, FREEOTPPLUS_EXPORT_ACTION_NAME) == 0) {
-        exported_file_path = g_build_filename (base_dir, 
"freeotpplus-exports.txt", NULL);
-        ret_msg = export_freeotpplus (exported_file_path, 
app_data->db_data->json_data);
-        show_ret_msg_dialog (app_data->main_window, exported_file_path, 
ret_msg);
+        ret_msg = export_freeotpplus (export_file_abs_path, 
app_data->db_data->json_data);
+        show_ret_msg_dialog (app_data->main_window, export_file_abs_path, 
ret_msg);
     } else if (g_strcmp0 (action_name, AEGIS_EXPORT_ACTION_NAME) == 0 || 
g_strcmp0 (action_name, AEGIS_EXPORT_PLAIN_ACTION_NAME) == 0) {
         if (encrypted == TRUE) {
             password = prompt_for_password (app_data, NULL, NULL, TRUE);
@@ -52,15 +88,14 @@
                 return;
             }
         }
-        exported_file_path = g_build_filename (base_dir, encrypted == TRUE ? 
"aegis_encrypted.json" : "aegis_export_plain.json", NULL);
-        ret_msg = export_aegis (exported_file_path, 
app_data->db_data->json_data, password);
-        show_ret_msg_dialog (app_data->main_window, exported_file_path, 
ret_msg);
+        ret_msg = export_aegis (export_file_abs_path, 
app_data->db_data->json_data, password);
+        show_ret_msg_dialog (app_data->main_window, export_file_abs_path, 
ret_msg);
     } else {
         show_message_dialog (app_data->main_window, "Invalid export action.", 
GTK_MESSAGE_ERROR);
         return;
     }
     g_free (ret_msg);
-    g_free (exported_file_path);
+    g_free (export_file_abs_path);
     if (encrypted == TRUE) {
         gcry_free (password);
     }
@@ -68,9 +103,9 @@
 
 
 static void
-show_ret_msg_dialog (GtkWidget  *mainwin,
-                     gchar      *fpath,
-                     gchar      *ret_msg)
+show_ret_msg_dialog (GtkWidget   *mainwin,
+                     const gchar *fpath,
+                     const gchar *ret_msg)
 {
     GtkMessageType msg_type;
     gchar *message = NULL;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OTPClient-3.1.9/src/new-db-cb.c 
new/OTPClient-3.2.0/src/new-db-cb.c
--- old/OTPClient-3.1.9/src/new-db-cb.c 2023-07-03 15:34:59.000000000 +0200
+++ new/OTPClient-3.2.0/src/new-db-cb.c 2023-10-25 09:29:16.000000000 +0200
@@ -1,10 +1,12 @@
 #include <gtk/gtk.h>
 #include <gcrypt.h>
+#include <libsecret/secret.h>
 #include "data.h"
 #include "db-misc.h"
 #include "message-dialogs.h"
 #include "password-cb.h"
 #include "db-actions.h"
+#include "secret-schema.h"
 
 void
 new_db_cb (GSimpleAction *simple    __attribute__((unused)),
@@ -32,6 +34,7 @@
                 update_cfg_file (app_data);
                 gcry_free (app_data->db_data->key);
                 app_data->db_data->key = prompt_for_password (app_data, NULL, 
NULL, FALSE);
+                secret_password_store (OTPCLIENT_SCHEMA, 
SECRET_COLLECTION_DEFAULT, "main_pwd", app_data->db_data->key, NULL, 
on_password_stored, NULL, "string", "main_pwd", NULL);
                 GError *err = NULL;
                 write_db_to_disk (app_data->db_data, &err);
                 if (err != NULL) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OTPClient-3.1.9/src/treeview.c 
new/OTPClient-3.2.0/src/treeview.c
--- old/OTPClient-3.1.9/src/treeview.c  2023-07-03 15:34:59.000000000 +0200
+++ new/OTPClient-3.2.0/src/treeview.c  2023-10-25 09:29:16.000000000 +0200
@@ -66,11 +66,11 @@
 void
 update_model (AppData *app_data)
 {
-    GtkListStore *store = GTK_LIST_STORE(gtk_tree_view_get_model 
(app_data->tree_view));
-
-    gtk_list_store_clear (store);
-
-    add_data_to_model (app_data->db_data, store);
+    if (app_data->tree_view != NULL) {
+        GtkListStore *store = GTK_LIST_STORE(gtk_tree_view_get_model 
(app_data->tree_view));
+        gtk_list_store_clear (store);
+        add_data_to_model (app_data->db_data, store);
+    }
 }
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/OTPClient-3.1.9/src/ui/otpclient.ui 
new/OTPClient-3.2.0/src/ui/otpclient.ui
--- old/OTPClient-3.1.9/src/ui/otpclient.ui     2023-07-03 15:34:59.000000000 
+0200
+++ new/OTPClient-3.2.0/src/ui/otpclient.ui     2023-10-25 09:29:16.000000000 
+0200
@@ -697,8 +697,8 @@
             <property name="can-focus">False</property>
             <property name="layout-style">end</property>
             <child>
-              <object class="GtkButton" id="btn_changefile_no_id">
-                <property name="label" translatable="yes">No</property>
+              <object class="GtkButton" id="btn_changefile_quit_id">
+                <property name="label" translatable="yes">Quit</property>
                 <property name="visible">True</property>
                 <property name="can-focus">True</property>
                 <property name="receives-default">True</property>
@@ -710,8 +710,8 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="btn_changefile_yes_id">
-                <property name="label" translatable="yes">Yes</property>
+              <object class="GtkButton" id="btn_changefile_selex_id">
+                <property name="label" translatable="yes">Select another 
DB</property>
                 <property name="visible">True</property>
                 <property name="can-focus">True</property>
                 <property name="receives-default">True</property>
@@ -722,6 +722,19 @@
                 <property name="position">1</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkButton" id="btn_changefile_new_id">
+                <property name="label" translatable="yes">Create new 
DB</property>
+                <property name="visible">True</property>
+                <property name="can-focus">True</property>
+                <property name="receives-default">True</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -747,8 +760,9 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="-6">btn_changefile_no_id</action-widget>
-      <action-widget response="-5">btn_changefile_yes_id</action-widget>
+      <action-widget response="-7">btn_changefile_quit_id</action-widget>
+      <action-widget response="-3">btn_changefile_selex_id</action-widget>
+      <action-widget response="-5">btn_changefile_new_id</action-widget>
     </action-widgets>
   </object>
   <object class="GtkDialog" id="diag_qr_clipboard_id">

Reply via email to