[niepce] use c++ lambda instead of std::bind



commit 40053605030af4db37cff6cb54547ef84fc5d3aa
Author: Hubert Figuière <hub figuiere net>
Date:   Thu May 11 20:21:14 2017 -0400

    use c++ lambda instead of std::bind

 src/engine/db/library.cpp                   |   23 ++++-----
 src/engine/db/library.hpp                   |    4 +-
 src/engine/library/commands.cpp             |   11 ++--
 src/engine/library/test_opqueue.cpp         |   11 +----
 src/engine/library/thumbnailcache.cpp       |   16 ++----
 src/engine/library/thumbnailcache.hpp       |    1 -
 src/fwk/toolkit/application.cpp             |    2 -
 src/fwk/toolkit/application.hpp             |    2 -
 src/fwk/toolkit/controller.cpp              |   15 +++---
 src/fwk/toolkit/frame.cpp                   |    1 -
 src/fwk/toolkit/frame.hpp                   |    1 -
 src/fwk/toolkit/metadatawidget.cpp          |   10 ++--
 src/fwk/toolkit/metadatawidget.hpp          |    2 +-
 src/fwk/toolkit/notificationcenter.cpp      |    3 +-
 src/fwk/toolkit/undo.cpp                    |   14 +++--
 src/fwk/utils/db/iconnectiondriver.hpp      |    2 +-
 src/fwk/utils/db/sqlite/sqlitecnxdrv.cpp    |    4 +-
 src/fwk/utils/modulemanager.cpp             |   10 ++--
 src/fwk/utils/testfiles.cpp                 |    3 -
 src/libraryclient/clientimpl.cpp            |   70 +++++++++++++++-----------
 src/libraryclient/test_worker.cpp           |   10 +---
 src/niepce/ui/dialogs/editlabels.cpp        |    3 +-
 src/niepce/ui/dialogs/importdialog.cpp      |    1 -
 src/niepce/ui/dialogs/preferencesdialog.cpp |    2 -
 src/niepce/ui/metadatapanecontroller.cpp    |    2 -
 src/niepce/ui/selectioncontroller.cpp       |    2 -
 src/niepce/ui/workspacecontroller.cpp       |    2 -
 27 files changed, 94 insertions(+), 133 deletions(-)
