summaryrefslogtreecommitdiff
path: root/unity-shared
diff options
authorNick Dedekind <nicholas.dedekind@gmail.com>2012-07-18 16:15:29 +0100
committerNick Dedekind <nicholas.dedekind@gmail.com>2012-07-18 16:15:29 +0100
commitdc8534a6b7a9881f0d4e68941c4ad95dab897cf4 (patch)
tree6979b094765f848f026cfbfe40f19366171ebade /unity-shared
parentd81520d95b182dcada788d6ee736a0f40964d0cd (diff)
parent1acfeb0895b2d4f2d183bfdc41bb6ffb94d495fd (diff)
Merged with trunk
(bzr r2419.4.22)
Diffstat (limited to 'unity-shared')
-rw-r--r--unity-shared/FontSettings.cpp1
-rw-r--r--unity-shared/IconLoader.cpp19
-rw-r--r--unity-shared/IconLoader.h3
-rw-r--r--unity-shared/PluginAdapterStandalone.cpp16
-rw-r--r--unity-shared/TextureCache.cpp3
-rw-r--r--unity-shared/TextureCache.h4
-rw-r--r--unity-shared/UBusWrapper.cpp6
-rw-r--r--unity-shared/UBusWrapper.h30
8 files changed, 41 insertions, 41 deletions
diff --git a/unity-shared/FontSettings.cpp b/unity-shared/FontSettings.cpp
index 24c31e8a1..1b115f8e1 100644
--- a/unity-shared/FontSettings.cpp
+++ b/unity-shared/FontSettings.cpp
@@ -21,6 +21,7 @@
#include <cairo/cairo.h>
#include <UnityCore/GLibWrapper.h>
+#include <sigc++/sigc++.h>
namespace unity
{
diff --git a/unity-shared/IconLoader.cpp b/unity-shared/IconLoader.cpp
index d35b24e22..2627d914c 100644
--- a/unity-shared/IconLoader.cpp
+++ b/unity-shared/IconLoader.cpp
@@ -109,12 +109,15 @@ private:
void InvokeSlot()
{
- slot(data, size, result);
+ if (slot)
+ slot(data, size, result);
// notify shadow tasks
for (auto shadow_task : shadow_tasks)
{
- shadow_task->slot(shadow_task->data, shadow_task->size, result);
+ if (shadow_task->slot)
+ shadow_task->slot(shadow_task->data, shadow_task->size, result);
+
impl->task_map_.erase(shadow_task->handle);
}
@@ -373,7 +376,7 @@ int IconLoader::Impl::LoadFromIconName(std::string const& icon_name,
unsigned size,
IconLoaderCallback slot)
{
- if (no_load_ || icon_name.empty() || size < MIN_ICON_SIZE)
+ if (no_load_ || icon_name.empty() || size < MIN_ICON_SIZE || !slot)
return 0;
// We need to check this because of legacy desktop files
@@ -389,7 +392,7 @@ int IconLoader::Impl::LoadFromGIconString(std::string const& gicon_string,
unsigned size,
IconLoaderCallback slot)
{
- if (no_load_ || gicon_string.empty() || size < MIN_ICON_SIZE)
+ if (no_load_ || gicon_string.empty() || size < MIN_ICON_SIZE || !slot)
return 0;
return ReturnCachedOrQueue(gicon_string, size, slot, REQUEST_TYPE_GICON_STRING);
@@ -399,7 +402,7 @@ int IconLoader::Impl::LoadFromFilename(std::string const& filename,
unsigned size,
IconLoaderCallback slot)
{
- if (no_load_ || filename.empty() || size < MIN_ICON_SIZE)
+ if (no_load_ || filename.empty() || size < MIN_ICON_SIZE || !slot)
return 0;
glib::Object<GFile> file(::g_file_new_for_path(filename.c_str()));
@@ -412,7 +415,7 @@ int IconLoader::Impl::LoadFromURI(std::string const& uri,
unsigned size,
IconLoaderCallback slot)
{
- if (no_load_ || uri.empty() || size < MIN_ICON_SIZE)
+ if (no_load_ || uri.empty() || size < MIN_ICON_SIZE || !slot)
return 0;
return ReturnCachedOrQueue(uri, size, slot, REQUEST_TYPE_URI);
@@ -424,7 +427,7 @@ void IconLoader::Impl::DisconnectHandle(Handle handle)
if (iter != task_map_.end())
{
- iter->second->slot.disconnect();
+ iter->second->slot = nullptr;
}
}
@@ -503,7 +506,7 @@ bool IconLoader::Impl::CacheLookup(std::string const& key,
auto iter = cache_.find(key);
bool found = iter != cache_.end();
- if (found)
+ if (found && slot)
{
glib::Object<GdkPixbuf> const& pixbuf = iter->second;
slot(data, size, pixbuf);
diff --git a/unity-shared/IconLoader.h b/unity-shared/IconLoader.h
index bc70705a0..099bf059f 100644
--- a/unity-shared/IconLoader.h
+++ b/unity-shared/IconLoader.h
@@ -23,7 +23,6 @@
#include <boost/utility.hpp>
#include <memory>
-#include <sigc++/sigc++.h>
#include <gtk/gtk.h>
#include <UnityCore/GLibWrapper.h>
@@ -33,7 +32,7 @@ namespace unity
class IconLoader : public boost::noncopyable
{
public:
- typedef sigc::slot<void, std::string const&, unsigned, glib::Object<GdkPixbuf> const&> IconLoaderCallback;
+ typedef std::function<void(std::string const&, unsigned, glib::Object<GdkPixbuf> const&)> IconLoaderCallback;
IconLoader();
~IconLoader();
diff --git a/unity-shared/PluginAdapterStandalone.cpp b/unity-shared/PluginAdapterStandalone.cpp
index 5708bfbc4..45d0d5723 100644
--- a/unity-shared/PluginAdapterStandalone.cpp
+++ b/unity-shared/PluginAdapterStandalone.cpp
@@ -124,7 +124,7 @@ MultiActionList::TerminateAll(CompOption::Vector& extraArgs)
{
}
-unsigned long long
+unsigned long long
PluginAdapter::GetWindowActiveNumber (guint32 xid)
{
return 0;
@@ -281,18 +281,18 @@ PluginAdapter::Lower(guint32 xid)
{
}
-void
+void
PluginAdapter::FocusWindowGroup(std::vector<Window> window_ids, FocusVisibility focus_visibility, int monitor, bool only_top_win)
{
}
-bool
+bool
PluginAdapter::ScaleWindowGroup(std::vector<Window> windows, int state, bool force)
{
return false;
}
-void
+void
PluginAdapter::SetWindowIconGeometry(Window window, nux::Geometry const& geo)
{
}
@@ -332,14 +332,14 @@ PluginAdapter::GetWindowSavedGeometry(guint32 xid) const
return geo;
}
-nux::Geometry
+nux::Geometry
PluginAdapter::GetScreenGeometry() const
{
nux::Geometry geo(0, 0, 1, 1);
- return geo;
+ return geo;
}
-nux::Geometry
+nux::Geometry
PluginAdapter::GetWorkAreaGeometry(guint32 xid) const
{
nux::Geometry geo(0, 0, 1, 1);
@@ -352,7 +352,7 @@ PluginAdapter::CheckWindowIntersection(nux::Geometry const& region, CompWindow*
return false;
}
-void
+void
PluginAdapter::CheckWindowIntersections (nux::Geometry const& region, bool &active, bool &any)
{
}
diff --git a/unity-shared/TextureCache.cpp b/unity-shared/TextureCache.cpp
index 53004fc7a..0d19d5cef 100644
--- a/unity-shared/TextureCache.cpp
+++ b/unity-shared/TextureCache.cpp
@@ -55,6 +55,9 @@ TextureCache::BaseTexturePtr TextureCache::FindTexture(std::string const& textur
int width, int height,
CreateTextureCallback slot)
{
+ if (!slot)
+ return BaseTexturePtr();
+
std::string key = Hash(texture_id, width, height);
BaseTexturePtr texture(cache_[key]);
diff --git a/unity-shared/TextureCache.h b/unity-shared/TextureCache.h
index 79fa34c32..5cc569abb 100644
--- a/unity-shared/TextureCache.h
+++ b/unity-shared/TextureCache.h
@@ -25,8 +25,6 @@
#include <map>
#include <Nux/Nux.h>
-
-#include <sigc++/sigc++.h>
#include <sigc++/trackable.h>
/* A simple texture cache system, you ask the cache for a texture by id if the
@@ -43,7 +41,7 @@ public:
typedef nux::ObjectPtr<nux::BaseTexture> BaseTexturePtr;
// id, width, height -> texture
- typedef sigc::slot<nux::BaseTexture*, std::string const&, int, int> CreateTextureCallback;
+ typedef std::function<nux::BaseTexture*(std::string const&, int, int)> CreateTextureCallback;
static TextureCache& GetDefault();
diff --git a/unity-shared/UBusWrapper.cpp b/unity-shared/UBusWrapper.cpp
index 57da7e031..e1f280092 100644
--- a/unity-shared/UBusWrapper.cpp
+++ b/unity-shared/UBusWrapper.cpp
@@ -36,8 +36,10 @@ UBusManager::~UBusManager()
void UBusManager::RegisterInterest(std::string const& interest_name,
UBusManagerCallback slot)
{
- UBusConnection::Ptr connection (new UBusConnection());
- connection->manager = this;
+ if (!slot || interest_name.empty())
+ return;
+
+ auto connection = std::make_shared<UBusConnection>();
connection->name = interest_name;
connection->slot = slot;
connection->id = ubus_server_register_interest(server_,
diff --git a/unity-shared/UBusWrapper.h b/unity-shared/UBusWrapper.h
index 1b9c043e0..c18ff0a79 100644
--- a/unity-shared/UBusWrapper.h
+++ b/unity-shared/UBusWrapper.h
@@ -22,45 +22,39 @@
#include <memory>
#include <string>
#include <vector>
-
-#include <sigc++/slot.h>
+#include <boost/utility.hpp>
#include "ubus-server.h"
namespace unity
{
-class UBusManager
+class UBusManager : public boost::noncopyable
{
public:
- typedef sigc::slot<void, GVariant*> UBusManagerCallback;
+ typedef std::function<void(GVariant*)> UBusManagerCallback;
+
+ UBusManager();
+ ~UBusManager();
+ void RegisterInterest(std::string const& interest_name, UBusManagerCallback slot);
+ void UnregisterInterest(std::string const& interest_name);
+ void SendMessage(std::string const& message_name, GVariant* args = NULL);
+
+private:
struct UBusConnection
{
- public:
typedef std::shared_ptr<UBusConnection> Ptr;
- UBusManager* manager;
std::string name;
UBusManagerCallback slot;
guint id;
};
- typedef std::vector<UBusConnection::Ptr> Connections;
- UBusManager();
- ~UBusManager();
-
- void RegisterInterest(std::string const& interest_name,
- UBusManagerCallback slot);
- void UnregisterInterest(std::string const& interest_name);
- void SendMessage(std::string const& message_name, GVariant* args = NULL);
-
-private:
static void OnCallback(GVariant* args, gpointer user_data);
-private:
UBusServer* server_;
- Connections connections_;
+ std::vector<UBusConnection::Ptr> connections_;
};
}