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=/trunk/; revision=17485
This commit is contained in:
Matthias Clasen
2007-03-12 03:13:51 +00:00
committed by Matthias Clasen
parent aa16f8e09b
commit d58a93a023
2 changed files with 22 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2007-03-11 Matthias Clasen <mclasen@redhat.com>
* tests/testiconview.c: Handle Menu key presses without
crash. (#385637, Christian Persch)
2007-03-11 Matthias Clasen <mclasen@redhat.com> 2007-03-11 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktooltips.c (gtk_tooltips_get_info_from_tip_window): * gtk/gtktooltips.c (gtk_tooltips_get_info_from_tip_window):

View File

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