@@ -491,69 +491,6 @@ pluma_documents_panel_class_init (PlumaDocumentsPanelClass *klass)
491491 g_type_class_add_private (object_class , sizeof (PlumaDocumentsPanelPrivate ));
492492}
493493
494- static GtkTreePath *
495- get_current_path (PlumaDocumentsPanel * panel )
496- {
497- gint num ;
498- GtkWidget * nb ;
499- GtkTreePath * path ;
500-
501- nb = _pluma_window_get_notebook (panel -> priv -> window );
502- num = gtk_notebook_get_current_page (GTK_NOTEBOOK (nb ));
503-
504- path = gtk_tree_path_new_from_indices (num , -1 );
505-
506- return path ;
507- }
508-
509- static void
510- menu_position (GtkMenu * menu ,
511- gint * x ,
512- gint * y ,
513- gboolean * push_in ,
514- PlumaDocumentsPanel * panel )
515- {
516- GtkTreePath * path ;
517- GdkRectangle rect ;
518- gint wy ;
519- GtkAllocation allocation ;
520- GtkRequisition requisition ;
521- GtkWidget * w ;
522-
523- w = panel -> priv -> treeview ;
524-
525- gtk_widget_get_allocation (w , & allocation );
526-
527- path = get_current_path (panel );
528-
529- gtk_tree_view_get_cell_area (GTK_TREE_VIEW (w ),
530- path ,
531- NULL ,
532- & rect );
533-
534- wy = rect .y ;
535-
536- gdk_window_get_origin (gtk_widget_get_window (w ), x , y );
537-
538- gtk_widget_get_preferred_size (GTK_WIDGET (menu ), NULL , & requisition );
539-
540- if (gtk_widget_get_direction (w ) == GTK_TEXT_DIR_RTL )
541- {
542- * x += allocation .x + allocation .width - requisition .width - 10 ;
543- }
544- else
545- {
546- * x += allocation .x + 10 ;
547- }
548-
549- wy = MAX (* y + 5 , * y + wy + 5 );
550- wy = MIN (wy , * y + allocation .height - requisition .height - 5 );
551-
552- * y = wy ;
553-
554- * push_in = TRUE;
555- }
556-
557494static gboolean
558495show_popup_menu (PlumaDocumentsPanel * panel ,
559496 GdkEventButton * event )
@@ -566,24 +503,11 @@ show_popup_menu (PlumaDocumentsPanel *panel,
566503
567504 if (event != NULL )
568505 {
569- gtk_menu_popup (GTK_MENU (menu ),
570- NULL ,
571- NULL ,
572- NULL ,
573- NULL ,
574- event -> button ,
575- event -> time );
506+ gtk_menu_popup_at_pointer (GTK_MENU (menu ), NULL );
576507 }
577508 else
578509 {
579- gtk_menu_popup (GTK_MENU (menu ),
580- NULL ,
581- NULL ,
582- (GtkMenuPositionFunc ) menu_position ,
583- panel ,
584- 0 ,
585- gtk_get_current_event_time ());
586-
510+ menu_popup_at_treeview_selection (menu , panel -> priv -> treeview );
587511 gtk_menu_shell_select_first (GTK_MENU_SHELL (menu ), FALSE);
588512 }
589513
0 commit comments