---
diff --git a/src/engine/db/library.cpp b/src/engine/db/library.cpp
index f002053..152330b 100644
--- a/src/engine/db/library.cpp
+++ b/src/engine/db/library.cpp
@@ -1,7 +1,7 @@
 /*
  * niepce - engine/db/library.cpp
  *
- * Copyright (C) 2007-2013 Hubert Figuiere
+ * Copyright (C) 2007-2017 Hubert Figuière
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,7 +21,6 @@
 #include <stdio.h>
 
 #include <iostream>
-#include <functional>
 
 #include <boost/format.hpp>
 
@@ -64,8 +63,10 @@ Library::Library(const std::string & dir, const NotificationCenter::Ptr & nc)
         m_inited = init();
 
         m_dbdrv->create_function0("rewrite_xmp",
-                                  std::bind(&Library::triggerRewriteXmp,
-                                            this));
+                                  [this] () {
+                                      DBG_OUT("rewrite_xmp");
+                                      notify(NotifyType::XMP_NEEDS_UPDATE, boost::any());
+                                  });
     }
     catch(const std::exception &e)
     {
@@ -77,12 +78,6 @@ Library::~Library()
 {
 }
 
-void Library::triggerRewriteXmp(void)
-{
-    DBG_OUT("rewrite_xmp");
-    notify(NotifyType::XMP_NEEDS_UPDATE, boost::any());
-}
-
 void Library::notify(NotifyType t, const boost::any & param)
 {
     fwk::NotificationCenter::Ptr nc(m_notif_center.lock());
@@ -1010,11 +1005,11 @@ bool Library::processXmpUpdateQueue(bool write_xmp)
     bool retval = false;
     std::vector<library_id_t> ids;
     retval = getXmpIdsInQueue(ids);
-    if(retval) {
-        using std::placeholders::_1;
+    if (retval) {
         std::for_each(ids.begin(), ids.end(),
-                     std::bind(&Library::rewriteXmpForId,
-                                 this, _1, write_xmp));
+                      [this, write_xmp] (auto id){
+                          this->rewriteXmpForId(id, write_xmp);
+                      });
     }
     return retval;
 }
diff --git a/src/engine/db/library.hpp b/src/engine/db/library.hpp
index 0d8eb6b..02d675d 100644
--- a/src/engine/db/library.hpp
+++ b/src/engine/db/library.hpp
@@ -1,7 +1,7 @@
 /*
  * niepce - engine/db/library.h
  *
- * Copyright (C) 2007-2013 Hubert Figuiere
+ * Copyright (C) 2007-2017 Hubert Figuière
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -206,8 +206,6 @@ private:
     bool init();
     bool _initDb();
 
-    /** external sqlite fucntion to trigger the rewrite of the XMP */
-    void triggerRewriteXmp(void);
     bool getXmpIdsInQueue(std::vector<library_id_t> & ids);
     /** rewrite the XMP sidecar for the file whose id is %id
      * and remove it from the queue.
diff --git a/src/engine/library/commands.cpp b/src/engine/library/commands.cpp
index 4fd8e17..e36cff2 100644
--- a/src/engine/library/commands.cpp
+++ b/src/engine/library/commands.cpp
@@ -1,7 +1,7 @@
 /*
  * niepce - library/commands.cpp
  *
- * Copyright (C) 2007-2015 Hubert Figuière
+ * Copyright (C) 2007-2017 Hubert Figuière
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,6 @@
 
 
 #include <array>
-#include <functional>
 
 #include <boost/any.hpp>
 
@@ -98,10 +97,10 @@ void Commands::cmdImportFiles(const Library::Ptr & lib,
         lib->notify(Library::NotifyType::ADDED_FOLDERS,
                     boost::any(l));
     }
-    using std::placeholders::_1;
-    std::for_each( bundles->begin(), bundles->end(),
-                   std::bind(&Library::addBundle, std::ref(lib),
-                        pf->id(), _1, manage) );
+    std::for_each(bundles->begin(), bundles->end(),
+                  [&lib, &pf, manage] (const auto& fb) {
+                      lib->addBundle(pf->id(), fb, manage);
+                  });
     lib->notify(Library::NotifyType::ADDED_FILES,
                 boost::any());
 }
diff --git a/src/engine/library/test_opqueue.cpp b/src/engine/library/test_opqueue.cpp
index 8a30a65..8bc7e1e 100644
--- a/src/engine/library/test_opqueue.cpp
+++ b/src/engine/library/test_opqueue.cpp
@@ -1,7 +1,7 @@
 /*
  * niepce - library/test_opqueue.cpp
  *
- * Copyright (C) 2007-2013 Hubert Figuiere
+ * Copyright (C) 2007-2017 Hubert Figuière
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,23 +21,16 @@
 #include "op.hpp"
 #include "opqueue.hpp"
 
-#include <functional>
-
 #include <boost/test/minimal.hpp>
 
 using namespace eng;
 
-void foo(const eng::Library::Ptr &)
-{
-}
-
-
 //BOOST_AUTO_TEST_CASE(opqueue_test)
 int test_main(int, char *[])
 {
        OpQueue q;
 
-       Op::Ptr p(new Op(1, std::bind(&foo, eng::Library::Ptr())));
+       Op::Ptr p(new Op(1, [](const Library::Ptr &){}));
 
        BOOST_CHECK(q.empty());
 
diff --git a/src/engine/library/thumbnailcache.cpp b/src/engine/library/thumbnailcache.cpp
index 6bead60..2da56e9 100644
--- a/src/engine/library/thumbnailcache.cpp
+++ b/src/engine/library/thumbnailcache.cpp
@@ -1,7 +1,7 @@
 /*
  * niepce - library/thumbnailcache.cpp
  *
- * Copyright (C) 2007-2013 Hubert Figuiere
+ * Copyright (C) 2007-2017 Hubert Figuière
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,6 @@
 
 #include <string.h>
 
-#include <functional>
 #include <boost/any.hpp>
 #include <boost/format.hpp>
 
@@ -52,16 +51,11 @@ ThumbnailCache::~ThumbnailCache()
 void ThumbnailCache::request(const LibFile::ListPtr & fl)
 {
     clear();
-    using std::placeholders::_1;
     std::for_each(fl->begin(), fl->end(),
-                  std::bind(&ThumbnailCache::requestForFile, this,
-                              _1));
-}
-
-void ThumbnailCache::requestForFile(const LibFile::Ptr & f)
-{
-    ThumbnailTask::Ptr task(new ThumbnailTask(f, 160, 160));
-    schedule( task );
+                  [this] (const auto& f) {
+                      ThumbnailTask::Ptr task(new ThumbnailTask(f, 160, 160));
+                      this->schedule(task);
+                  });
 }
 
 namespace {
diff --git a/src/engine/library/thumbnailcache.hpp b/src/engine/library/thumbnailcache.hpp
index d80846d..022f1b1 100644
--- a/src/engine/library/thumbnailcache.hpp
+++ b/src/engine/library/thumbnailcache.hpp
@@ -61,7 +61,6 @@ public:
     ~ThumbnailCache();
 
     void request(const LibFile::ListPtr & fl);
-    void requestForFile(const LibFile::Ptr & f);
 
     static bool is_thumbnail_cached(const std::string & file, const std::string & thumb);
 
diff --git a/src/fwk/toolkit/application.cpp b/src/fwk/toolkit/application.cpp
index b8ac447..c57e6aa 100644
--- a/src/fwk/toolkit/application.cpp
+++ b/src/fwk/toolkit/application.cpp
@@ -17,8 +17,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <functional>
-
 #include <glibmm/i18n.h>
 #include <gtkmm/main.h>
 #include <gtkmm/aboutdialog.h>
diff --git a/src/fwk/toolkit/application.hpp b/src/fwk/toolkit/application.hpp
index d033fcc..d49a023 100644
--- a/src/fwk/toolkit/application.hpp
+++ b/src/fwk/toolkit/application.hpp
@@ -21,8 +21,6 @@
 #ifndef _FRAMEWORK_APPLICATION_H_
 #define _FRAMEWORK_APPLICATION_H_
 
-#include <functional>
-
 #include <glibmm/refptr.h>
 #include <giomm/menu.h>
 #include <gtkmm/application.h>
diff --git a/src/fwk/toolkit/controller.cpp b/src/fwk/toolkit/controller.cpp
index f62d964..dff43cc 100644
--- a/src/fwk/toolkit/controller.cpp
+++ b/src/fwk/toolkit/controller.cpp
@@ -1,7 +1,7 @@
 /*
  * niepce - fwk/toolkit/controller.cpp
  *
- * Copyright (C) 2007-2014 Hubert Figuiere
+ * Copyright (C) 2007-2017 Hubert Figuière
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -17,8 +17,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <functional>
-
 #include <gtkmm/widget.h>
 
 #include "fwk/base/debug.hpp"
@@ -63,9 +61,10 @@ bool Controller::canTerminate()
 void Controller::terminate()
 {
     DBG_OUT("terminating controller");
-    using std::placeholders::_1;
     std::for_each(m_subs.cbegin(), m_subs.cend(),
-                  std::bind(&Controller::terminate, _1));
+                  [] (const auto& ctrl) {
+                    ctrl->terminate();
+                  });
     clearParent();
     m_subs.clear();
 }
@@ -76,10 +75,10 @@ void Controller::_added()
 
 void Controller::_ready()
 {
-    using std::placeholders::_1;
-
     std::for_each(m_subs.cbegin(), m_subs.cend(),
-                  std::bind(&Controller::_ready, _1));
+                  [] (const auto& ctrl) {
+                    ctrl->_ready();
+                  });
     on_ready();
 }
 
diff --git a/src/fwk/toolkit/frame.cpp b/src/fwk/toolkit/frame.cpp
index 92e0112..062162d 100644
--- a/src/fwk/toolkit/frame.cpp
+++ b/src/fwk/toolkit/frame.cpp
@@ -19,7 +19,6 @@
 
 #include <list>
 #include <vector>
-#include <functional>
 
 #include <glibmm/i18n.h>
 #include <giomm/simpleaction.h>
diff --git a/src/fwk/toolkit/frame.hpp b/src/fwk/toolkit/frame.hpp
index e65959b..8eb3f0b 100644
--- a/src/fwk/toolkit/frame.hpp
+++ b/src/fwk/toolkit/frame.hpp
@@ -23,7 +23,6 @@
 
 #include <memory>
 #include <string>
-#include <functional>
 
 #include <sigc++/signal.h>
 #include <giomm/action.h>
diff --git a/src/fwk/toolkit/metadatawidget.cpp b/src/fwk/toolkit/metadatawidget.cpp
index 76a6014..980fdd5 100644
--- a/src/fwk/toolkit/metadatawidget.cpp
+++ b/src/fwk/toolkit/metadatawidget.cpp
@@ -19,7 +19,6 @@
 
 
 #include <utility>
-#include <functional>
 
 #include <boost/lexical_cast.hpp>
 #include <boost/format.hpp>
@@ -195,7 +194,7 @@ MetaDataWidget::create_widgets_for_format(const MetaDataSectionFormat * fmt)
     m_table.show_all();
 }
 
-void MetaDataWidget::clear_widget(std::pair<const PropertyIndex, Gtk::Widget *> & p)
+void MetaDataWidget::clear_widget(const std::pair<const PropertyIndex, Gtk::Widget *> & p)
 {
     AutoFlag flag(m_update);
     Gtk::Label * l = dynamic_cast<Gtk::Label*>(p.second);
@@ -230,9 +229,10 @@ void MetaDataWidget::set_data_source(const fwk::PropertyBag & properties)
     DBG_OUT("set data source");
     m_current_data = properties;
     if(!m_data_map.empty()) {
-        using std::placeholders::_1;
-        std::for_each(m_data_map.begin(), m_data_map.end(),
-                      std::bind(&MetaDataWidget::clear_widget, this, _1));
+        std::for_each(m_data_map.cbegin(), m_data_map.cend(),
+                      [this] (const auto& p) {
+                          this->clear_widget(p);
+                      });
     }
     set_sensitive(!properties.empty());
     if(properties.empty()) {
diff --git a/src/fwk/toolkit/metadatawidget.hpp b/src/fwk/toolkit/metadatawidget.hpp
index 84e2275..8bf237e 100644
--- a/src/fwk/toolkit/metadatawidget.hpp
+++ b/src/fwk/toolkit/metadatawidget.hpp
@@ -81,7 +81,7 @@ protected:
                                  fwk::PropertyIndex prop);
     void on_int_changed(int, fwk::PropertyIndex prop);
 private:
-    void clear_widget(std::pair<const PropertyIndex, Gtk::Widget *> & p);
+    void clear_widget(const std::pair<const PropertyIndex, Gtk::Widget *> & p);
     void create_widgets_for_format(const MetaDataSectionFormat * fmt);
 
     // the widget factory
diff --git a/src/fwk/toolkit/notificationcenter.cpp b/src/fwk/toolkit/notificationcenter.cpp
index 4ebe47e..5cbc463 100644
--- a/src/fwk/toolkit/notificationcenter.cpp
+++ b/src/fwk/toolkit/notificationcenter.cpp
@@ -1,7 +1,7 @@
 /*
  * niepce - fwk/toolkit/notification.cpp
  *
- * Copyright (C) 2007-2013 Hubert Figuiere
+ * Copyright (C) 2007-2017 Hubert Figuière
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,6 @@
 
 #include <list>
 #include <map>
-#include <functional>
 
 #include <glibmm/dispatcher.h>
 
diff --git a/src/fwk/toolkit/undo.cpp b/src/fwk/toolkit/undo.cpp
index fb5ad7e..442131a 100644
--- a/src/fwk/toolkit/undo.cpp
+++ b/src/fwk/toolkit/undo.cpp
@@ -1,7 +1,7 @@
 /*
  * niepce - framework/undo.cpp
  *
- * Copyright (C) 2008-2013 Hubert Figuiere
+ * Copyright (C) 2008-2017 Hubert Figuière
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
 
 
 #include <algorithm>
-#include <functional>
+
 #include <boost/checked_delete.hpp>
 
 #include "fwk/base/debug.hpp"
@@ -48,17 +48,19 @@ void UndoTransaction::add(Command * cmd)
 void UndoTransaction::undo()
 {
     DBG_OUT("undo transaction %lu cmd", (unsigned long)m_operations.size());
-    using std::placeholders::_1;
     std::for_each(m_operations.rbegin(), m_operations.rend(),
-                  std::bind(&Command::undo, _1));
+                  [] (auto cmd) {
+                      cmd->undo();
+                  });
 }
 
 void UndoTransaction::redo()
 {
     DBG_OUT("redo transaction %lu cmd", (unsigned long)m_operations.size());
-    using std::placeholders::_1;
     std::for_each(m_operations.begin(), m_operations.end(),
-                  std::bind(&Command::redo, _1));
+                  [] (auto cmd) {
+                      cmd->redo();
+                  });
 }
 
 UndoHistory::~UndoHistory()
diff --git a/src/fwk/utils/db/iconnectiondriver.hpp b/src/fwk/utils/db/iconnectiondriver.hpp
index 052d3a5..bde9bb6 100644
--- a/src/fwk/utils/db/iconnectiondriver.hpp
+++ b/src/fwk/utils/db/iconnectiondriver.hpp
@@ -72,7 +72,7 @@ public:
     virtual bool rollback_transaction () = 0 ;
 
     virtual bool execute_statement (const SQLStatement &a_statement) = 0;
-    
+
     virtual bool create_function0(const std::string & name, const f0_t & f) = 0;
 
     virtual bool should_have_data () const = 0;
diff --git a/src/fwk/utils/db/sqlite/sqlitecnxdrv.cpp b/src/fwk/utils/db/sqlite/sqlitecnxdrv.cpp
index 641e1de..60a01cf 100644
--- a/src/fwk/utils/db/sqlite/sqlitecnxdrv.cpp
+++ b/src/fwk/utils/db/sqlite/sqlitecnxdrv.cpp
@@ -125,8 +125,8 @@ namespace db { namespace sqlite {
 
                        //the result of the last sqlite3_step() function, or -333
                        int last_execution_result ;
-            
-            std::list<std::function<void (void)> > userfunctions;
+
+                       std::list<std::function<void (void)> > userfunctions;
 
                        Priv():
                                sqlite(NULL),
diff --git a/src/fwk/utils/modulemanager.cpp b/src/fwk/utils/modulemanager.cpp
index 8448528..b1f4a0a 100644
--- a/src/fwk/utils/modulemanager.cpp
+++ b/src/fwk/utils/modulemanager.cpp
@@ -3,7 +3,7 @@
  * copied from
  * gnote
  *
- * Copyright (C) 2009-2013 Hubert Figuiere
+ * Copyright (C) 2009-2017 Hubert Figuiere
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -28,8 +28,6 @@
 
 #include <dlfcn.h>
 
-#include <functional>
-
 #include <gmodule.h>
 #include <glibmm/module.h>
 
@@ -61,15 +59,15 @@ namespace fwk {
 
   void ModuleManager::load_modules()
   {
-    using std::placeholders::_1;
-
     std::string ext = std::string(".") + G_MODULE_SUFFIX;
 
     for(auto iter = m_dirs.cbegin();
         iter != m_dirs.cend(); ++iter) {
 
       fwk::FileList::Ptr l;
-      l = FileList::getFilesFromDirectory(*iter, std::bind(&fwk::filter_ext, _1, ext));
+      l = FileList::getFilesFromDirectory(*iter, [ext] (const auto& f) {
+          return fwk::filter_ext(f, ext);
+      });
 
       for(auto mod_iter = l->cbegin();
           mod_iter != l->cend(); ++mod_iter) {
diff --git a/src/fwk/utils/testfiles.cpp b/src/fwk/utils/testfiles.cpp
index 92a6f49..a20b66e 100644
--- a/src/fwk/utils/testfiles.cpp
+++ b/src/fwk/utils/testfiles.cpp
@@ -18,8 +18,6 @@
  */
 /** @brief unit test for files */
 
