[glom] gmenu: Add attach_to_widget() calls for context menus.



commit 538eb829492195431466bf202794f255d28f397b
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Sep 24 20:36:10 2013 +0200

    gmenu: Add attach_to_widget() calls for context menus.
    
    This makes them actually work.

 glom/mode_data/box_data_calendar_related.cc        |    1 +
 glom/mode_data/db_adddel/db_adddel.cc              |    2 +-
 .../print_layouts/window_print_layout_edit.cc      |    1 +
 .../dialog_relationships_overview.cc               |    7 +------
 glom/print_layout/canvas_print_layout.cc           |    1 +
 glom/utility_widgets/adddel/adddel.cc              |    1 +
 .../utility_widgets/canvas/test_canvas_editable.cc |    1 +
 glom/utility_widgets/imageglom.cc                  |    6 +-----
 glom/utility_widgets/layoutwidgetmenu.cc           |    1 +
 glom/utility_widgets/layoutwidgetutils.cc          |    1 +
 glom/utility_widgets/notebooklabelglom.cc          |    1 +
 11 files changed, 11 insertions(+), 12 deletions(-)
---
diff --git a/glom/mode_data/box_data_calendar_related.cc b/glom/mode_data/box_data_calendar_related.cc
index 75918bb..8acf47a 100644
--- a/glom/mode_data/box_data_calendar_related.cc
+++ b/glom/mode_data/box_data_calendar_related.cc
@@ -528,6 +528,7 @@ void Box_Data_Calendar_Related::setup_menu(Gtk::Widget* /* this */)
   menu->append(_("_Layout"), "context.layout");
 
   m_pMenuPopup = new Gtk::Menu(menu);
+  m_pMenuPopup->attach_to_widget(*this);
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   if(pApp)
diff --git a/glom/mode_data/db_adddel/db_adddel.cc b/glom/mode_data/db_adddel/db_adddel.cc
index 23d5c06..3950b7f 100644
--- a/glom/mode_data/db_adddel/db_adddel.cc
+++ b/glom/mode_data/db_adddel/db_adddel.cc
@@ -265,7 +265,7 @@ void DbAddDel::setup_menu(Gtk::Widget* /* widget */)
 #endif
 
   m_pMenuPopup = new Gtk::Menu(menu);
-
+  m_pMenuPopup->attach_to_widget(*this);
 
   if(get_allow_user_actions())
   {
diff --git a/glom/mode_design/print_layouts/window_print_layout_edit.cc 
b/glom/mode_design/print_layouts/window_print_layout_edit.cc
index 8d595e9..47133b3 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.cc
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.cc
@@ -877,6 +877,7 @@ void Window_PrintLayout_Edit::setup_context_menu()
     g_warning("GMenu not found");
 
   m_context_menu = new Gtk::Menu(gmenu);
+  m_context_menu->attach_to_widget(*this);
 }
 
 bool Window_PrintLayout_Edit::on_canvas_motion_notify_event(GdkEventMotion* event)
diff --git a/glom/mode_design/relationships_overview/dialog_relationships_overview.cc 
b/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
index cf7b3f3..0d0b6b0 100644
--- a/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
+++ b/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
@@ -451,14 +451,8 @@ void Dialog_RelationshipsOverview::on_table_show_context(guint button, guint32 a
       sigc::bind( sigc::mem_fun(*this, &Dialog_RelationshipsOverview::on_context_menu_edit_relationships), 
table ));
   }
 
-  if(!m_context_menu->get_attach_widget())
-  {
-    m_context_menu->attach_to_widget(*this);
-  }
-
   if(m_context_menu)
     m_context_menu->popup(button, activate_time);
-
 }
 
 void Dialog_RelationshipsOverview::setup_context_menu()
@@ -479,6 +473,7 @@ void Dialog_RelationshipsOverview::setup_context_menu()
     g_warning("GMenu not found");
 
   m_context_menu = new Gtk::Menu(gmenu);
+  m_context_menu->attach_to_widget(*this);
 }
 
 void Dialog_RelationshipsOverview::on_context_menu_edit_fields(const Glib::VariantBase& /* parameter */, 
Glib::RefPtr<CanvasGroupDbTable> table)
diff --git a/glom/print_layout/canvas_print_layout.cc b/glom/print_layout/canvas_print_layout.cc
index 1fd3e44..d42b4f9 100644
--- a/glom/print_layout/canvas_print_layout.cc
+++ b/glom/print_layout/canvas_print_layout.cc
@@ -293,6 +293,7 @@ void Canvas_PrintLayout::setup_context_menu()
   menu->append(_("_Formatting"), "context.formatting");
   menu->append(_("_Delete"), "context.delete");
   m_context_menu = new Gtk::Menu(menu);
