Replace the DirBrowserRemoteInterface by slots to reduce coupling by using ad-hoc yet type-safe collaborations.

This commit is contained in:
Adam Reichold
2015-12-05 11:45:15 +01:00
parent 87016d353a
commit 4f68e370d4
9 changed files with 42 additions and 64 deletions

View File

@@ -21,11 +21,14 @@
#include <gtkmm.h>
#include <giomm.h>
#include "dirbrowserremoteinterface.h"
#include "multilangmgr.h"
class PlacesBrowser : public Gtk::VBox
{
public:
typedef sigc::slot<void, const Glib::ustring&> DirSelectionSlot;
private:
class PlacesColumns : public Gtk::TreeModel::ColumnRecord
{
@@ -49,7 +52,7 @@ class PlacesBrowser : public Gtk::VBox
Gtk::TreeView* treeView;
Glib::RefPtr<Gtk::ListStore> placesModel;
Glib::RefPtr<Gio::VolumeMonitor> vm;
DirBrowserRemoteInterface* listener;
DirSelectionSlot selectDir;
Glib::ustring lastSelectedDir;
Gtk::Button* add;
Gtk::Button* del;
@@ -58,10 +61,7 @@ public:
PlacesBrowser ();
void setDirBrowserRemoteInterface (DirBrowserRemoteInterface* l)
{
listener = l;
}
void setDirSelector (const DirSelectionSlot& selectDir);
void dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile);
void refreshPlacesList ();
@@ -74,6 +74,11 @@ public:
void delPressed ();
};
inline void PlacesBrowser::setDirSelector (const PlacesBrowser::DirSelectionSlot& selectDir)
{
this->selectDir = selectDir;
}
#endif