diff options
-rw-r--r-- | gtk/gtkfilechooserwidget.c | 25 | ||||
-rw-r--r-- | gtk/ui/gtkfilechooserwidget.ui | 17 |
2 files changed, 20 insertions, 22 deletions
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 169762d008..aa4c3966d1 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -251,10 +251,6 @@ struct _GtkFileChooserWidgetPrivate { GtkWidget *rename_file_popover; GFile *rename_file_source_file; - GtkGesture *long_press_gesture; - GtkGesture *multipress_gesture; - GtkEventController *key_controller; - GtkFileSystemModel *browse_files_model; char *browse_files_last_selected_name; @@ -3552,10 +3548,6 @@ gtk_file_chooser_widget_dispose (GObject *object) priv->box = NULL; } - g_clear_object (&priv->long_press_gesture); - g_clear_object (&priv->multipress_gesture); - g_clear_object (&priv->key_controller); - G_OBJECT_CLASS (gtk_file_chooser_widget_parent_class)->dispose (object); } @@ -8410,6 +8402,9 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class) gtk_widget_class_bind_template_callback (widget_class, rename_file_name_changed); gtk_widget_class_bind_template_callback (widget_class, rename_file_rename_clicked); gtk_widget_class_bind_template_callback (widget_class, rename_file_end); + gtk_widget_class_bind_template_callback (widget_class, multi_press_cb); + gtk_widget_class_bind_template_callback (widget_class, long_press_cb); + gtk_widget_class_bind_template_callback (widget_class, key_press_cb); gtk_widget_class_set_css_name (widget_class, I_("filechooser")); } @@ -8546,20 +8541,6 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *impl) priv->bookmarks_manager = _gtk_bookmarks_manager_new (NULL, NULL); - priv->long_press_gesture = gtk_gesture_long_press_new (priv->browse_files_tree_view); - gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->long_press_gesture), TRUE); - g_signal_connect (priv->long_press_gesture, "pressed", - G_CALLBACK (long_press_cb), impl); - - priv->multipress_gesture = gtk_gesture_multi_press_new (priv->browse_files_tree_view); - gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->multipress_gesture), GDK_BUTTON_SECONDARY); - g_signal_connect (priv->multipress_gesture, "pressed", - G_CALLBACK (multi_press_cb), impl); - - priv->key_controller = gtk_event_controller_key_new (priv->browse_files_tree_view); - g_signal_connect (priv->key_controller, "key-pressed", - G_CALLBACK (key_press_cb), impl); - /* Setup various attributes and callbacks in the UI * which cannot be done with GtkBuilder */ diff --git a/gtk/ui/gtkfilechooserwidget.ui b/gtk/ui/gtkfilechooserwidget.ui index a034d8b67e..a82acda0d9 100644 --- a/gtk/ui/gtkfilechooserwidget.ui +++ b/gtk/ui/gtkfilechooserwidget.ui @@ -143,6 +143,23 @@ <property name="AtkObject::accessible-name" translatable="yes">Files</property> </object> </child> + <child> + <object class="GtkGestureLongPress"> + <property name="touch-only">True</property> + <signal name="pressed" handler="long_press_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkGestureMultiPress"> + <property name="button">3</property> + <signal name="pressed" handler="multi_press_cb" swapped="no"/> + </object> + </child> + <child> + <object class="GtkEventControllerKey"> + <signal name="key-pressed" handler="key_press_cb" swapped="no"/> + </object> + </child> <signal name="drag-data-received" handler="file_list_drag_data_received_cb" swapped="no"/> <signal name="drag-drop" handler="file_list_drag_drop_cb" swapped="no"/> <signal name="drag-begin" handler="file_list_drag_begin_cb" swapped="no"/> |