[gnote] Move action orders to popoverwidgets
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Move action orders to popoverwidgets
- Date: Sun, 31 Mar 2019 16:08:27 +0000 (UTC)
commit 1258ee0817981c8d86b731cbfcbfb9d4ef0657ee
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Mar 31 18:56:53 2019 +0300
Move action orders to popoverwidgets
src/actionmanager.cpp | 12 ++++++------
src/iactionmanager.cpp | 5 -----
src/iactionmanager.hpp | 21 ---------------------
src/notebooks/notebookapplicationaddin.cpp | 4 ++--
src/popoverwidgets.cpp | 9 +++++++--
src/popoverwidgets.hpp | 21 +++++++++++++++++++++
src/synchronization/syncmanager.cpp | 4 ++--
7 files changed, 38 insertions(+), 38 deletions(-)
---
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index c87f297a..509879ee 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -131,12 +131,12 @@ namespace gnote {
void ActionManager::make_app_menu_items()
{
- add_app_menu_item(APP_ACTION_NEW, 100, _("_New Note"), "app.new-note");
- add_app_menu_item(APP_ACTION_NEW, 200, _("New _Window"), "app.new-window");
- add_app_menu_item(APP_ACTION_LAST, 50, _("_Preferences"), "app.show-preferences");
- add_app_menu_item(APP_ACTION_LAST, 100, _("_Shortcuts"), "app.help-shortcuts");
- add_app_menu_item(APP_ACTION_LAST, 150, _("_Help"), "app.help-contents");
- add_app_menu_item(APP_ACTION_LAST, 200, _("_About Gnote"), "app.about");
+ add_app_menu_item(APP_SECTION_NEW, 100, _("_New Note"), "app.new-note");
+ add_app_menu_item(APP_SECTION_NEW, 200, _("New _Window"), "app.new-window");
+ add_app_menu_item(APP_SECTION_LAST, 50, _("_Preferences"), "app.show-preferences");
+ add_app_menu_item(APP_SECTION_LAST, 100, _("_Shortcuts"), "app.help-shortcuts");
+ add_app_menu_item(APP_SECTION_LAST, 150, _("_Help"), "app.help-contents");
+ add_app_menu_item(APP_SECTION_LAST, 200, _("_About Gnote"), "app.about");
}
void ActionManager::register_main_window_action(const Glib::ustring & action, const Glib::VariantType
*state_type, bool modifying)
diff --git a/src/iactionmanager.cpp b/src/iactionmanager.cpp
index 89a6c97a..d280decc 100644
--- a/src/iactionmanager.cpp
+++ b/src/iactionmanager.cpp
@@ -22,11 +22,6 @@
namespace gnote {
-const int IActionManager::APP_ACTION_NEW = 1;
-const int IActionManager::APP_ACTION_MANAGE = 2;
-const int IActionManager::APP_ACTION_LAST = 3;
-const int IActionManager::APP_CUSTOM_SECTION = 1000;
-
IActionManager::~IActionManager()
{}
diff --git a/src/iactionmanager.hpp b/src/iactionmanager.hpp
index eb159375..349c1ba1 100644
--- a/src/iactionmanager.hpp
+++ b/src/iactionmanager.hpp
@@ -30,31 +30,10 @@
namespace gnote {
-enum NoteActionOrder {
- // custom sections
- NOTEBOOK_ORDER = 100,
- BACKLINKS_ORDER = 200,
- TABLE_OF_CONTENTS_ORDER = 100,
- // flags
- READ_ONLY_ORDER = 100,
- SPELL_CHECK_ORDER = 200,
- // actions
- EXPORT_TO_HTML_ORDER = 100,
- EXPORT_TO_GTG_ORDER = 200,
- INSERT_TIMESTAMP_ORDER = 300,
- PRINT_ORDER = 400,
- REPLACE_TITLE_ORDER = 500,
-};
-
class IActionManager
: public base::Singleton<IActionManager>
{
public:
- static const int APP_ACTION_NEW;
- static const int APP_ACTION_MANAGE;
- static const int APP_ACTION_LAST;
- static const int APP_CUSTOM_SECTION;
-
virtual ~IActionManager();
virtual Glib::RefPtr<Gio::SimpleAction> get_app_action(const Glib::ustring & name) const = 0;
diff --git a/src/notebooks/notebookapplicationaddin.cpp b/src/notebooks/notebookapplicationaddin.cpp
index 5f973325..1ab076ae 100644
--- a/src/notebooks/notebookapplicationaddin.cpp
+++ b/src/notebooks/notebookapplicationaddin.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2011-2015,2017 Aurimas Cernius
+ * Copyright (C) 2011-2015,2017,2019 Aurimas Cernius
* Copyright (C) 2010 Debarshi Ray
* Copyright (C) 2009 Hubert Figuiere
*
@@ -76,7 +76,7 @@ namespace gnote {
am.add_app_action("new-notebook");
am.get_app_action("new-notebook")->signal_activate().connect(
sigc::mem_fun(*this, &NotebookApplicationAddin::on_new_notebook_action));
- am.add_app_menu_item(IActionManager::APP_ACTION_NEW, 300, _("New Note_book..."), "app.new-notebook");
+ am.add_app_menu_item(APP_SECTION_NEW, 300, _("New Note_book..."), "app.new-notebook");
m_initialized = true;
}
diff --git a/src/popoverwidgets.cpp b/src/popoverwidgets.cpp
index 620951f4..9d3cda9f 100644
--- a/src/popoverwidgets.cpp
+++ b/src/popoverwidgets.cpp
@@ -22,6 +22,11 @@
namespace gnote {
+const int APP_SECTION_NEW = 1;
+const int APP_SECTION_MANAGE = 2;
+const int APP_SECTION_LAST = 3;
+const int APP_CUSTOM_SECTION = 1000;
+
const int NOTE_SECTION_NEW = 1;
const int NOTE_SECTION_UNDO = 2;
const int NOTE_SECTION_CUSTOM_SECTIONS = 10;
@@ -30,7 +35,7 @@ const int NOTE_SECTION_ACTIONS = 30;
PopoverWidget PopoverWidget::create_for_app(int ord, Gtk::Widget *w)
{
- return PopoverWidget(IActionManager::APP_ACTION_MANAGE, ord, w);
+ return PopoverWidget(APP_SECTION_MANAGE, ord, w);
}
PopoverWidget PopoverWidget::create_for_note(int ord, Gtk::Widget *w)
@@ -40,7 +45,7 @@ PopoverWidget PopoverWidget::create_for_note(int ord, Gtk::Widget *w)
PopoverWidget PopoverWidget::create_custom_section(Gtk::Widget *w)
{
- return PopoverWidget(IActionManager::APP_CUSTOM_SECTION, 0, w);
+ return PopoverWidget(APP_CUSTOM_SECTION, 0, w);
}
}
diff --git a/src/popoverwidgets.hpp b/src/popoverwidgets.hpp
index 6a8346d8..3622dda8 100644
--- a/src/popoverwidgets.hpp
+++ b/src/popoverwidgets.hpp
@@ -22,12 +22,33 @@
namespace gnote {
+extern const int APP_SECTION_NEW;
+extern const int APP_SECTION_MANAGE;
+extern const int APP_SECTION_LAST;
+extern const int APP_CUSTOM_SECTION;
+
extern const int NOTE_SECTION_NEW;
extern const int NOTE_SECTION_UNDO;
extern const int NOTE_SECTION_CUSTOM_SECTIONS;
extern const int NOTE_SECTION_FLAGS;
extern const int NOTE_SECTION_ACTIONS;
+enum NoteActionOrder {
+ // custom sections
+ NOTEBOOK_ORDER = 100,
+ BACKLINKS_ORDER = 200,
+ TABLE_OF_CONTENTS_ORDER = 100,
+ // flags
+ READ_ONLY_ORDER = 100,
+ SPELL_CHECK_ORDER = 200,
+ // actions
+ EXPORT_TO_HTML_ORDER = 100,
+ EXPORT_TO_GTG_ORDER = 200,
+ INSERT_TIMESTAMP_ORDER = 300,
+ PRINT_ORDER = 400,
+ REPLACE_TITLE_ORDER = 500,
+};
+
struct PopoverWidget
{
Gtk::Widget *widget;
diff --git a/src/synchronization/syncmanager.cpp b/src/synchronization/syncmanager.cpp
index 31f8f2bb..e092dc04 100644
--- a/src/synchronization/syncmanager.cpp
+++ b/src/synchronization/syncmanager.cpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2012-2014,2017 Aurimas Cernius
+ * Copyright (C) 2012-2014,2017,2019 Aurimas Cernius
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -62,7 +62,7 @@ namespace sync {
// Add a "Synchronize Notes" to Gnote's Application Menu
IActionManager & am(IActionManager::obj());
am.add_app_action("sync-notes");
- am.add_app_menu_item(IActionManager::APP_ACTION_MANAGE, 200, _("Synchronize Notes"), "app.sync-notes");
+ am.add_app_menu_item(APP_SECTION_MANAGE, 200, _("Synchronize Notes"), "app.sync-notes");
// Initialize all the SyncServiceAddins
initialize_sync_service_addins(manager);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]