summaryrefslogtreecommitdiff
diff options
-rw-r--r--com.canonical.Unity.gschema.xml8
-rw-r--r--unity-shared/MenuManager.cpp15
2 files changed, 23 insertions, 0 deletions
diff --git a/com.canonical.Unity.gschema.xml b/com.canonical.Unity.gschema.xml
index 331d9f5cd..4c260554f 100644
--- a/com.canonical.Unity.gschema.xml
+++ b/com.canonical.Unity.gschema.xml
@@ -53,6 +53,14 @@
on the window decoration, otherwise they will be always shown on the
unity top panel</description>
</key>
+ <key type="b" name="always-show-menus">
+ <default>false</default>
+ <summary>Toggle the menu visibility based on mouse hovering.</summary>
+ <description>When this is enabled, the application menus will be always
+ shown (on the window decoration or in the unity panel, depending whether
+ integrated menus are enabled), otherwise they will be shown only when
+ the mouse cursor is over the relative mouse area.</description>
+ </key>
</schema>
<schema path="/com/canonical/unity/interface/" id="com.canonical.Unity.Interface" gettext-domain="unity">
<key type="d" name="text-scale-factor">
diff --git a/unity-shared/MenuManager.cpp b/unity-shared/MenuManager.cpp
index 238db41bd..2f78b62f7 100644
--- a/unity-shared/MenuManager.cpp
+++ b/unity-shared/MenuManager.cpp
@@ -20,6 +20,7 @@
#include <gtk/gtk.h>
#include <NuxCore/Logger.h>
+#include <UnityCore/GLibSignal.h>
#include <UnityCore/GLibWrapper.h>
#include <UnityCore/DBusIndicators.h>
#include <unordered_map>
@@ -30,8 +31,14 @@ namespace unity
{
namespace menu
{
+namespace
+{
DECLARE_LOGGER(logger, "unity.menu.manager");
+const std::string SETTINGS_NAME = "com.canonical.Unity";
+const std::string ALWAYS_SHOW_MENUS_KEY = "always-show-menus";
+}
+
using namespace indicator;
struct Manager::Impl : sigc::trackable
@@ -40,6 +47,7 @@ struct Manager::Impl : sigc::trackable
: parent_(parent)
, indicators_(indicators)
, key_grabber_(grabber)
+ , settings_(g_settings_new(SETTINGS_NAME.c_str()))
{
for (auto const& indicator : indicators_->GetIndicators())
AddIndicator(indicator);
@@ -49,6 +57,11 @@ struct Manager::Impl : sigc::trackable
indicators_->on_object_removed.connect(sigc::mem_fun(this, &Impl::RemoveIndicator));
indicators_->on_entry_activate_request.connect(sigc::mem_fun(this, &Impl::ActivateRequest));
indicators_->icon_paths_changed.connect(sigc::mem_fun(this, &Impl::IconPathsChanged));
+
+ parent_->always_show_menus = g_settings_get_boolean(settings_, ALWAYS_SHOW_MENUS_KEY.c_str());
+ signals_.Add<void, GSettings*, const gchar*>(settings_, "changed::" + ALWAYS_SHOW_MENUS_KEY, [this] (GSettings*, const gchar*) {
+ parent_->always_show_menus = g_settings_get_boolean(settings_, ALWAYS_SHOW_MENUS_KEY.c_str());
+ });
}
~Impl()
@@ -152,6 +165,8 @@ struct Manager::Impl : sigc::trackable
AppmenuIndicator::Ptr appmenu_;
key::Grabber::Ptr key_grabber_;
connection::Manager appmenu_connections_;
+ glib::Object<GSettings> settings_;
+ glib::SignalManager signals_;
std::unordered_map<std::string, std::shared_ptr<CompAction>> entry_actions_;
};