[gnote] Update backlinks to Gtk::Box popover
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Update backlinks to Gtk::Box popover
- Date: Sun, 11 Dec 2016 17:34:51 +0000 (UTC)
commit 133ddc2db5bacbf8e5e29a3daa2c07eacfd8d208
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Dec 11 19:31:31 2016 +0200
Update backlinks to Gtk::Box popover
src/addins/backlinks/backlinks.desktop.in.in | 2 +-
src/addins/backlinks/backlinksnoteaddin.cpp | 22 ++++++++--------------
src/addins/backlinks/backlinksnoteaddin.hpp | 2 +-
3 files changed, 10 insertions(+), 16 deletions(-)
---
diff --git a/src/addins/backlinks/backlinks.desktop.in.in b/src/addins/backlinks/backlinks.desktop.in.in
index d0cc8b6..6c565f8 100644
--- a/src/addins/backlinks/backlinks.desktop.in.in
+++ b/src/addins/backlinks/backlinks.desktop.in.in
@@ -4,7 +4,7 @@ _Name=Backlinks
_Description=See which notes link to the one you're currently viewing.
_Authors=Hubert Figuiere and Tomboy Project
Category=Tools
-Version=0.4
+Version=0.5
DefaultEnabled=true
Module=libbacklinks
LibgnoteRelease=@LIBGNOTE_RELEASE@
diff --git a/src/addins/backlinks/backlinksnoteaddin.cpp b/src/addins/backlinks/backlinksnoteaddin.cpp
index 1a20a42..eed67cf 100644
--- a/src/addins/backlinks/backlinksnoteaddin.cpp
+++ b/src/addins/backlinks/backlinksnoteaddin.cpp
@@ -20,6 +20,7 @@
#include <glibmm/i18n.h>
#include <gtkmm/modelbutton.h>
+#include <gtkmm/separator.h>
#include "sharp/string.hpp"
#include "backlinksnoteaddin.hpp"
@@ -83,33 +84,26 @@ std::map<int, Gtk::Widget*> BacklinksNoteAddin::get_actions_popover_widgets() co
return widgets;
}
-void BacklinksNoteAddin::update_menu(Gtk::Grid *menu) const
+void BacklinksNoteAddin::update_menu(Gtk::Box *menu) const
{
std::list<Gtk::Widget*> items;
get_backlink_menu_items(items);
- int top = 0;
- auto sub = manage(new Gtk::Grid);
- gnote::utils::set_common_popover_widget_props(*sub);
- int subtop = 0;
+ bool have_items = false;
for(auto item : items) {
dynamic_cast<Gtk::ModelButton*>(item)->property_inverted() = true;
- sub->attach(*item, 0, subtop++, 1, 1);
+ menu->add(*item);
}
// If nothing was found, add in a "dummy" item
- if(subtop == 0) {
+ if(!have_items) {
Gtk::Widget *blank_item = manage(gnote::utils::create_popover_button("win.backlinks-nonexistent",
_("(none)")));
- sub->attach(*blank_item, 0, subtop++, 1, 1);
+ menu->add(*blank_item);
}
- menu->attach(*sub, 0, top++, 1, 1);
+ menu->add(*manage(new Gtk::Separator));
- sub = manage(new Gtk::Grid);
- gnote::utils::set_common_popover_widget_props(*sub);
- subtop = 0;
auto back = gnote::utils::create_popover_submenu_button("main", _("_Back"));
dynamic_cast<Gtk::ModelButton*>(back)->property_inverted() = true;
- sub->attach(*back, 0, subtop++, 1, 1);
- menu->attach(*sub, 0, top++, 1, 1);
+ menu->add(*back);
}
diff --git a/src/addins/backlinks/backlinksnoteaddin.hpp b/src/addins/backlinks/backlinksnoteaddin.hpp
index 6075fba..6a92a12 100644
--- a/src/addins/backlinks/backlinksnoteaddin.hpp
+++ b/src/addins/backlinks/backlinksnoteaddin.hpp
@@ -55,7 +55,7 @@ public:
virtual std::map<int, Gtk::Widget*> get_actions_popover_widgets() const override;
private:
void on_open_note(const Glib::VariantBase & param);
- void update_menu(Gtk::Grid *menu) const;
+ void update_menu(Gtk::Box *menu) const;
void get_backlink_menu_items(std::list<Gtk::Widget*> & items) const;
bool check_note_has_match(const gnote::Note::Ptr &, const std::string &);
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]