[glom] Print Layout: Do not show the formatting context menu items when it is useless.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Print Layout: Do not show the formatting context menu items when it is useless.
- Date: Thu, 8 Sep 2011 13:51:40 +0000 (UTC)
commit 44681fc6c0462fc394a4a3fc0a75f4519336a312
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Sep 8 15:51:14 2011 +0200
Print Layout: Do not show the formatting context menu items when it is useless.
* glom/print_layout/canvas_print_layout.cc: on_item_show_context_menu():
Disable the formatting context menu item when appropriate.
ChangeLog | 7 +++++++
glom/print_layout/canvas_print_layout.cc | 12 +++++++++++-
2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1e2eb2e..793f566 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2011-09-08 Murray Cumming <murrayc murrayc com>
+ Print Layout: Do not show the formatting context menu items when it is useless.
+
+ * glom/print_layout/canvas_print_layout.cc: on_item_show_context_menu():
+ Disable the formatting context menu item when appropriate.
+
+2011-09-08 Murray Cumming <murrayc murrayc com>
+
Use pygobject-3.0
* configure.ac: Instead of pygobject-2.0. Because everything else (such as
diff --git a/glom/print_layout/canvas_print_layout.cc b/glom/print_layout/canvas_print_layout.cc
index 7c69021..ded230b 100644
--- a/glom/print_layout/canvas_print_layout.cc
+++ b/glom/print_layout/canvas_print_layout.cc
@@ -308,10 +308,20 @@ void Canvas_PrintLayout::setup_context_menu()
void Canvas_PrintLayout::on_item_show_context_menu(guint button, guint32 activate_time, Glib::RefPtr<CanvasLayoutItem> item)
{
- if(!m_context_menu)
+ if(!m_context_menu || !item)
return;
m_context_item = item;
+
+ //Do not enable the Formatting menu item for all types of items:
+ sharedptr<LayoutItem> layout_item = m_context_item->get_layout_item();
+ bool enable_formatting = false;
+ if(sharedptr<LayoutItem_WithFormatting>::cast_dynamic(layout_item))
+ {
+ enable_formatting = true;
+ }
+
+ m_action_formatting->set_sensitive(enable_formatting);
m_context_menu->popup(button, activate_time);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]