[gnote] Make possible to disable GlobalKeybinder



commit 9f8bc20deff1ea8fbd58b6f215e3ac9141f42944
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sat Sep 7 22:10:13 2013 +0300

    Make possible to disable GlobalKeybinder

 src/utils.cpp |   11 ++++++++++-
 src/utils.hpp |    6 +++++-
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/utils.cpp b/src/utils.cpp
index c78f57d..9b6914b 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -281,10 +281,19 @@ namespace gnote {
                           modifiers,
                           flags);
       foo->show ();
-
+      foo->set_sensitive(m_fake_menu.get_sensitive());
       m_fake_menu.append (*foo);
     }
 
+    void GlobalKeybinder::enabled(bool enable)
+    {
+      m_fake_menu.set_sensitive(enable);
+      std::vector<Gtk::Widget*> items = m_fake_menu.get_children();
+      FOREACH(Gtk::Widget *item, items) {
+        item->set_sensitive(enable);
+      }
+    }
+
 
     HIGMessageDialog::HIGMessageDialog(Gtk::Window *parent,
                                        GtkDialogFlags flags, Gtk::MessageType msg_type, 
diff --git a/src/utils.hpp b/src/utils.hpp
index 820ac2f..4fd9d91 100644
--- a/src/utils.hpp
+++ b/src/utils.hpp
@@ -79,7 +79,11 @@ namespace gnote {
 
       void add_accelerator(const sigc::slot<void> & , guint, Gdk::ModifierType, 
                            Gtk::AccelFlags);
-      
+      void enabled(bool enable);
+      bool enabled() const
+        {
+          return m_fake_menu.get_sensitive();
+        }
     private:
       Glib::RefPtr<Gtk::AccelGroup> m_accel_group;
       Gtk::Menu m_fake_menu;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]