[gnote/gnome-3-36] Fix first run detection



commit f6c749f8a7f3ef32cfdedcc172509f3dc6eb8360
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun May 3 13:12:16 2020 +0300

    Fix first run detection

 src/notemanager.cpp     | 4 +---
 src/notemanagerbase.cpp | 3 ++-
 src/notemanagerbase.hpp | 4 ++--
 3 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/src/notemanager.cpp b/src/notemanager.cpp
index e05ddacd..50577e66 100644
--- a/src/notemanager.cpp
+++ b/src/notemanager.cpp
@@ -50,9 +50,7 @@ namespace gnote {
   void NoteManager::init(const Glib::ustring & directory)
   {
     Glib::ustring backup = directory + "/Backup";
-    // Before base init, after it will be false already
-    bool is_first_run = first_run();
-    NoteManagerBase::init(directory, backup);
+    bool is_first_run = NoteManagerBase::init(directory, backup);
 
     Glib::RefPtr<Gio::Settings> settings = m_preferences.get_schema_settings(Preferences::SCHEMA_GNOTE);
     // Watch the START_NOTE_URI setting and update it so that the
diff --git a/src/notemanagerbase.cpp b/src/notemanagerbase.cpp
index f564bd41..ea84c8d2 100644
--- a/src/notemanagerbase.cpp
+++ b/src/notemanagerbase.cpp
@@ -101,7 +101,7 @@ NoteManagerBase::~NoteManagerBase()
   }
 }
 
-void NoteManagerBase::init(const Glib::ustring & directory, const Glib::ustring & backup_directory)
+bool NoteManagerBase::init(const Glib::ustring & directory, const Glib::ustring & backup_directory)
 {
   m_notes_dir = directory;
   m_default_note_template_title = _("New Note Template");
@@ -123,6 +123,7 @@ void NoteManagerBase::init(const Glib::ustring & directory, const Glib::ustring
   }
 
   m_trie_controller = create_trie_controller();
+  return is_first_run;
 }
 
 bool NoteManagerBase::first_run() const
diff --git a/src/notemanagerbase.hpp b/src/notemanagerbase.hpp
index ff5941fd..86e6da94 100644
--- a/src/notemanagerbase.hpp
+++ b/src/notemanagerbase.hpp
@@ -101,8 +101,7 @@ public:
   NoteBase::RenamedHandler signal_note_renamed;
   NoteBase::SavedHandler signal_note_saved;
 protected:
-  void init(const Glib::ustring & directory, const Glib::ustring & backup);
-  bool first_run() const;
+  bool init(const Glib::ustring & directory, const Glib::ustring & backup);
   virtual void post_load();
   virtual void migrate_notes(const Glib::ustring & old_note_dir);
   /** add the note to the manager and setup signals */
@@ -126,6 +125,7 @@ protected:
   Glib::ustring m_backup_dir;
   Glib::ustring m_default_note_template_title;
 private:
+  bool first_run() const;
   void create_notes_dir() const;
   bool create_directory(const Glib::ustring & directory) const;
   TrieController *create_trie_controller();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]