summaryrefslogtreecommitdiff
path: root/plugins/unityshell
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2014-03-13 00:06:44 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2014-03-13 00:06:44 +0100
commit47e7b65200bf9964a119803ce2f437de0b01b5d5 (patch)
tree9e3b24d9900b9e31f36365e76167f1f4b68e7ded /plugins/unityshell
parentd7e1e330d4f9ee4a19d686f892e6139cda55b6fc (diff)
parentf583952dcfcf2b4528f832ffecdb4199377c83e4 (diff)
Merging with lp:~3v1n0/unity/scale-layout-windows
(bzr r3680.1.126)
Diffstat (limited to 'plugins/unityshell')
-rw-r--r--plugins/unityshell/src/unityshell.cpp39
-rw-r--r--plugins/unityshell/src/unityshell.h2
2 files changed, 40 insertions, 1 deletions
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 0fd268006..4b0615b87 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -138,9 +138,10 @@ const unsigned int SCROLL_DOWN_BUTTON = 6;
const unsigned int SCROLL_UP_BUTTON = 7;
const int MAX_BUFFER_AGE = 11;
const int FRAMES_TO_REDRAW_ON_RESUME = 10;
-const std::string RELAYOUT_TIMEOUT = "relayout-timeout";
const RawPixel SCALE_PADDING = 40_em;
const RawPixel SCALE_SPACING = 20_em;
+const std::string RELAYOUT_TIMEOUT = "relayout-timeout";
+const std::string FIRST_RUN_STAMP = "first_run.stamp";
} // namespace local
} // anon namespace
@@ -3756,6 +3757,7 @@ void UnityScreen::initLauncher()
auto shortcuts_modeller = std::make_shared<shortcut::CompizModeller>();
shortcut_controller_ = std::make_shared<shortcut::Controller>(base_window_raiser, shortcuts_modeller);
AddChild(shortcut_controller_.get());
+ ShowFirstRunHints();
// Setup Session Controller
auto manager = std::make_shared<session::GnomeManager>();
@@ -3835,6 +3837,41 @@ CompAction::Vector& UnityScreen::getActions()
return menus_->KeyGrabber()->GetActions();
}
+void UnityScreen::ShowFirstRunHints()
+{
+ sources_.AddTimeoutSeconds(1, [this] {
+ auto const& cache_dir = glib::gchar_to_string(g_get_user_cache_dir())+"/unity/";
+ if (!g_file_test((cache_dir+local::FIRST_RUN_STAMP).c_str(), G_FILE_TEST_EXISTS))
+ {
+ // We focus the panel, so the shortcut hint will be hidden at first user input
+ auto const& panels = panel_controller_->panels();
+ if (!panels.empty())
+ {
+ auto panel_win = static_cast<nux::BaseWindow*>(panels.front()->GetTopLevelViewWindow());
+ SaveInputThenFocus(panel_win->GetInputWindowId());
+ }
+ shortcut_controller_->first_run = true;
+ shortcut_controller_->Show();
+
+ if (g_mkdir_with_parents(cache_dir.c_str(), 0700) >= 0)
+ {
+ glib::Error error;
+ g_file_set_contents((cache_dir+local::FIRST_RUN_STAMP).c_str(), "", 0, &error);
+
+ if (error)
+ {
+ LOG_ERROR(logger) << "Impossible to save the unity stamp file: " << error;
+ }
+ }
+ else
+ {
+ LOG_ERROR(logger) << "Impossible to create unity cache folder!";
+ }
+ }
+ return false;
+ });
+}
+
/* Window init */
namespace
diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h
index 069d97b24..a9bf144d7 100644
--- a/plugins/unityshell/src/unityshell.h
+++ b/plugins/unityshell/src/unityshell.h
@@ -309,6 +309,8 @@ private:
void DamageBlurUpdateRegion(nux::Geometry const&);
+ void ShowFirstRunHints();
+
std::unique_ptr<na::TickSource> tick_source_;
std::unique_ptr<na::AnimationController> animation_controller_;