-#include <functional>
-
 #include <boost/test/minimal.hpp>
 
 #include <stdlib.h>
@@ -28,7 +26,6 @@
 #include "init.hpp"
 
 using fwk::FileList;
-using std::placeholders::_1;
 
 int test_main( int, char *[] )             // note the name!
 {
diff --git a/src/libraryclient/clientimpl.cpp b/src/libraryclient/clientimpl.cpp
index 3c29165..d07df06 100644
--- a/src/libraryclient/clientimpl.cpp
+++ b/src/libraryclient/clientimpl.cpp
@@ -1,7 +1,7 @@
 /*
  * niepce - libraryclient/clientimpl.cpp
  *
- * Copyright (C) 2007-2015 Hubert Figuière
+ * Copyright (C) 2007-2017 Hubert Figuière
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -17,8 +17,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <functional>
-
 #include "fwk/base/debug.hpp"
 #include "fwk/utils/files.hpp"
 #include "engine/library/op.hpp"
@@ -31,7 +29,6 @@ using fwk::FileList;
 using eng::Op;
 using eng::Commands;
 using eng::tid_t;
-using std::placeholders::_1;
 
 namespace libraryclient {
 
@@ -86,51 +83,58 @@ tid_t ClientImpl::getAllFolders()
 
 tid_t ClientImpl::queryFolderContent(eng::library_id_t folder_id)
 {
-    return schedule_op(std::bind(&Commands::cmdQueryFolderContent,
-                                 _1, folder_id));
+    return schedule_op([folder_id](const auto& lib) {
+        Commands::cmdQueryFolderContent(lib, folder_id);
+    });
 }
 
 
 tid_t ClientImpl::countFolder(eng::library_id_t folder_id)
 {
-    return schedule_op(std::bind(&Commands::cmdCountFolder,
-                                 _1, folder_id));
+    return schedule_op([folder_id](const auto& lib) {
+        Commands::cmdCountFolder(lib, folder_id);
+    });
 }
 
 
 tid_t ClientImpl::queryKeywordContent(eng::library_id_t keyword_id)
 {
-    return schedule_op(std::bind(&Commands::cmdQueryKeywordContent,
-                                 _1, keyword_id));
+    return schedule_op([keyword_id](const auto& lib) {
+        Commands::cmdQueryKeywordContent(lib, keyword_id);
+    });
 }
 
 
 tid_t ClientImpl::requestMetadata(eng::library_id_t file_id)
 {
-    return schedule_op(std::bind(&Commands::cmdRequestMetadata,
-                                 _1, file_id));
+    return schedule_op([file_id](const auto& lib) {
+        Commands::cmdRequestMetadata(lib, file_id);
+    });
 }
 
 
 tid_t ClientImpl::setMetadata(eng::library_id_t file_id, int meta,
                               const fwk::PropertyValue & value)
 {
-    return schedule_op(std::bind(&Commands::cmdSetMetadata, _1,
-                                 file_id, meta, value));
+    return schedule_op([file_id, meta, value](const auto& lib) {
+        Commands::cmdSetMetadata(lib, file_id, meta, value);
+    });
 }
 
 tid_t ClientImpl::write_metadata(eng::library_id_t file_id)
 {
-    return schedule_op(std::bind(&Commands::cmdWriteMetadata, _1,
-                                 file_id));
+    return schedule_op([file_id](const auto& lib) {
+        Commands::cmdWriteMetadata(lib, file_id);
+    });
 }
 
 tid_t ClientImpl::moveFileToFolder(eng::library_id_t file_id,
                                    eng::library_id_t from_folder_id,
                                    eng::library_id_t to_folder_id)
 {
-    return schedule_op(std::bind(&Commands::cmdMoveFileToFolder, _1,
-                                 file_id, from_folder_id, to_folder_id));
+    return schedule_op([file_id, from_folder_id, to_folder_id](const auto& lib) {
+        Commands::cmdMoveFileToFolder(lib, file_id, from_folder_id, to_folder_id);
+    });
 }
 
 
@@ -142,35 +146,40 @@ tid_t ClientImpl::getAllLabels()
 
 tid_t ClientImpl::createLabel(const std::string & s, const std::string & colour)
 {
-    return schedule_op(std::bind(&Commands::cmdCreateLabel,
-                                 _1, s, colour));
+    return schedule_op([s, colour](const auto& lib) {
+        Commands::cmdCreateLabel(lib, s, colour);
+    });
 }
 
 tid_t ClientImpl::deleteLabel(int label_id)
 {
-    return schedule_op(std::bind(&Commands::cmdDeleteLabel,
-                                 _1, label_id));
+    return schedule_op([label_id](const auto& lib) {
+        Commands::cmdDeleteLabel(lib, label_id);
+    });
 }
 
 tid_t ClientImpl::updateLabel(eng::library_id_t label_id,
                               const std::string & new_name,
                               const std::string & new_colour)
 {
-    return schedule_op(std::bind(&Commands::cmdUpdateLabel,
-                                 _1, label_id, new_name, new_colour));
+    return schedule_op([label_id, new_name, new_colour](const auto& lib) {
+        Commands::cmdUpdateLabel(lib, label_id, new_name, new_colour);
+    });
 }
 
 
 tid_t ClientImpl::processXmpUpdateQueue(bool write_xmp)
 {
-    return schedule_op(std::bind(&Commands::cmdProcessXmpUpdateQueue,
-                                 _1, write_xmp));
+    return schedule_op([write_xmp](const auto& lib) {
+        Commands::cmdProcessXmpUpdateQueue(lib, write_xmp);
+    });
 }
 
 tid_t ClientImpl::importFile(const std::string & path, bool manage)
 {
-    return schedule_op(std::bind(&Commands::cmdImportFile,
-                                 _1, path, manage));
+    return schedule_op([path, manage](const auto& lib) {
+        Commands::cmdImportFile(lib, path, manage);
+    });
 }
 
 tid_t ClientImpl::importFromDirectory(const std::string & dir, bool manage)
@@ -179,8 +188,9 @@ tid_t ClientImpl::importFromDirectory(const std::string & dir, bool manage)
 
     files = FileList::getFilesFromDirectory(dir, &fwk::filter_none);
 
-    return schedule_op(std::bind(&Commands::cmdImportFiles,
-                                 _1, dir, files, manage));
+    return schedule_op([dir, files, manage](const auto& lib) {
+        Commands::cmdImportFiles(lib, dir, files, manage);
+    });
 }
 
 }
diff --git a/src/libraryclient/test_worker.cpp b/src/libraryclient/test_worker.cpp
index 703bcc7..e942738 100644
--- a/src/libraryclient/test_worker.cpp
+++ b/src/libraryclient/test_worker.cpp
@@ -1,7 +1,7 @@
 /*
  * niepce - library/test_worker.cpp
  *
- * Copyright (C) 2007-2013 Hubert Figuiere
+ * Copyright (C) 2007-2017 Hubert Figuière
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -24,18 +24,12 @@
 #define BOOST_AUTO_TEST_MAIN
 #include "locallibraryserver.hpp"
 
-#include <functional>
 #include <boost/test/minimal.hpp>
 
 
 using namespace eng;
 using namespace libraryclient;
 
-void foo(const Library::Ptr &)
-{
-}
-
-
 //BOOST_AUTO_TEST_CASE(worker_test)
 int test_main(int, char *[])
 {
@@ -50,7 +44,7 @@ int test_main(int, char *[])
 
                BOOST_CHECK(w._tasks().empty());
 
-               Op::Ptr p(new Op(0, std::bind(&foo, eng::Library::Ptr())));
+               Op::Ptr p(new Op(0, [](const Library::Ptr &){}));
                w.schedule(p);
        }
     return 0;
diff --git a/src/niepce/ui/dialogs/editlabels.cpp b/src/niepce/ui/dialogs/editlabels.cpp
index cc0f756..bef30dc 100644
--- a/src/niepce/ui/dialogs/editlabels.cpp
+++ b/src/niepce/ui/dialogs/editlabels.cpp
@@ -1,7 +1,7 @@
 /*
  * niepce - niepce/ui/dialogs/editlabels.cpp
  *
- * Copyright (C) 2009, 2013 Hubert Figuiere
+ * Copyright (C) 2009-2017 Hubert Figuière
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,6 @@
 
 
 #include <algorithm>
-#include <functional>
 
 #include <boost/format.hpp>
 
diff --git a/src/niepce/ui/dialogs/importdialog.cpp b/src/niepce/ui/dialogs/importdialog.cpp
index bf0209a..90dc16d 100644
--- a/src/niepce/ui/dialogs/importdialog.cpp
+++ b/src/niepce/ui/dialogs/importdialog.cpp
@@ -19,7 +19,6 @@
 
 
 #include <future>
-#include <functional>
 
 #include <glibmm/i18n.h>
 #include <gtkmm/button.h>
diff --git a/src/niepce/ui/dialogs/preferencesdialog.cpp b/src/niepce/ui/dialogs/preferencesdialog.cpp
index 028bb03..ed30743 100644
--- a/src/niepce/ui/dialogs/preferencesdialog.cpp
+++ b/src/niepce/ui/dialogs/preferencesdialog.cpp
@@ -17,8 +17,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <functional>
-
 #include <glibmm/i18n.h>
 #include <gtkmm/combobox.h>
 #include <gtkmm/liststore.h>
diff --git a/src/niepce/ui/metadatapanecontroller.cpp b/src/niepce/ui/metadatapanecontroller.cpp
index c7e0613..e8b63f1 100644
--- a/src/niepce/ui/metadatapanecontroller.cpp
+++ b/src/niepce/ui/metadatapanecontroller.cpp
@@ -17,8 +17,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <functional>
-
 #include <glibmm/i18n.h>
 #include <gtkmm/label.h>
 #include <gtkmm/entry.h>
diff --git a/src/niepce/ui/selectioncontroller.cpp b/src/niepce/ui/selectioncontroller.cpp
index 65ba552..2707835 100644
--- a/src/niepce/ui/selectioncontroller.cpp
+++ b/src/niepce/ui/selectioncontroller.cpp
@@ -17,8 +17,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <functional>
-
 #include <gtkmm/iconview.h>
 #include <gtkmm/treeiter.h>
 #include <glibmm/i18n.h>
diff --git a/src/niepce/ui/workspacecontroller.cpp b/src/niepce/ui/workspacecontroller.cpp
index 72cc4b2..f2d7ec9 100644
--- a/src/niepce/ui/workspacecontroller.cpp
+++ b/src/niepce/ui/workspacecontroller.cpp
@@ -17,8 +17,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <functional>
-
 #include <boost/any.hpp>
 
 #include <glibmm/i18n.h>


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