[gnote] Introduce note popover sections



commit ac43534614ae65291098e903811098ef5f0ddaa3
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Mar 31 18:37:10 2019 +0300

    Introduce note popover sections

 src/notewindow.cpp     | 6 +++---
 src/popoverwidgets.cpp | 8 +++++++-
 src/popoverwidgets.hpp | 6 ++++++
 3 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/notewindow.cpp b/src/notewindow.cpp
index 3ab20a07..e87d69c2 100644
--- a/src/notewindow.cpp
+++ b/src/notewindow.cpp
@@ -333,13 +333,13 @@ namespace gnote {
     }
 
     std::sort(popover_widgets.begin(), popover_widgets.end());
-    int last_order = 0;
+    int last_section = 0;
     for(auto & w : popover_widgets) {
       // put separator between groups
-      if(w.order < 10000 && (w.order / 1000) > last_order && widgets.size() > 0 && widgets.back() != NULL) {
+      if(w.section != last_section && widgets.size() > 0 && widgets.back() != NULL) {
         widgets.push_back(NULL);
       }
-      last_order = w.order / 1000;
+      last_section = w.section;
       widgets.push_back(w.widget);
     }
 
diff --git a/src/popoverwidgets.cpp b/src/popoverwidgets.cpp
index cd4f7a6b..620951f4 100644
--- a/src/popoverwidgets.cpp
+++ b/src/popoverwidgets.cpp
@@ -22,6 +22,12 @@
 
 namespace gnote {
 
+const int NOTE_SECTION_NEW = 1;
+const int NOTE_SECTION_UNDO = 2;
+const int NOTE_SECTION_CUSTOM_SECTIONS = 10;
+const int NOTE_SECTION_FLAGS = 20;
+const int NOTE_SECTION_ACTIONS = 30;
+
 PopoverWidget PopoverWidget::create_for_app(int ord, Gtk::Widget *w)
 {
   return PopoverWidget(IActionManager::APP_ACTION_MANAGE, ord, w);
@@ -29,7 +35,7 @@ PopoverWidget PopoverWidget::create_for_app(int ord, Gtk::Widget *w)
 
 PopoverWidget PopoverWidget::create_for_note(int ord, Gtk::Widget *w)
 {
-  return PopoverWidget(0, ord, w);
+  return PopoverWidget(NOTE_SECTION_ACTIONS, ord, w);
 }
 
 PopoverWidget PopoverWidget::create_custom_section(Gtk::Widget *w)
diff --git a/src/popoverwidgets.hpp b/src/popoverwidgets.hpp
index 1c024522..6a8346d8 100644
--- a/src/popoverwidgets.hpp
+++ b/src/popoverwidgets.hpp
@@ -22,6 +22,12 @@
 
 namespace gnote {
 
+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;
+
 struct PopoverWidget
 {
   Gtk::Widget *widget;


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