[gtkmm] Adapt to gtk_menu_popup_for_device() API change.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Adapt to gtk_menu_popup_for_device() API change.
- Date: Sat, 25 Sep 2010 22:51:39 +0000 (UTC)
commit cb03dc54af15c3725046a75e917c0f80e6bfaafb
Author: Murray Cumming <murrayc murrayc com>
Date: Sun Sep 26 00:51:30 2010 +0200
Adapt to gtk_menu_popup_for_device() API change.
* gtk/src/menu.ccg: popup(): Copy the slot and delete it in the new destroy
callback.
ChangeLog | 7 +++++++
gtk/src/menu.ccg | 20 +++++++++++++++++---
2 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index eccda70..0e94fa1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-09-26 Murray Cumming <murrayc murrayc com>
+
+ Adapt to gtk_menu_popup_for_device() API change.
+
+ * gtk/src/menu.ccg: popup(): Copy the slot and delete it in the new destroy
+ callback.
+
2010-09-25 Murray Cumming <murrayc murrayc com>
gtkmm: Added remaining missing properties.
diff --git a/gtk/src/menu.ccg b/gtk/src/menu.ccg
index ee4daaa..4d90679 100644
--- a/gtk/src/menu.ccg
+++ b/gtk/src/menu.ccg
@@ -44,6 +44,12 @@ static void SignalProxy_PopupPosition_gtk_callback(GtkMenu*, int* x, int* y, gbo
if(push_in) *push_in = temp_push_in;
}
+static void SignalProxy_PopupPosition_gtk_callback_destroy(void* data)
+{
+ Gtk::Menu::SlotPositionCalc* the_slot = static_cast<Gtk::Menu::SlotPositionCalc*>(data);
+ delete the_slot;
+}
+
namespace Gtk
@@ -56,7 +62,11 @@ void Menu::popup(const SlotPositionCalc& position_calc_slot, guint button, guint
if(!device)
gtk_menu_popup(gobj(), 0, 0, &SignalProxy_PopupPosition_gtk_callback, const_cast<SlotPositionCalc*>(&position_calc_slot), button, activate_time);
else
- gtk_menu_popup_for_device(gobj(), device->gobj(), 0, 0, &SignalProxy_PopupPosition_gtk_callback, const_cast<SlotPositionCalc*>(&position_calc_slot), button, activate_time);
+ {
+ SlotPositionCalc* slot_copy = new SlotPositionCalc(position_calc_slot); //Deleted in the destroy callback.
+
+ gtk_menu_popup_for_device(gobj(), device->gobj(), 0, 0, &SignalProxy_PopupPosition_gtk_callback, slot_copy, &SignalProxy_PopupPosition_gtk_callback_destroy, button, activate_time);
+ }
}
void Menu::popup(MenuShell& parent_menu_shell, MenuItem& parent_menu_item, const SlotPositionCalc& position_calc_slot, guint button, guint32 activate_time, const Glib::RefPtr<Gdk::Device>& device)
@@ -66,7 +76,11 @@ void Menu::popup(MenuShell& parent_menu_shell, MenuItem& parent_menu_item, const
if(!device)
gtk_menu_popup(gobj(), parent_menu_shell.Gtk::Widget::gobj(), parent_menu_item.Gtk::Widget::gobj(), &SignalProxy_PopupPosition_gtk_callback, const_cast<SlotPositionCalc*>(&position_calc_slot), button, activate_time);
else
- gtk_menu_popup_for_device(gobj(), device->gobj(), parent_menu_shell.Gtk::Widget::gobj(), parent_menu_item.Gtk::Widget::gobj(), &SignalProxy_PopupPosition_gtk_callback, const_cast<SlotPositionCalc*>(&position_calc_slot), button, activate_time);
+ {
+ SlotPositionCalc* slot_copy = new SlotPositionCalc(position_calc_slot); //Deleted in the destroy callback.
+
+ gtk_menu_popup_for_device(gobj(), device->gobj(), parent_menu_shell.Gtk::Widget::gobj(), parent_menu_item.Gtk::Widget::gobj(), &SignalProxy_PopupPosition_gtk_callback, slot_copy, &SignalProxy_PopupPosition_gtk_callback_destroy, button, activate_time);
+ }
}
void Menu::popup(guint button, guint32 activate_time, const Glib::RefPtr<Gdk::Device>& device)
@@ -74,7 +88,7 @@ void Menu::popup(guint button, guint32 activate_time, const Glib::RefPtr<Gdk::De
if(!device)
gtk_menu_popup(gobj(), 0, 0, 0, 0, button, activate_time);
else
- gtk_menu_popup_for_device(gobj(), device->gobj(), 0, 0, 0, 0, button, activate_time);
+ gtk_menu_popup_for_device(gobj(), device->gobj(), 0, 0, 0, 0, 0, button, activate_time);
}
void Menu::reorder_child(const MenuItem& child, int position)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]