filechoosercell: Select item when right click or long press
authorCorey Berla <corey@berla.me>
Fri, 21 Oct 2022 20:53:49 +0000 (13:53 -0700)
committerCorey Berla <corey@berla.me>
Fri, 21 Oct 2022 20:57:15 +0000 (13:57 -0700)
gtk/gtkfilechoosercell.c

index 267b9511e328ba662bd4c44c0c45669203d82623..c14ae0a0213b3c4fa56200977bba83e02d98ea2a 100644 (file)
@@ -67,11 +67,15 @@ popup_menu (GtkFileChooserCell *self,
             double              y)
 {
   GtkWidget *widget = GTK_WIDGET (self);
+  GtkSelectionModel *model;
   GtkWidget *impl;
   double xx, yy;
 
   impl = gtk_widget_get_ancestor (widget, GTK_TYPE_FILE_CHOOSER_WIDGET);
 
+  model = gtk_file_chooser_widget_get_selection_model (GTK_FILE_CHOOSER_WIDGET (impl));
+  gtk_selection_model_select_item (model, self->position, TRUE);
+
   gtk_widget_translate_coordinates (widget, GTK_WIDGET (impl),
                                     x, y, &xx, &yy);