+  m_context_menu->attach_to_widget(*this);
 }
 
 
diff --git a/glom/utility_widgets/adddel/adddel.cc b/glom/utility_widgets/adddel/adddel.cc
index 134fc6d..c4269e2 100644
--- a/glom/utility_widgets/adddel/adddel.cc
+++ b/glom/utility_widgets/adddel/adddel.cc
@@ -251,6 +251,7 @@ void AddDel::setup_menu(Gtk::Widget* /* widget */)
   menu->append(_("_Delete"), "context.delete");
 
   m_pMenuPopup = new Gtk::Menu(menu);
+  m_pMenuPopup->attach_to_widget(*this);
 }
 
 bool AddDel::on_button_press_event_Popup(GdkEventButton *event)
diff --git a/glom/utility_widgets/canvas/test_canvas_editable.cc 
b/glom/utility_widgets/canvas/test_canvas_editable.cc
index 9b4b348..d1390c9 100644
--- a/glom/utility_widgets/canvas/test_canvas_editable.cc
+++ b/glom/utility_widgets/canvas/test_canvas_editable.cc
@@ -185,6 +185,7 @@ private:
     
     //Get the menu:
     m_context_menu = new Gtk::Menu(menu); 
+    m_context_menu->attach_to_widget(*this);
   }
  
   Gtk::Menu* m_context_menu;
diff --git a/glom/utility_widgets/imageglom.cc b/glom/utility_widgets/imageglom.cc
index e2eb125..d98d612 100644
--- a/glom/utility_widgets/imageglom.cc
+++ b/glom/utility_widgets/imageglom.cc
@@ -961,6 +961,7 @@ void ImageGlom::setup_menu_usermode()
   menu->append(_("_Clear"), "context.clear");
 
   m_pMenuPopup_UserMode = new Gtk::Menu(menu);
+  m_pMenuPopup_UserMode->attach_to_widget(*this);
 }
 
 void ImageGlom::do_choose_image()
@@ -981,11 +982,6 @@ void ImageGlom::popup_menu(guint button, guint32 activate_time)
     return;
   }
 
-  if(!m_pMenuPopup_UserMode->get_attach_widget())
-  {
-    m_pMenuPopup_UserMode->attach_to_widget(*this);
-  }
-
   m_pMenuPopup_UserMode->popup(button, activate_time);
 
   m_refActionSelectFile->set_enabled();
diff --git a/glom/utility_widgets/layoutwidgetmenu.cc b/glom/utility_widgets/layoutwidgetmenu.cc
index 7bf86c4..e56c764 100644
--- a/glom/utility_widgets/layoutwidgetmenu.cc
+++ b/glom/utility_widgets/layoutwidgetmenu.cc
@@ -127,6 +127,7 @@ void LayoutWidgetMenu::setup_menu(Gtk::Widget* widget)
 
 
   m_pMenuPopup = new Gtk::Menu(menu);
+  m_pMenuPopup->attach_to_widget(*widget);
 
   if(pApp)
     m_refContextLayout->set_enabled(pApp->get_userlevel() == AppState::USERLEVEL_DEVELOPER);
diff --git a/glom/utility_widgets/layoutwidgetutils.cc b/glom/utility_widgets/layoutwidgetutils.cc
index 51f4c67..f95f23e 100644
--- a/glom/utility_widgets/layoutwidgetutils.cc
+++ b/glom/utility_widgets/layoutwidgetutils.cc
@@ -59,6 +59,7 @@ void LayoutWidgetUtils::setup_util_menu(Gtk::Widget* widget)
   menu->append(_("_Delete"), "context.delete");
 
   m_pPopupMenuUtils = new Gtk::Menu(menu);
+  m_pPopupMenuUtils->attach_to_widget(*widget);
 #endif
 }
 
diff --git a/glom/utility_widgets/notebooklabelglom.cc b/glom/utility_widgets/notebooklabelglom.cc
index a4eecec..649507d 100644
--- a/glom/utility_widgets/notebooklabelglom.cc
+++ b/glom/utility_widgets/notebooklabelglom.cc
@@ -125,6 +125,7 @@ void NotebookLabel::setup_menu(Gtk::Widget* /* widget */)
   menu->append(_("_Delete"), "context.delete");
 
   m_pPopupMenu = new Gtk::Menu(menu);
+  m_pPopupMenu->attach_to_widget(*this);
 }
 
 bool NotebookLabel::on_button_press_event(GdkEventButton *event)


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