[gnote] NoteOfTheDayApplicationAddin: Run check_new_day as soon as possible



commit 17401de76fe7c0b308615b9ab3ae701bb571d4b1
Author: Debarshi Ray <debarshir src gnome org>
Date:   Mon Dec 28 22:32:15 2009 +0200

    NoteOfTheDayApplicationAddin: Run check_new_day as soon as possible

 .../noteoftheday/noteofthedayapplicationaddin.cpp  |   22 ++++++++++++-------
 .../noteoftheday/noteofthedayapplicationaddin.hpp  |    2 +-
 2 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/src/addins/noteoftheday/noteofthedayapplicationaddin.cpp b/src/addins/noteoftheday/noteofthedayapplicationaddin.cpp
index 214e2f8..1610262 100644
--- a/src/addins/noteoftheday/noteofthedayapplicationaddin.cpp
+++ b/src/addins/noteoftheday/noteofthedayapplicationaddin.cpp
@@ -76,7 +76,7 @@ NoteOfTheDayApplicationAddin::~NoteOfTheDayApplicationAddin()
 {
 }
 
-bool NoteOfTheDayApplicationAddin::check_new_day() const
+void NoteOfTheDayApplicationAddin::check_new_day() const
 {
   Glib::Date date;
   date.set_time_current();
@@ -87,21 +87,27 @@ bool NoteOfTheDayApplicationAddin::check_new_day() const
     // Create a new NotD if the day has changed
     NoteOfTheDay::create(*m_manager, date);
   }
-
-  return true;
 }
 
 void NoteOfTheDayApplicationAddin::initialize()
 {
   if (!m_timeout) {
     m_timeout
-        = Glib::signal_timeout().connect_seconds(
-              sigc::mem_fun(*this,
-                            &NoteOfTheDayApplicationAddin::check_new_day),
-              60,
-              Glib::PRIORITY_DEFAULT);
+      = Glib::signal_timeout().connect_seconds(
+          sigc::bind_return(
+            sigc::mem_fun(
+              *this,
+              &NoteOfTheDayApplicationAddin::check_new_day),
+            true),
+          60,
+          Glib::PRIORITY_DEFAULT);
   }
 
+  Glib::signal_idle().connect_once(
+    sigc::mem_fun(*this,
+                  &NoteOfTheDayApplicationAddin::check_new_day),
+    Glib::PRIORITY_DEFAULT);
+
   m_initialized = true;
   m_manager = &gnote::Gnote::obj().default_note_manager();
 }
diff --git a/src/addins/noteoftheday/noteofthedayapplicationaddin.hpp b/src/addins/noteoftheday/noteofthedayapplicationaddin.hpp
index cf26100..f1ba51f 100644
--- a/src/addins/noteoftheday/noteofthedayapplicationaddin.hpp
+++ b/src/addins/noteoftheday/noteofthedayapplicationaddin.hpp
@@ -65,7 +65,7 @@ public:
 private:
 
   NoteOfTheDayApplicationAddin();
-  bool check_new_day() const;
+  void check_new_day() const;
 
   bool m_initialized;
   gnote::NoteManager * m_manager;



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