[gnote] Do not show empty actions menu
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Do not show empty actions menu
- Date: Sun, 12 Nov 2017 18:42:54 +0000 (UTC)
commit 0288eba3d4fb705f1de3fabfa871ffcfc81b0c69
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Nov 12 20:41:59 2017 +0200
Do not show empty actions menu
Fixes Bug 789750
src/recentchanges.cpp | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index a833ef6..647f044 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -771,19 +771,24 @@ namespace gnote {
Gtk::PopoverMenu *menu = manage(new Gtk::PopoverMenu);
Gtk::Box *menu_box = manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL));
utils::set_common_popover_widget_props(*menu_box);
- FOREACH(Gtk::Widget *item, items) {
- if(item) {
- utils::PopoverSubmenu *submenu = dynamic_cast<utils::PopoverSubmenu*>(item);
- if(submenu) {
- submenus[submenu->name()] = item;
+ if(items.size() > 0) {
+ FOREACH(Gtk::Widget *item, items) {
+ if(item) {
+ utils::PopoverSubmenu *submenu = dynamic_cast<utils::PopoverSubmenu*>(item);
+ if(submenu) {
+ submenus[submenu->name()] = item;
+ }
+ else {
+ menu_box->add(*manage(item));
+ }
}
else {
- menu_box->add(*manage(item));
+ menu_box->add(*manage(new Gtk::Separator));
}
}
- else {
- menu_box->add(*manage(new Gtk::Separator));
- }
+ }
+ else {
+ menu_box->add(*manage(new Gtk::Label(_("No configured actions"))));
}
menu->add(*menu_box);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]