Handle Menu key presses without crash. (#385637, Christian Persch)

2007-03-11  Matthias Clasen  <mclasen@redhat.com>

        * tests/testiconview.c: Handle Menu key presses without
        crash.  (#385637, Christian Persch)



svn path=/branches/gtk-2-10/; revision=17486
This commit is contained in:
Matthias Clasen
2007-03-12 03:15:23 +00:00
committed by Matthias Clasen
parent 5847ef42e3
commit 27e04bea15
2 changed files with 26 additions and 6 deletions

View File

@@ -2,8 +2,15 @@
Merge from trunk:
* gtk/gtktooltips.c (gtk_tooltips_get_info_from_tip_window):
Don't crash if active_tips_data is NULL. (#382904, Li Yuan)
* tests/testiconview.c: Handle Menu key presses without
crash. (#385637, Christian Persch)
2007-03-11 Matthias Clasen <mclasen@redhat.com>
Merge from trunk:
* gtk/gtktooltips.c (gtk_tooltips_get_info_from_tip_window):
Don't crash if active_tips_data is NULL. (#382904, Li Yuan)
2007-03-11 Matthias Clasen <mclasen@redhat.com>

View File

@@ -329,14 +329,27 @@ static void
do_popup_menu (GtkWidget *icon_list,
GdkEventButton *event)
{
GtkIconView *icon_view = GTK_ICON_VIEW (icon_list);
GtkWidget *menu;
GtkWidget *menuitem;
GtkTreePath *path;
GtkTreePath *path = NULL;
int button, event_time;
ItemData *data;
GList *list;
path = gtk_icon_view_get_path_at_pos (GTK_ICON_VIEW (icon_list),
event->x, event->y);
if (event)
path = gtk_icon_view_get_path_at_pos (icon_view, event->x, event->y);
else
{
list = gtk_icon_view_get_selected_items (icon_view);
if (list)
{
path = (GtkTreePath*)list->data;
g_list_foreach (list->next, gtk_tree_path_free, NULL);
g_list_free (list);
}
}
if (!path)
return;
@@ -344,7 +357,7 @@ do_popup_menu (GtkWidget *icon_list,
menu = gtk_menu_new ();
data = g_new0 (ItemData, 1);
data->icon_list = GTK_ICON_VIEW (icon_list);
data->icon_list = icon_view;
data->path = path;
g_object_set_data_full (G_OBJECT (menu), "item-path", data, (GDestroyNotify)free_item_data);