[solang/gsettings] TagManager notify when a photo is tagged



commit 22dcdccb6c1ad1ad0993b5bf869b0f197c2a2ce8
Author: Florent Thévenet <feuloren free fr>
Date:   Fri Jun 18 17:19:47 2010 +0200

    TagManager notify when a photo is tagged

 src/application/main-window.cpp |   20 +++++++++++++++++++-
 src/application/main-window.h   |    9 +++++++++
 src/attribute/tag-manager.cpp   |    4 ++++
 3 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/src/application/main-window.cpp b/src/application/main-window.cpp
index b258022..eed14a1 100644
--- a/src/application/main-window.cpp
+++ b/src/application/main-window.cpp
@@ -215,7 +215,8 @@ MainWindow::MainWindow() throw() :
     showStatusBar_(true),
     dockObjectsLeftTop_(),
     dockObjectsLeftBottom_(),
-    dockObjectsCenter_()
+    dockObjectsCenter_(),
+    status_message_context_id_(statusBar_.get_context_id("Messages"))
 {
     set_icon_name(PACKAGE_TARNAME);
     set_title("Solang");
@@ -946,4 +947,21 @@ MainWindow::set_busy(bool busy) throw()
     spinnerToolItem_.set_spinning(busy);
 }
 
+void
+MainWindow::display_status_message( const Glib::ustring &message,
+                                unsigned int timeout ) throw()
+{
+    guint message_id = statusBar_.push(message, status_message_context_id_);
+
+    Glib::signal_timeout().connect_seconds_once(sigc::bind<guint>(
+        sigc::mem_fun(*this, &MainWindow::on_status_message_timeout),
+        message_id) , timeout);
+}
+
+void
+MainWindow::on_status_message_timeout(guint message_id) throw()
+{
+    statusBar_.remove_message(message_id, status_message_context_id_);
+}
+
 } // namespace Solang
diff --git a/src/application/main-window.h b/src/application/main-window.h
index fb7b607..42502cf 100644
--- a/src/application/main-window.h
+++ b/src/application/main-window.h
@@ -81,6 +81,10 @@ class MainWindow :
         void
         set_busy(bool busy) throw();
 
+        void
+        display_status_message( const Glib::ustring &message,
+                                unsigned int timeout ) throw();
+
     protected:
         std::string
         get_user_layout_file() throw();
@@ -122,6 +126,9 @@ class MainWindow :
         on_delete_event(GdkEventAny * event);
 
         void
+        on_status_message_timeout(guint message_id) throw();
+
+        void
         save_layout() throw();
 
         ApplicationPtr application_;
@@ -155,6 +162,8 @@ class MainWindow :
         std::vector<DockObjectPtr> dockObjectsLeftBottom_;
 
         std::vector<DockObjectPtr> dockObjectsCenter_;
+        
+        guint status_message_context_id_;
 
     private:
         static const std::string artistsFile_;
diff --git a/src/attribute/tag-manager.cpp b/src/attribute/tag-manager.cpp
index 8f21c9d..3e361ef 100644
--- a/src/attribute/tag-manager.cpp
+++ b/src/attribute/tag-manager.cpp
@@ -417,6 +417,10 @@ TagManager::apply_tag(TagPtr tag, PhotoList *photos)
         PhotoTag photo_tag(*photos_iter, tag);
         photo_tag.save_async(*db, sigc::slot<void>());
     }
+    
+    application_->get_main_window().display_status_message(
+        Glib::ustring::compose(_("Tag '%1' added"), tag->get_name()),
+        3);
 }
 
 void



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