[gnote] Get rid of old actions that are no longer used



commit 1476b03a910f6bdecd20de429b214398553e7edc
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Jan 24 14:11:44 2016 +0200

    Get rid of old actions that are no longer used

 src/actionmanager.cpp  |   53 ------------------------------------------------
 src/actionmanager.hpp  |    9 --------
 src/gnote.cpp          |   24 +--------------------
 src/gnote.hpp          |    4 +--
 src/iactionmanager.hpp |    2 -
 5 files changed, 2 insertions(+), 90 deletions(-)
---
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 37635ae..0a323b6 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -67,9 +67,7 @@
 namespace gnote {
 
   ActionManager::ActionManager()
-    : m_main_window_actions(Gtk::ActionGroup::create("MainWindow"))
   {
-    populate_action_groups();
     make_app_actions();
     make_app_menu_items();
 
@@ -82,57 +80,6 @@ namespace gnote {
   }
 
 
-  void ActionManager::populate_action_groups()
-  {
-    Glib::RefPtr<Gtk::Action> action;
-
-    action = Gtk::Action::create(
-      "QuitGNoteAction", Gtk::Stock::QUIT,
-      _("_Quit"), _("Quit Gnote"));
-    m_main_window_actions->add(action, Gtk::AccelKey("<Control>Q"));
-
-    action = Gtk::Action::create(
-      "ShowPreferencesAction", Gtk::Stock::PREFERENCES,
-      _("_Preferences"), _("Gnote Preferences"));
-    m_main_window_actions->add(action);
-
-    action = Gtk::Action::create("ShowHelpAction", Gtk::Stock::HELP,
-      _("_Contents"), _("Gnote Help"));
-    m_main_window_actions->add(action, Gtk::AccelKey("F1"));
-
-    action = Gtk::Action::create(
-      "ShowAboutAction", Gtk::Stock::ABOUT,
-      _("_About"), _("About Gnote"));
-    m_main_window_actions->add(action);
-
-    action = Gtk::Action::create(
-      "TrayIconMenuAction",  _("TrayIcon"));
-    m_main_window_actions->add(action);
-
-    action = Gtk::Action::create(
-      "TrayNewNoteAction", Gtk::Stock::NEW,
-      _("Create _New Note"), _("Create a new note"));
-    m_main_window_actions->add(action);
-
-    action = Gtk::Action::create(
-      "ShowSearchAllNotesAction", Gtk::Stock::FIND,
-      _("_Search All Notes"),  _("Open the Search All Notes window"));
-    m_main_window_actions->add(action);
-  }
-
-  Glib::RefPtr<Gtk::Action> ActionManager::find_action_by_name(const std::string & n) const
-  {
-    Glib::ListHandle<Glib::RefPtr<Gtk::Action> > actions = m_main_window_actions->get_actions();
-    for(Glib::ListHandle<Glib::RefPtr<Gtk::Action> >::const_iterator iter2(actions.begin()); 
-        iter2 != actions.end(); ++iter2) {
-      if((*iter2)->get_name() == n) {
-        return *iter2;
-      }
-    }
-    DBG_OUT("%s not found", n.c_str());
-    return Glib::RefPtr<Gtk::Action>();      
-  }
-
   void ActionManager::make_app_actions()
   {
     add_app_action("new-note");
diff --git a/src/actionmanager.hpp b/src/actionmanager.hpp
index 5a39b61..f58c813 100644
--- a/src/actionmanager.hpp
+++ b/src/actionmanager.hpp
@@ -41,13 +41,6 @@ class ActionManager
 public:
   ActionManager();
 
-  virtual Glib::RefPtr<Gtk::Action> operator[](const std::string & n) const override
-    {
-      return find_action_by_name(n);
-    }
-  void populate_action_groups();
-  Glib::RefPtr<Gtk::Action> find_action_by_name(const std::string & n) const;
-
   virtual Glib::RefPtr<Gio::SimpleAction> get_app_action(const std::string & name) const override;
   const std::vector<Glib::RefPtr<Gio::SimpleAction> > & get_app_actions() const
     {
@@ -71,8 +64,6 @@ private:
   void make_app_menu_items();
   Glib::RefPtr<Gio::Menu> make_app_menu_section(int section) const;
 
-  Glib::RefPtr<Gtk::ActionGroup> m_main_window_actions;
-
   std::vector<Glib::RefPtr<Gio::SimpleAction> > m_app_actions;
 
   struct AppMenuItem
diff --git a/src/gnote.cpp b/src/gnote.cpp
index dce45e0..0e1307d 100644
--- a/src/gnote.cpp
+++ b/src/gnote.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010-2015 Aurimas Cernius
+ * Copyright (C) 2010-2016 Aurimas Cernius
  * Copyright (C) 2010 Debarshi Ray
  * Copyright (C) 2009 Hubert Figuiere
  *
@@ -144,17 +144,12 @@ namespace gnote {
     new ActionManager;
     sync::SyncManager::init(default_note_manager());
 
-    setup_global_actions();
     m_manager->get_addin_manager().initialize_application_addins();
   }
 
 
   void Gnote::end_main(bool bus_acquired, bool name_acquired)
   {
-    IActionManager & am(IActionManager::obj());
-    if((m_is_background = cmd_line.background())) {
-      am["QuitGNoteAction"]->set_visible(false);
-    }
     m_is_shell_search = cmd_line.shell_search();
     if(cmd_line.needs_execute()) {
       cmd_line.execute();
@@ -234,23 +229,6 @@ namespace gnote {
   }
 
 
-  void Gnote::setup_global_actions()
-  {
-    IActionManager & am(IActionManager::obj());
-    am["QuitGNoteAction"]->signal_activate()
-      .connect(sigc::mem_fun(*this, &Gnote::quit));
-    am["ShowPreferencesAction"]->signal_activate().connect(
-      boost::bind(sigc::mem_fun(*this, &Gnote::on_show_preferences_action), Glib::VariantBase()));
-    am["ShowHelpAction"]->signal_activate()
-      .connect(boost::bind(sigc::mem_fun(*this, &Gnote::on_show_help_action), Glib::VariantBase()));
-    am["ShowAboutAction"]->signal_activate()
-      .connect(boost::bind(sigc::mem_fun(*this, &Gnote::on_show_about_action), Glib::VariantBase()));
-    am["TrayNewNoteAction"]->signal_activate()
-      .connect(boost::bind(sigc::mem_fun(*this, &Gnote::on_new_note_app_action), Glib::VariantBase()));
-    am["ShowSearchAllNotesAction"]->signal_activate()
-      .connect(sigc::mem_fun(*this, &Gnote::open_search_all));
-  }
-
   void Gnote::on_quit_gnote_action(const Glib::VariantBase&)
   {
     std::vector<Gtk::Window*> windows = Gtk::Window::list_toplevels();
diff --git a/src/gnote.hpp b/src/gnote.hpp
index 4dcb146..fd3a8b5 100644
--- a/src/gnote.hpp
+++ b/src/gnote.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010-2015 Aurimas Cernius
+ * Copyright (C) 2010-2016 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -118,8 +118,6 @@ public:
       return *m_manager;
     }
 
-  void setup_global_actions();
-
   void on_quit_gnote_action(const Glib::VariantBase&);
   void on_preferences_response(int res);
   void on_show_preferences_action(const Glib::VariantBase&);
diff --git a/src/iactionmanager.hpp b/src/iactionmanager.hpp
index 6504d6b..0bbb141 100644
--- a/src/iactionmanager.hpp
+++ b/src/iactionmanager.hpp
@@ -52,8 +52,6 @@ public:
 
   virtual ~IActionManager();
 
-  virtual Glib::RefPtr<Gtk::Action> operator[](const std::string & n) const = 0;
-
   virtual Glib::RefPtr<Gio::SimpleAction> get_app_action(const std::string & name) const = 0;
   virtual Glib::RefPtr<Gio::SimpleAction> add_app_action(const std::string & name) = 0;
   virtual void add_app_menu_item(int section, int order, const std::string & label,


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