[maemo-commits] [maemo-commits] r14131 - in projects/haf/trunk/hildon-desktop: . libhildondesktop
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Thu Sep 27 09:35:18 EEST 2007
- Previous message: [maemo-commits] r14130 - in projects/haf/trunk/hildon-desktop: . src
- Next message: [maemo-commits] r14132 - in projects/haf/trunk/hildon-desktop: . libhildondesktop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: jobi Date: 2007-09-27 09:35:16 +0300 (Thu, 27 Sep 2007) New Revision: 14131 Modified: projects/haf/trunk/hildon-desktop/ChangeLog projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.c Log: 2007-09-27 Johan Bilien <johan.bilien at nokia.com> * libhildondesktop/hildon-desktop-popup-menu.c: systematically unselect the item when removed from the box. This fixes invalid reads Modified: projects/haf/trunk/hildon-desktop/ChangeLog =================================================================== --- projects/haf/trunk/hildon-desktop/ChangeLog 2007-09-26 16:34:14 UTC (rev 14130) +++ projects/haf/trunk/hildon-desktop/ChangeLog 2007-09-27 06:35:16 UTC (rev 14131) @@ -1,3 +1,9 @@ +2007-09-27 Johan Bilien <johan.bilien at nokia.com> + + * libhildondesktop/hildon-desktop-popup-menu.c: systematically + unselect the item when removed from the box. This fixes invalid + reads + 2007-09-26 Johan Bilien <johan.bilien at nokia.com> * src/hd-switcher-menu.c: fixed numerous leaks of GList. Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.c =================================================================== --- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.c 2007-09-26 16:34:14 UTC (rev 14130) +++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-popup-menu.c 2007-09-27 06:35:16 UTC (rev 14131) @@ -113,6 +113,7 @@ static void hildon_desktop_popup_menu_scroll_start (GtkWidget *widget, HildonDesktopPopupMenu *menu); static void hildon_desktop_popup_menu_scroll_stop (GtkWidget *widget, HildonDesktopPopupMenu *menu); static void hildon_desktop_popup_menu_adjustment_changed (GtkAdjustment *adj, HildonDesktopPopupMenu *menu); +static void hildon_desktop_popup_menu_box_remove (HildonDesktopPopupMenu *menu, GtkWidget *widget); static void hildon_desktop_popup_menu_init (HildonDesktopPopupMenu *menu) @@ -299,6 +300,10 @@ gtk_widget_push_composite_child (); menu->priv->box_items = gtk_vbox_new (FALSE, 0); /* FIXME: add spacing decoration */ + + g_signal_connect_swapped (menu->priv->box_items, "remove", + G_CALLBACK (hildon_desktop_popup_menu_box_remove), + menu); gtk_widget_set_size_request (menu->priv->box_items, 1, -1); @@ -991,14 +996,26 @@ static void hildon_desktop_popup_menu_real_remove_item (HildonDesktopPopupMenu *menu, GtkMenuItem *item) { - if (menu->priv->selected_item == item) - hildon_desktop_popup_menu_deselect_item (menu, item); + gtk_container_remove (GTK_CONTAINER (menu->priv->box_items), GTK_WIDGET (item)); - gtk_container_remove (GTK_CONTAINER (menu->priv->box_items), GTK_WIDGET (item)); - - menu->priv->n_items--; } +static void +hildon_desktop_popup_menu_box_remove (HildonDesktopPopupMenu *menu, + GtkWidget *widget) +{ + if (GTK_IS_MENU_ITEM (widget)) + { + GtkMenuItem *item = (GtkMenuItem *)widget; + + if (menu->priv->selected_item == item) + hildon_desktop_popup_menu_deselect_item (menu, item); + + menu->priv->n_items--; + } + +} + void hildon_desktop_popup_menu_add_item (HildonDesktopPopupMenu *menu, GtkMenuItem *item) {
- Previous message: [maemo-commits] r14130 - in projects/haf/trunk/hildon-desktop: . src
- Next message: [maemo-commits] r14132 - in projects/haf/trunk/hildon-desktop: . libhildondesktop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]