[gnote] Add support for note actions in NoteAddin
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Add support for note actions in NoteAddin
- Date: Fri, 31 May 2013 19:54:07 +0000 (UTC)
commit ebe4200bc8ab6826a42b50ef133d745198c2b084
Author: Aurimas Černius <aurisc4 gmail com>
Date: Fri May 31 22:31:50 2013 +0300
Add support for note actions in NoteAddin
src/noteaddin.cpp | 13 +++++++++++++
src/noteaddin.hpp | 6 ++++--
2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/noteaddin.cpp b/src/noteaddin.cpp
index 82ef294..a731b9b 100644
--- a/src/noteaddin.cpp
+++ b/src/noteaddin.cpp
@@ -44,6 +44,10 @@ namespace gnote {
void NoteAddin::dispose(bool disposing)
{
if (disposing) {
+ for(std::list<std::string>::const_iterator iter = m_note_actions.begin();
+ iter != m_note_actions.end(); ++iter) {
+ get_window()->remove_widget_action(*iter);
+ }
for(std::list<Gtk::MenuItem*>::const_iterator iter = m_tools_menu_items.begin();
iter != m_tools_menu_items.end(); ++iter) {
delete *iter;
@@ -99,6 +103,15 @@ namespace gnote {
}
}
+ void NoteAddin::add_note_action(const Glib::RefPtr<Gtk::Action> & action, int order)
+ {
+ if(is_disposing()) {
+ throw sharp::Exception("Plugin is disposing already");
+ }
+
+ m_note_actions.push_back(action->get_name());
+ get_window()->add_widget_action(action, order);
+ }
void NoteAddin::add_plugin_menu_item (Gtk::MenuItem *item)
{
diff --git a/src/noteaddin.hpp b/src/noteaddin.hpp
index 1be014b..358bfde 100644
--- a/src/noteaddin.hpp
+++ b/src/noteaddin.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2012 Aurimas Cernius
+ * Copyright (C) 2012-2013 Aurimas Cernius
* Copyright (C) 2009 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
@@ -105,12 +105,14 @@ public:
return m_note->manager();
}
void on_note_opened_event(Note & );
- void add_plugin_menu_item (Gtk::MenuItem *item);
+ void add_note_action(const Glib::RefPtr<Gtk::Action> & action, int order);
+ void add_plugin_menu_item(Gtk::MenuItem *item);
void add_tool_item (Gtk::ToolItem *item, int position);
void add_text_menu_item (Gtk::MenuItem * item);
private:
Note::Ptr m_note;
sigc::connection m_note_opened_cid;
+ std::list<std::string> m_note_actions;
std::list<Gtk::MenuItem*> m_tools_menu_items;
std::list<Gtk::MenuItem*> m_text_menu_items;
typedef std::map<Gtk::ToolItem*, int> ToolItemMap;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]