summaryrefslogtreecommitdiff
diff options
authorMarco Trevisan (TreviƱo) <mail@3v1n0.net>2015-12-11 12:44:36 +0000
committerCI Train Bot <ci-train-bot@canonical.com>2015-12-11 12:44:36 +0000
commit51a827e932f36ca51aaa432f9141a0fb1dec871c (patch)
tree3fae20f03edc72161e20512bd42d549bfa90b2a0
parentc6e39c615f0da90925b91c568609852064bac500 (diff)
parent146c6c51d06a2e30c68622f9bd7722ccadb4a234 (diff)
Switcher{View,Controller}: close active selection on Alt+q
'Q' should be instead the first key in the row, near to tab. Fixes: #1468820 Approved by: Andrea Azzarone (bzr r4039)
-rw-r--r--launcher/SwitcherController.cpp19
-rw-r--r--launcher/SwitcherControllerImpl.h2
-rw-r--r--launcher/SwitcherModel.cpp2
-rw-r--r--launcher/SwitcherModel.h2
-rw-r--r--launcher/SwitcherView.cpp4
-rw-r--r--launcher/SwitcherView.h1
6 files changed, 26 insertions, 4 deletions
diff --git a/launcher/SwitcherController.cpp b/launcher/SwitcherController.cpp
index f91df37b2..c441a63b9 100644
--- a/launcher/SwitcherController.cpp
+++ b/launcher/SwitcherController.cpp
@@ -154,6 +154,24 @@ void Controller::Impl::StopDetailMode()
}
}
+void Controller::Impl::CloseSelection()
+{
+ if (obj_->detail())
+ {
+ if (model_->detail_selection)
+ {
+ WindowManager::Default().Close(model_->DetailSelectionWindow());
+ }
+ }
+ else
+ {
+ // Using model_->Selection()->Close() would be nicer, but it wouldn't take
+ // in consideration the workspace related settings
+ for (auto window : model_->DetailXids())
+ WindowManager::Default().Close(window);
+ }
+}
+
void Controller::Next()
{
impl_->Next();
@@ -443,6 +461,7 @@ void Controller::Impl::ConstructView()
view_->switcher_prev.connect(sigc::mem_fun(this, &Impl::Prev));
view_->switcher_start_detail.connect(sigc::mem_fun(this, &Impl::StartDetailMode));
view_->switcher_stop_detail.connect(sigc::mem_fun(this, &Impl::StopDetailMode));
+ view_->switcher_close_current.connect(sigc::mem_fun(this, &Impl::CloseSelection));
ConstructWindow();
main_layout_->AddView(view_.GetPointer(), 1);
diff --git a/launcher/SwitcherControllerImpl.h b/launcher/SwitcherControllerImpl.h
index 6b2c9fd5f..4f6c00560 100644
--- a/launcher/SwitcherControllerImpl.h
+++ b/launcher/SwitcherControllerImpl.h
@@ -62,6 +62,8 @@ struct Controller::Impl : public sigc::trackable
void NextDetail();
void PrevDetail();
+ void CloseSelection();
+
void NextDetailRow();
void PrevDetailRow();
bool HasNextDetailRow() const;
diff --git a/launcher/SwitcherModel.cpp b/launcher/SwitcherModel.cpp
index ff635751b..2b17d0da4 100644
--- a/launcher/SwitcherModel.cpp
+++ b/launcher/SwitcherModel.cpp
@@ -51,7 +51,7 @@ bool CompareSwitcherItemsPriority(AbstractLauncherIcon::Ptr const& first,
}
-SwitcherModel::SwitcherModel(std::vector<AbstractLauncherIcon::Ptr> const& icons, bool sort_by_priority)
+SwitcherModel::SwitcherModel(Applications const& icons, bool sort_by_priority)
: detail_selection(false)
, detail_selection_index(0)
, only_apps_on_viewport(true)
diff --git a/launcher/SwitcherModel.h b/launcher/SwitcherModel.h
index bf34ad727..4ec7ca43c 100644
--- a/launcher/SwitcherModel.h
+++ b/launcher/SwitcherModel.h
@@ -61,7 +61,7 @@ public:
nux::Property<unsigned int> detail_selection_index;
nux::Property<bool> only_apps_on_viewport;
- SwitcherModel(std::vector<launcher::AbstractLauncherIcon::Ptr> const& icons, bool sort_by_priority);
+ SwitcherModel(Applications const&, bool sort_by_priority);
virtual ~SwitcherModel() = default;
iterator begin();
diff --git a/launcher/SwitcherView.cpp b/launcher/SwitcherView.cpp
index 701f0fe38..e073b1261 100644
--- a/launcher/SwitcherView.cpp
+++ b/launcher/SwitcherView.cpp
@@ -500,8 +500,8 @@ bool SwitcherView::InspectKeyEvent(unsigned int eventType, unsigned int keysym,
case NUX_VK_DOWN:
switcher_start_detail.emit();
break;
- default:
- return false;
+ case NUX_VK_q:
+ switcher_close_current.emit();
break;
}
}
diff --git a/launcher/SwitcherView.h b/launcher/SwitcherView.h
index 2dd595a11..1e2caf61d 100644
--- a/launcher/SwitcherView.h
+++ b/launcher/SwitcherView.h
@@ -85,6 +85,7 @@ public:
sigc::signal<void> switcher_prev;
sigc::signal<void> switcher_start_detail;
sigc::signal<void> switcher_stop_detail;
+ sigc::signal<void> switcher_close_current;
/* void; bool visible */
sigc::signal<void, bool> hide_request;