diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2015-10-01 05:52:09 +0200 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2015-10-01 05:52:09 +0200 |
| commit | 9239a7575eec66b6750565550e2171b815abd4be (patch) | |
| tree | 842459915ddb60fa8d8bbbd0d27f89d067998746 /unity-shared | |
| parent | d261c9e1632442c0036e9c488160372a5286ab20 (diff) | |
GnomeKeyGrabber: use some better naming for variables and methods
(bzr r4008.7.25)
Diffstat (limited to 'unity-shared')
| -rw-r--r-- | unity-shared/GnomeKeyGrabber.cpp | 36 | ||||
| -rw-r--r-- | unity-shared/GnomeKeyGrabberImpl.h | 6 |
2 files changed, 21 insertions, 21 deletions
diff --git a/unity-shared/GnomeKeyGrabber.cpp b/unity-shared/GnomeKeyGrabber.cpp index 77c774a8b..88d49871a 100644 --- a/unity-shared/GnomeKeyGrabber.cpp +++ b/unity-shared/GnomeKeyGrabber.cpp @@ -204,7 +204,7 @@ GVariant* GnomeGrabber::Impl::OnShellMethodCall(std::string const& method, GVari return nullptr; } -uint32_t GnomeGrabber::Impl::GrabDBusAccelerator(std::string const& sender, std::string const& accelerator, uint32_t flags) +uint32_t GnomeGrabber::Impl::GrabDBusAccelerator(std::string const& owner, std::string const& accelerator, uint32_t flags) { CompAction action; action.keyFromString(accelerator); @@ -249,23 +249,23 @@ uint32_t GnomeGrabber::Impl::GrabDBusAccelerator(std::string const& sender, std: if (AddAction(action, action_id)) { - auto& owner_actions = actions_by_dest_[sender]; + auto& owner_actions = actions_by_owner_[owner]; bool first_insertion = owner_actions.actions.empty(); owner_actions.actions.insert(action_id); if (first_insertion) { - LOG_DEBUG(logger) << "Initialize dbus watcher for sender '" << sender << "'"; - owner_actions.watcher = std::make_shared<glib::DBusNameWatcher>(sender); + LOG_DEBUG(logger) << "Initialize dbus watcher for owner '" << owner << "'"; + owner_actions.watcher = std::make_shared<glib::DBusNameWatcher>(owner); owner_actions.watcher->vanished.connect([this] (std::string const& name) { LOG_DEBUG(logger) << "Signal destination vanished '" << name << "', removing related actions"; - auto it = actions_by_dest_.find(name); - if (it != actions_by_dest_.end()) + auto it = actions_by_owner_.find(name); + if (it != actions_by_owner_.end()) { for (auto action_id : it->second.actions) - RemoveActionForSender(action_id, name); + RemoveActionForOwner(action_id, name); - actions_by_dest_.erase(it); + actions_by_owner_.erase(it); } }); } @@ -276,32 +276,32 @@ uint32_t GnomeGrabber::Impl::GrabDBusAccelerator(std::string const& sender, std: return 0; } -bool GnomeGrabber::Impl::UnGrabDBusAccelerator(std::string const& sender, uint32_t action_id) +bool GnomeGrabber::Impl::UnGrabDBusAccelerator(std::string const& owner, uint32_t action_id) { LOG_DEBUG(logger) << "UnGrabDBusAccelerator \"" << action_id << "\""; - auto it = actions_by_dest_.find(sender); - if (it != actions_by_dest_.end()) + auto it = actions_by_owner_.find(owner); + if (it != actions_by_owner_.end()) { auto& actions = it->second.actions; actions.erase(action_id); if (actions.empty()) - actions_by_dest_.erase(it); + actions_by_owner_.erase(it); - return RemoveActionForSender(action_id, sender); + return RemoveActionForOwner(action_id, owner); } - LOG_WARN(logger) << "Action " << action_id << " was not registered by " << sender << ". " + LOG_WARN(logger) << "Action " << action_id << " was not registered by " << owner << ". " << "Unregistration denied"; return false; } -bool GnomeGrabber::Impl::RemoveActionForSender(uint32_t action_id, std::string const& sender) +bool GnomeGrabber::Impl::RemoveActionForOwner(uint32_t action_id, std::string const& owner) { - for (auto it = actions_by_dest_.begin(); it != actions_by_dest_.end(); ++it) + for (auto it = actions_by_owner_.begin(); it != actions_by_owner_.end(); ++it) { - if (it->first == sender) + if (it->first == owner) continue; auto const& actions = it->second.actions; @@ -319,7 +319,7 @@ void GnomeGrabber::Impl::ActivateDBusAction(CompAction const& action, uint32_t a { LOG_DEBUG(logger) << "ActivateAction (" << action_id << " \"" << action.keyToString() << "\")"; - for (auto const& pair : actions_by_dest_) + for (auto const& pair : actions_by_owner_) { if (pair.second.actions.find(action_id) != pair.second.actions.end()) shell_object_->EmitSignal("AcceleratorActivated", g_variant_new("(uuu)", action_id, device, timestamp), pair.first); diff --git a/unity-shared/GnomeKeyGrabberImpl.h b/unity-shared/GnomeKeyGrabberImpl.h index bb693c37e..2c03827dd 100644 --- a/unity-shared/GnomeKeyGrabberImpl.h +++ b/unity-shared/GnomeKeyGrabberImpl.h @@ -49,10 +49,10 @@ struct GnomeGrabber::Impl bool RemoveActionByIndex(size_t index); GVariant* OnShellMethodCall(std::string const& method, GVariant* parameters, std::string const& sender, std::string const&); - uint32_t GrabDBusAccelerator(std::string const& sender, std::string const& accelerator, uint32_t flags); + uint32_t GrabDBusAccelerator(std::string const& owner, std::string const& accelerator, uint32_t flags); bool UnGrabDBusAccelerator(std::string const& sender, uint32_t action_id); void ActivateDBusAction(CompAction const& action, uint32_t id, uint32_t device, uint32_t timestamp) const; - bool RemoveActionForSender(uint32_t action_id, std::string const& sender); + bool RemoveActionForOwner(uint32_t action_id, std::string const& owner); bool IsActionPostponed(CompAction const& action) const; @@ -66,7 +66,7 @@ struct GnomeGrabber::Impl CompAction::Vector actions_; struct OwnerActions { glib::DBusNameWatcher::Ptr watcher; std::unordered_set<uint32_t> actions; }; - std::unordered_map<std::string, OwnerActions> actions_by_dest_; + std::unordered_map<std::string, OwnerActions> actions_by_owner_; }; } // namespace key |
