[chronojump] Ensure Popdown on genericWin treeview context menu when activated
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Ensure Popdown on genericWin treeview context menu when activated
- Date: Wed, 8 Jun 2016 19:06:49 +0000 (UTC)
commit 6f155ca642012e5aef82553d00006a63bb45491c
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Jun 8 21:02:07 2016 +0200
Ensure Popdown on genericWin treeview context menu when activated
src/gui/encoder.cs | 2 ++
src/gui/genericWindow.cs | 20 +++++++++++++-------
2 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 9eddf6d..f122667 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -770,6 +770,8 @@ public partial class ChronoJumpWindow
genericWin.Button_middle.Clicked += new EventHandler(on_encoder_1RM_win_row_added);
genericWin.Button_accept.Clicked += new
EventHandler(on_spin_encoder_extra_weight_value_changed);
+
+ genericWin.Button_row_delete.Clicked -= new EventHandler(on_encoder_1RM_win_row_delete);
genericWin.Button_row_delete.Clicked += new EventHandler(on_encoder_1RM_win_row_delete);
//used when we don't need to read data,
diff --git a/src/gui/genericWindow.cs b/src/gui/genericWindow.cs
index a1ccfbe..15c39cb 100644
--- a/src/gui/genericWindow.cs
+++ b/src/gui/genericWindow.cs
@@ -506,9 +506,11 @@ public class GenericWindow
if(contextMenu == Constants.ContextMenu.EDITDELETE) {
button_row_edit = new Gtk.Button();
button_row_delete = new Gtk.Button();
+ treeview.ButtonReleaseEvent -= on_treeview_button_release_event;
treeview.ButtonReleaseEvent += on_treeview_button_release_event;
} else if(contextMenu == Constants.ContextMenu.DELETE) {
button_row_delete = new Gtk.Button();
+ treeview.ButtonReleaseEvent -= on_treeview_button_release_event;
treeview.ButtonReleaseEvent += on_treeview_button_release_event;
}
}
@@ -732,29 +734,32 @@ public class GenericWindow
ShowEditRow(false);
}
+ Menu menuCtx;
private void treeviewContextMenu() {
- Menu myMenu = new Menu ();
+ menuCtx = new Menu ();
Gtk.MenuItem myItem;
if(genericWinContextMenu == Constants.ContextMenu.EDITDELETE) {
myItem = new MenuItem ( Catalog.GetString("Edit selected") );
myItem.Activated += on_edit_selected_clicked;
- myMenu.Attach( myItem, 0, 1, 0, 1 );
+ menuCtx.Attach( myItem, 0, 1, 0, 1 );
myItem = new MenuItem ( Catalog.GetString("Delete selected") );
myItem.Activated += on_delete_selected_clicked;
- myMenu.Attach( myItem, 0, 1, 1, 2 );
+ menuCtx.Attach( myItem, 0, 1, 1, 2 );
}
else if(genericWinContextMenu == Constants.ContextMenu.DELETE) {
myItem = new MenuItem ( Catalog.GetString("Delete selected") );
myItem.Activated += on_delete_selected_clicked;
- myMenu.Attach( myItem, 0, 1, 0, 1 );
+ menuCtx.Attach( myItem, 0, 1, 0, 1 );
} else {
- return; //don't show nothing if there are no options
+ //don't show nothing if there are no options
+ menuCtx.Popdown();
+ return;
}
- myMenu.Popup();
- myMenu.ShowAll();
+ menuCtx.Popup();
+ menuCtx.ShowAll();
}
private void on_edit_selected_clicked (object o, EventArgs args)
@@ -803,6 +808,7 @@ public class GenericWindow
public void Delete_row_accepted() {
//remove selected row from treeview
store = UtilGtk.RemoveRow(treeview, store);
+ menuCtx.Popdown();
}
public void Row_add(string [] row) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]