← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcpp-plugin-sdk-cpp/trunk] Rev 18: update wrappers

 

------------------------------------------------------------
revno: 18
committer: poy <poy@xxxxxxxxxx>
branch nick: dcpp-plugin-sdk-cpp
timestamp: Mon 2013-05-13 19:27:19 +0200
message:
  update wrappers
modified:
  pluginsdk/UI.cpp
  pluginsdk/UI.h


--
lp:dcpp-plugin-sdk-cpp
https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcpp-plugin-sdk-cpp.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/trunk/+edit-subscription
=== modified file 'pluginsdk/UI.cpp'
--- pluginsdk/UI.cpp	2013-04-23 18:12:02 +0000
+++ pluginsdk/UI.cpp	2013-05-13 17:27:19 +0000
@@ -25,23 +25,24 @@
 namespace dcapi {
 
 DCUIPtr UI::ui;
+string UI::guid;
 unordered_map<string, pair<UI::Command, string>> UI::commands;
 
-bool UI::init() {
+bool UI::init(string pluginGuid) {
 	if(!Core::handle()) { return false; }
-	init(reinterpret_cast<DCUIPtr>(Core::handle()->query_interface(DCINTF_DCPP_UI, DCINTF_DCPP_UI_VER)));
+	init(reinterpret_cast<DCUIPtr>(Core::handle()->query_interface(DCINTF_DCPP_UI, DCINTF_DCPP_UI_VER)), move(pluginGuid));
 	return ui;
 }
-void UI::init(DCUIPtr coreUI) { ui = coreUI; }
+void UI::init(DCUIPtr coreUI, string pluginGuid) { ui = coreUI; guid = move(pluginGuid); }
 DCUIPtr UI::handle() { return ui; }
 
 void UI::addCommand(string name, Command command, string icon) {
 	const auto& iter = commands.insert(std::make_pair(move(name), std::make_pair(command, move(icon)))).first;
-	ui->add_command(iter->first.c_str(), commandCallback, iter->second.second.c_str());
+	ui->add_command(guid.c_str(), iter->first.c_str(), commandCallback, iter->second.second.c_str());
 }
 
 void UI::removeCommand(const string& name) {
-	ui->remove_command(name.c_str());
+	ui->remove_command(guid.c_str(), name.c_str());
 	commands.erase(name);
 }
 

=== modified file 'pluginsdk/UI.h'
--- pluginsdk/UI.h	2013-04-23 18:12:02 +0000
+++ pluginsdk/UI.h	2013-05-13 17:27:19 +0000
@@ -37,8 +37,8 @@
 class UI
 {
 public:
-	static bool init();
-	static void init(DCUIPtr coreUI);
+	static bool init(string pluginGuid);
+	static void init(DCUIPtr coreUI, string pluginGuid);
 	static DCUIPtr handle();
 
 	typedef function<void ()> Command;
@@ -50,6 +50,7 @@
 
 	static DCUIPtr ui;
 
+	static string guid;
 	static unordered_map<string, pair<UI::Command, string>> commands;
 };