summaryrefslogtreecommitdiff
path: root/UnityCore
diff options
authorNick Dedekind <nicholas.dedekind@gmail.com>2012-12-12 09:31:50 +0000
committerNick Dedekind <nicholas.dedekind@gmail.com>2012-12-12 09:31:50 +0000
commit3c22fe9534608ba274f5663b0fe86f755ca94c26 (patch)
tree73e25b031b57fd2d0644ffbf3206546c38a7cf3e /UnityCore
parentd85736bc32f789178d24b3587dab6de3f7ab8065 (diff)
parent1ae601c9dd375475e5c2a42e756fa85893d90fe1 (diff)
Merge with trunk
(bzr r2934.2.10)
Diffstat (limited to 'UnityCore')
-rw-r--r--UnityCore/AppmenuIndicator.cpp4
-rw-r--r--UnityCore/AppmenuIndicator.h4
-rw-r--r--UnityCore/DBusIndicators.cpp126
-rw-r--r--UnityCore/DBusIndicators.h12
-rw-r--r--UnityCore/Indicator.cpp11
-rw-r--r--UnityCore/Indicator.h8
-rw-r--r--UnityCore/IndicatorEntry.cpp12
-rw-r--r--UnityCore/IndicatorEntry.h10
-rw-r--r--UnityCore/Indicators.h15
-rw-r--r--UnityCore/ModelRowAdaptor-inl.h6
-rw-r--r--UnityCore/ModelRowAdaptor.cpp14
-rw-r--r--UnityCore/ModelRowAdaptor.h17
-rw-r--r--UnityCore/Result.cpp22
-rw-r--r--UnityCore/Result.h9
14 files changed, 142 insertions, 128 deletions
diff --git a/UnityCore/AppmenuIndicator.cpp b/UnityCore/AppmenuIndicator.cpp
index 5ddbacd8d..ea1ba90cd 100644
--- a/UnityCore/AppmenuIndicator.cpp
+++ b/UnityCore/AppmenuIndicator.cpp
@@ -28,9 +28,9 @@ AppmenuIndicator::AppmenuIndicator(std::string const& name)
: Indicator(name)
{}
-void AppmenuIndicator::ShowAppmenu(unsigned int xid, int x, int y, unsigned int timestamp) const
+void AppmenuIndicator::ShowAppmenu(unsigned int xid, int x, int y) const
{
- on_show_appmenu.emit(xid, x, y, timestamp);
+ on_show_appmenu.emit(xid, x, y);
}
} // namespace indicator
diff --git a/UnityCore/AppmenuIndicator.h b/UnityCore/AppmenuIndicator.h
index 7393c60af..38ec62f17 100644
--- a/UnityCore/AppmenuIndicator.h
+++ b/UnityCore/AppmenuIndicator.h
@@ -34,9 +34,9 @@ public:
virtual bool IsAppmenu() const { return true; }
- void ShowAppmenu(unsigned int xid, int x, int y, unsigned int timestamp) const;
+ void ShowAppmenu(unsigned xid, int x, int y) const;
- sigc::signal<void, unsigned int, int, int, unsigned int> on_show_appmenu;
+ sigc::signal<void, unsigned, int, int> on_show_appmenu;
};
}
diff --git a/UnityCore/DBusIndicators.cpp b/UnityCore/DBusIndicators.cpp
index 8432c7ddb..9c659b92d 100644
--- a/UnityCore/DBusIndicators.cpp
+++ b/UnityCore/DBusIndicators.cpp
@@ -65,12 +65,9 @@ public:
virtual void OnEntryScroll(std::string const& entry_id, int delta);
virtual void OnEntryShowMenu(std::string const& entry_id, unsigned int xid,
- int x, int y, unsigned int button,
- unsigned int timestamp);
- virtual void OnEntrySecondaryActivate(std::string const& entry_id,
- unsigned int timestamp);
- virtual void OnShowAppMenu(unsigned int xid, int x, int y,
- unsigned int timestamp);
+ int x, int y, unsigned int button);
+ virtual void OnEntrySecondaryActivate(std::string const& entry_id);
+ virtual void OnShowAppMenu(unsigned int xid, int x, int y);
DBusIndicators* owner_;
@@ -189,7 +186,7 @@ void DBusIndicators::Impl::OnEntryActivatedRequest(GVariant* parameters)
void DBusIndicators::Impl::OnEntryShowNowChanged(GVariant* parameters)
{
glib::String entry_name;
- gboolean show_now;
+ gboolean show_now;
g_variant_get(parameters, "(sb)", &entry_name, &show_now);
if (entry_name)
@@ -211,43 +208,40 @@ void DBusIndicators::Impl::RequestSyncIndicator(std::string const& name)
void DBusIndicators::Impl::OnEntryShowMenu(std::string const& entry_id,
unsigned int xid, int x, int y,
- unsigned int button,
- unsigned int timestamp)
+ unsigned int button)
{
- owner_->on_entry_show_menu.emit(entry_id, xid, x, y, button, timestamp);
+ owner_->on_entry_show_menu.emit(entry_id, xid, x, y, button);
// We have to do this because on certain systems X won't have time to
// respond to our request for XUngrabPointer and this will cause the
// menu not to show
show_entry_idle_.reset(new glib::Idle(glib::Source::Priority::DEFAULT));
- show_entry_idle_->Run([&, entry_id, xid, x, y, button, timestamp] {
- gproxy_.Call("ShowEntry", g_variant_new("(suiiuu)", entry_id.c_str(), xid,
- x, y, button, timestamp));
+ show_entry_idle_->Run([&, entry_id, xid, x, y, button] {
+ gproxy_.Call("ShowEntry", g_variant_new("(suiiu)", entry_id.c_str(), xid,
+ x, y, button));
return false;
});
}
-void DBusIndicators::Impl::OnShowAppMenu(unsigned int xid, int x, int y,
- unsigned int timestamp)
+void DBusIndicators::Impl::OnShowAppMenu(unsigned int xid, int x, int y)
{
- owner_->on_show_appmenu.emit(xid, x, y, timestamp);
+ owner_->on_show_appmenu.emit(xid, x, y);
// We have to do this because on certain systems X won't have time to
// respond to our request for XUngrabPointer and this will cause the
// menu not to show
show_entry_idle_.reset(new glib::Idle(glib::Source::Priority::DEFAULT));
- show_entry_idle_->Run([&, xid, x, y, timestamp] {
- gproxy_.Call("ShowEntry", g_variant_new("(uiiu)", xid, x, y, timestamp));
+ show_entry_idle_->Run([&, xid, x, y] {
+ gproxy_.Call("ShowEntry", g_variant_new("(uii)", xid, x, y));
return false;
});
}
-void DBusIndicators::Impl::OnEntrySecondaryActivate(std::string const& entry_id,
- unsigned int timestamp)
+void DBusIndicators::Impl::OnEntrySecondaryActivate(std::string const& entry_id)
{
- gproxy_.Call("SecondaryActivateEntry", g_variant_new("(su)", entry_id.c_str(), timestamp));
+ gproxy_.Call("SecondaryActivateEntry", g_variant_new("(s)", entry_id.c_str()));
}
void DBusIndicators::Impl::OnEntryScroll(std::string const& entry_id, int delta)
@@ -257,6 +251,9 @@ void DBusIndicators::Impl::OnEntryScroll(std::string const& entry_id, int delta)
void DBusIndicators::Impl::Sync(GVariant* args)
{
+ if (!args)
+ return;
+
GVariantIter* iter = nullptr;
gchar* name_hint = nullptr;
gchar* indicator_id = nullptr;
@@ -270,13 +267,9 @@ void DBusIndicators::Impl::Sync(GVariant* args)
gboolean image_visible = false;
gint32 priority = -1;
- // sanity check
- if (!args)
- return;
-
std::map<Indicator::Ptr, Indicator::Entries> indicators;
- int wantedIndex = 0;
- bool anyIndexDifferent = false;
+ int wanted_idx = 0;
+ bool any_different_idx = false;
g_variant_get(args, "(a(ssssbbusbbi))", &iter);
while (g_variant_iter_loop(iter, "(ssssbbusbbi)",
@@ -292,8 +285,8 @@ void DBusIndicators::Impl::Sync(GVariant* args)
&image_visible,
&priority))
{
- std::string entry(entry_id);
- std::string indicator_name(indicator_id);
+ std::string entry(G_LIKELY(entry_id) ? entry_id : "");
+ std::string indicator_name(G_LIKELY(indicator_id) ? indicator_id : "");
Indicator::Ptr indicator = owner_->GetIndicator(indicator_name);
if (!indicator)
@@ -303,20 +296,23 @@ void DBusIndicators::Impl::Sync(GVariant* args)
Indicator::Entries& entries = indicators[indicator];
- // Null entries (entry_id == "") are empty indicators.
- if (entry != "")
+ // Empty entries are empty indicators.
+ if (!entry.empty())
{
Entry::Ptr e;
- if (!anyIndexDifferent)
+ if (!any_different_idx)
{
// Indicators can only add or remove entries, so if
// there is a index change we can't reuse the existing ones
// after that index
- int existingEntryIndex = indicator->EntryIndex(entry_id);
- if (wantedIndex == existingEntryIndex)
+ if (indicator->EntryIndex(entry_id) == wanted_idx)
+ {
e = indicator->GetEntry(entry_id);
+ }
else
- anyIndexDifferent = true;
+ {
+ any_different_idx = true;
+ }
}
if (!e)
@@ -333,7 +329,7 @@ void DBusIndicators::Impl::Sync(GVariant* args)
}
entries.push_back(e);
- wantedIndex++;
+ ++wanted_idx;
}
}
g_variant_iter_free(iter);
@@ -350,45 +346,39 @@ void DBusIndicators::Impl::Sync(GVariant* args)
void DBusIndicators::Impl::SyncGeometries(std::string const& name,
EntryLocationMap const& locations)
{
- if (!gproxy_.IsConnected())
+ if (!gproxy_.IsConnected() || G_UNLIKELY(name.empty()))
return;
- GVariantBuilder b;
bool found_changed_locations = false;
- g_variant_builder_init(&b, G_VARIANT_TYPE("(a(ssiiii))"));
- g_variant_builder_open(&b, G_VARIANT_TYPE("a(ssiiii)"));
- EntryLocationMap& cached_loc = cached_locations_[name];
+ EntryLocationMap& cached_locations = cached_locations_[name];
+
+ GVariantBuilder b;
+ g_variant_builder_init(&b, G_VARIANT_TYPE("(sa(siiii))"));
+ g_variant_builder_add(&b, "s", name.c_str());
+
+ g_variant_builder_open(&b, G_VARIANT_TYPE("a(siiii)"));
// Only send to panel service the geometries of items that have changed
- for (auto i = locations.begin(), end = locations.end(); i != end; ++i)
+ for (auto const& location : locations)
{
- auto rect = i->second;
+ auto const& id = location.first;
+ auto const& rect = location.second;
- if (cached_loc[i->first] != rect)
+ if (cached_locations[id] != rect)
{
- g_variant_builder_add(&b, "(ssiiii)",
- name.c_str(),
- i->first.c_str(),
- rect.x,
- rect.y,
- rect.width,
- rect.height);
+ g_variant_builder_add(&b, "(siiii)", id.c_str(), rect.x, rect.y, rect.width, rect.height);
found_changed_locations = true;
}
}
// Inform panel service of the entries that have been removed sending invalid values
- for (auto i = cached_loc.begin(), end = cached_loc.end(); i != end; ++i)
+ for (auto const& location : cached_locations)
{
- if (locations.find(i->first) == locations.end())
+ auto const& id = location.first;
+
+ if (locations.find(id) == locations.end())
{
- g_variant_builder_add(&b, "(ssiiii)",
- name.c_str(),
- i->first.c_str(),
- 0,
- 0,
- -1,
- -1);
+ g_variant_builder_add(&b, "(siiii)", id.c_str(), 0, 0, -1, -1);
found_changed_locations = true;
}
}
@@ -402,7 +392,7 @@ void DBusIndicators::Impl::SyncGeometries(std::string const& name,
g_variant_builder_close(&b);
gproxy_.Call("SyncGeometries", g_variant_builder_end(&b));
- cached_loc = locations;
+ cached_locations = locations;
}
DBusIndicators::DBusIndicators()
@@ -434,21 +424,19 @@ void DBusIndicators::OnEntryScroll(std::string const& entry_id, int delta)
void DBusIndicators::OnEntryShowMenu(std::string const& entry_id,
unsigned int xid, int x, int y,
- unsigned int button, unsigned int timestamp)
+ unsigned int button)
{
- pimpl->OnEntryShowMenu(entry_id, xid, x, y, button, timestamp);
+ pimpl->OnEntryShowMenu(entry_id, xid, x, y, button);
}
-void DBusIndicators::OnEntrySecondaryActivate(std::string const& entry_id,
- unsigned int timestamp)
+void DBusIndicators::OnEntrySecondaryActivate(std::string const& entry_id)
{
- pimpl->OnEntrySecondaryActivate(entry_id, timestamp);
+ pimpl->OnEntrySecondaryActivate(entry_id);
}
-void DBusIndicators::OnShowAppMenu(unsigned int xid, int x, int y,
- unsigned int timestamp)
+void DBusIndicators::OnShowAppMenu(unsigned int xid, int x, int y)
{
- pimpl->OnShowAppMenu(xid, x, y, timestamp);
+ pimpl->OnShowAppMenu(xid, x, y);
}
} // namespace indicator
diff --git a/UnityCore/DBusIndicators.h b/UnityCore/DBusIndicators.h
index 5ac1111c8..fe5dbc178 100644
--- a/UnityCore/DBusIndicators.h
+++ b/UnityCore/DBusIndicators.h
@@ -38,17 +38,13 @@ public:
DBusIndicators();
~DBusIndicators();
- void SyncGeometries(std::string const& name,
- EntryLocationMap const& locations);
+ void SyncGeometries(std::string const& name, EntryLocationMap const& locations);
virtual void OnEntryScroll(std::string const& entry_id, int delta);
virtual void OnEntryShowMenu(std::string const& entry_id, unsigned int xid,
- int x, int y, unsigned int button,
- unsigned int timestamp);
- virtual void OnEntrySecondaryActivate(std::string const& entry_id,
- unsigned int timestamp);
- virtual void OnShowAppMenu(unsigned int xid, int x, int y,
- unsigned int timestamp);
+ int x, int y, unsigned int button);
+ virtual void OnEntrySecondaryActivate(std::string const& entry_id);
+ virtual void OnShowAppMenu(unsigned int xid, int x, int y);
protected:
DBusIndicators(std::string const& dbus_name);
diff --git a/UnityCore/Indicator.cpp b/UnityCore/Indicator.cpp
index 688d3c110..42d8bb675 100644
--- a/UnityCore/Indicator.cpp
+++ b/UnityCore/Indicator.cpp
@@ -130,16 +130,15 @@ int Indicator::EntryIndex(std::string const& entry_id) const
return -1;
}
-void Indicator::OnEntryShowMenu(std::string const& entry_id, unsigned int xid,
- int x, int y, unsigned int button, unsigned int timestamp)
+void Indicator::OnEntryShowMenu(std::string const& entry_id, unsigned xid,
+ int x, int y, unsigned button)
{
- on_show_menu.emit(entry_id, xid, x, y, button, timestamp);
+ on_show_menu.emit(entry_id, xid, x, y, button);
}
-void Indicator::OnEntrySecondaryActivate(std::string const& entry_id,
- unsigned int timestamp)
+void Indicator::OnEntrySecondaryActivate(std::string const& entry_id)
{
- on_secondary_activate.emit(entry_id, timestamp);
+ on_secondary_activate.emit(entry_id);
}
void Indicator::OnEntryScroll(std::string const& entry_id, int delta)
diff --git a/UnityCore/Indicator.h b/UnityCore/Indicator.h
index 23b4bd575..682c4d1e0 100644
--- a/UnityCore/Indicator.h
+++ b/UnityCore/Indicator.h
@@ -54,13 +54,13 @@ public:
// Signals
sigc::signal<void, Entry::Ptr const&> on_entry_added;
sigc::signal<void, std::string const&> on_entry_removed;
- sigc::signal<void, std::string const&, unsigned int, int, int, unsigned int, unsigned int> on_show_menu;
- sigc::signal<void, std::string const&, unsigned int> on_secondary_activate;
+ sigc::signal<void, std::string const&, unsigned, int, int, unsigned> on_show_menu;
+ sigc::signal<void, std::string const&> on_secondary_activate;
sigc::signal<void, std::string const&, int> on_scroll;
protected:
- void OnEntryShowMenu(std::string const& entry_id, unsigned int xid, int x, int y, unsigned int button, unsigned int timestamp);
- void OnEntrySecondaryActivate(std::string const& entry_id, unsigned int timestamp);
+ void OnEntryShowMenu(std::string const& entry_id, unsigned xid, int x, int y, unsigned button);
+ void OnEntrySecondaryActivate(std::string const& entry_id);
void OnEntryScroll(std::string const& entry_id, int delta);
Entries entries_;
diff --git a/UnityCore/IndicatorEntry.cpp b/UnityCore/IndicatorEntry.cpp
index 34784841b..63a7ec415 100644
--- a/UnityCore/IndicatorEntry.cpp
+++ b/UnityCore/IndicatorEntry.cpp
@@ -205,19 +205,19 @@ void Entry::set_show_now(bool show_now)
updated.emit();
}
-void Entry::ShowMenu(int x, int y, unsigned int button, unsigned int timestamp)
+void Entry::ShowMenu(int x, int y, unsigned button)
{
- ShowMenu(0, x, y, button, timestamp);
+ ShowMenu(0, x, y, button);
}
-void Entry::ShowMenu(unsigned int xid, int x, int y, unsigned int button, unsigned int timestamp)
+void Entry::ShowMenu(unsigned int xid, int x, int y, unsigned button)
{
- on_show_menu.emit(id_, xid, x, y, button, timestamp);
+ on_show_menu.emit(id_, xid, x, y, button);
}
-void Entry::SecondaryActivate(unsigned int timestamp)
+void Entry::SecondaryActivate()
{
- on_secondary_activate.emit(id_, timestamp);
+ on_secondary_activate.emit(id_);
}
void Entry::Scroll(int delta)
diff --git a/UnityCore/IndicatorEntry.h b/UnityCore/IndicatorEntry.h
index 73928be8e..ffe1b0414 100644
--- a/UnityCore/IndicatorEntry.h
+++ b/UnityCore/IndicatorEntry.h
@@ -85,9 +85,9 @@ public:
bool show_now() const;
void set_show_now(bool show_now);
- void ShowMenu(int x, int y, unsigned int button, unsigned int timestamp);
- void ShowMenu(unsigned int xid, int x, int y, unsigned int button, unsigned int timestamp);
- void SecondaryActivate(unsigned int timestamp);
+ void ShowMenu(int x, int y, unsigned button);
+ void ShowMenu(unsigned int xid, int x, int y, unsigned button);
+ void SecondaryActivate();
void Scroll(int delta);
void setLabel(std::string const& label, bool sensitive, bool visible);
@@ -100,8 +100,8 @@ public:
sigc::signal<void, nux::Rect const&> geometry_changed;
sigc::signal<void, bool> show_now_changed;
- sigc::signal<void, std::string const&, unsigned int, int, int, unsigned int, unsigned int> on_show_menu;
- sigc::signal<void, std::string const&, unsigned int> on_secondary_activate;
+ sigc::signal<void, std::string const&, unsigned, int, int, unsigned> on_show_menu;
+ sigc::signal<void, std::string const&> on_secondary_activate;
sigc::signal<void, std::string const&, int> on_scroll;
private:
diff --git a/UnityCore/Indicators.h b/UnityCore/Indicators.h
index 024f0c2f6..53b4d004f 100644
--- a/UnityCore/Indicators.h
+++ b/UnityCore/Indicators.h
@@ -59,20 +59,17 @@ public:
* internal
*/
virtual void OnEntryShowMenu(std::string const& entry_id, unsigned int xid,
- int x, int y, unsigned int button,
- unsigned int timestamp) = 0;
+ int x, int y, unsigned int button) = 0;
/**
* internal
*/
- virtual void OnEntrySecondaryActivate(std::string const& entry_id,
- unsigned int timestamp) = 0;
+ virtual void OnEntrySecondaryActivate(std::string const& entry_id) = 0;
/**
* internal
*/
- virtual void OnShowAppMenu(unsigned int xid, int x, int y,
- unsigned int timestamp) = 0;
+ virtual void OnShowAppMenu(unsigned int xid, int x, int y) = 0;
// Signals
sigc::signal<void, Indicator::Ptr const&> on_object_added;
@@ -104,18 +101,16 @@ public:
* @param x coordinate
* @param y coordinate
* @param button pressed button
- * @param timestamp current time
*/
- sigc::signal<void, std::string const&, unsigned int, int, int, unsigned int, unsigned int> on_entry_show_menu;
+ sigc::signal<void, std::string const&, unsigned, int, int, unsigned> on_entry_show_menu;
/**
* The service is about to show an appmenu.
* @param xid window xid
* @param x coordinate
* @param y coordinate
- * @param timestamp current time
*/
- sigc::signal<void, unsigned int, int, int, unsigned int> on_show_appmenu;
+ sigc::signal<void, unsigned, int, int> on_show_appmenu;
protected:
Indicator::Ptr GetIndicator(std::string const& name);
diff --git a/UnityCore/ModelRowAdaptor-inl.h b/UnityCore/ModelRowAdaptor-inl.h
index 96e24e675..58623584b 100644
--- a/UnityCore/ModelRowAdaptor-inl.h
+++ b/UnityCore/ModelRowAdaptor-inl.h
@@ -28,13 +28,13 @@ namespace dash
template<typename T>
void RowAdaptorBase::set_renderer(T renderer)
{
- dee_model_set_tag(model_, iter_, tag_, renderer);
+ set_model_tag(renderer);
}
template<typename T>
-T RowAdaptorBase::renderer()
+T RowAdaptorBase::renderer() const
{
- return static_cast<T>(dee_model_get_tag(model_, iter_, tag_));
+ return static_cast<T>(get_model_tag());
}
}
diff --git a/UnityCore/ModelRowAdaptor.cpp b/UnityCore/ModelRowAdaptor.cpp
index 5f701400d..d1c7d4ba7 100644
--- a/UnityCore/ModelRowAdaptor.cpp
+++ b/UnityCore/ModelRowAdaptor.cpp
@@ -36,6 +36,10 @@ RowAdaptorBase::RowAdaptorBase(RowAdaptorBase const& other)
tag_ = other.tag_;
}
+RowAdaptorBase::~RowAdaptorBase()
+{
+}
+
RowAdaptorBase& RowAdaptorBase::operator=(RowAdaptorBase const& other)
{
model_ = other.model_;
@@ -91,5 +95,15 @@ float RowAdaptorBase::GetFloatAt(int position) const
return static_cast<float>(dee_model_get_double(model_, iter_, position));
}
+void RowAdaptorBase::set_model_tag(gpointer value)
+{
+ dee_model_set_tag(model_, iter_, tag_, value);
+}
+
+gpointer RowAdaptorBase::get_model_tag() const
+{
+ return dee_model_get_tag(model_, iter_, tag_);
+}
+
}
}
diff --git a/UnityCore/ModelRowAdaptor.h b/UnityCore/ModelRowAdaptor.h
index b4fc929b4..8d38e841c 100644
--- a/UnityCore/ModelRowAdaptor.h
+++ b/UnityCore/ModelRowAdaptor.h
@@ -50,13 +50,15 @@ class RowAdaptorBase
public:
RowAdaptorBase(DeeModel* model=0, DeeModelIter* iter=0, DeeModelTag* tag=0);
RowAdaptorBase(RowAdaptorBase const& other);
+ virtual ~RowAdaptorBase();
+
RowAdaptorBase& operator=(RowAdaptorBase const& other);
- std::string GetStringAt(int position) const;
- bool GetBoolAt(int position) const;
- int GetIntAt(int position) const;
- unsigned int GetUIntAt(int position) const;
- float GetFloatAt(int position) const;
+ virtual std::string GetStringAt(int position) const;
+ virtual bool GetBoolAt(int position) const;
+ virtual int GetIntAt(int position) const;
+ virtual unsigned int GetUIntAt(int position) const;
+ virtual float GetFloatAt(int position) const;
void SetTarget(DeeModel* model, DeeModelIter* iter, DeeModelTag* tag);
@@ -64,9 +66,12 @@ public:
void set_renderer(T renderer);
template<typename T>
- T renderer();
+ T renderer() const;
protected:
+ virtual void set_model_tag(gpointer value);
+ virtual gpointer get_model_tag() const;
+
DeeModel* model_;
DeeModelIter* iter_;
DeeModelTag* tag_;
diff --git a/UnityCore/Result.cpp b/UnityCore/Result.cpp
index 78723c5e1..e334761d3 100644
--- a/UnityCore/Result.cpp
+++ b/UnityCore/Result.cpp
@@ -48,14 +48,22 @@ Result& Result::operator=(Result const& other)
void Result::SetupGetters()
{
- uri.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 0));
- icon_hint.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 1));
- category_index.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetUIntAt), 2));
- mimetype.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 3));
- name.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 4));
- comment.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 5));
- dnd_uri.SetGetterFunction(sigc::bind(sigc::mem_fun(this, &RowAdaptorBase::GetStringAt), 6));
+ uri.SetGetterFunction(sigc::mem_fun(this, &Result::GetURI));
+ icon_hint.SetGetterFunction(sigc::mem_fun(this, &Result::GetIconHint));
+ category_index.SetGetterFunction(sigc::mem_fun(this, &Result::GetCategoryIndex));
+ mimetype.SetGetterFunction(sigc::mem_fun(this, &Result::GetMimeType));
+ name.SetGetterFunction(sigc::mem_fun(this, &Result::GetName));
+ comment.SetGetterFunction(sigc::mem_fun(this, &Result::GetComment));
+ dnd_uri.SetGetterFunction(sigc::mem_fun(this, &Result::GetDndURI));
}
+std::string Result::GetURI() const { return GetStringAt(0); }
+std::string Result::GetIconHint() const { return GetStringAt(1); }
+std::size_t Result::GetCategoryIndex() const { return GetUIntAt(2); }
+std::string Result::GetMimeType() const { return GetStringAt(3); }
+std::string Result::GetName() const { return GetStringAt(4); }
+std::string Result::GetComment() const { return GetStringAt(5); }
+std::string Result::GetDndURI() const { return GetStringAt(6); }
+
}
}
diff --git a/UnityCore/Result.h b/UnityCore/Result.h
index 8e00f85fd..4fb3332cc 100644
--- a/UnityCore/Result.h
+++ b/UnityCore/Result.h
@@ -51,6 +51,15 @@ public:
nux::ROProperty<std::string> comment;
nux::ROProperty<std::string> dnd_uri;
+protected:
+ virtual std::string GetURI() const;
+ virtual std::string GetIconHint() const;
+ virtual std::size_t GetCategoryIndex() const;
+ virtual std::string GetMimeType() const;
+ virtual std::string GetName() const;
+ virtual std::string GetComment() const;
+ virtual std::string GetDndURI() const;
+
private:
void SetupGetters();
};