diff --git a/po/POTFILES.in b/po/POTFILES.in index 3ee46bb9af6b53e529fef756b0c9950662cdfc2c..2a495825e03e0c6ab3e6f353a0234208a8b01018 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -93,6 +93,7 @@ src/resources/ui/nautilus-progress-info-widget.ui src/resources/ui/nautilus-properties-window.ui src/resources/ui/nautilus-rename-file-popover.ui src/resources/ui/nautilus-search-popover.ui +src/resources/ui/nautilus-search-types-dialog.ui src/resources/ui/nautilus-toolbar.ui src/resources/ui/nautilus-toolbar-view-menu.ui src/resources/ui/nautilus-view-controls.ui diff --git a/src/meson.build b/src/meson.build index 483d87187ec2fd4ae9aa84176910c6e3cc220e58..dfe9c7085993f73b970f43526f7a2c251be0c034 100644 --- a/src/meson.build +++ b/src/meson.build @@ -98,6 +98,8 @@ libnautilus_sources = [ 'nautilus-location-entry.h', 'nautilus-mime-actions.c', 'nautilus-mime-actions.h', + 'nautilus-minimal-cell.c', + 'nautilus-minimal-cell.h', 'nautilus-name-cell.c', 'nautilus-name-cell.h', 'nautilus-pathbar.c', diff --git a/src/nautilus-compress-dialog.c b/src/nautilus-compress-dialog.c index a8c75b0dffbd6fff1a91c68fc3d9048353a9ad59..3c176fade0748819d2bded5aebf144d3fd482f02 100644 --- a/src/nautilus-compress-dialog.c +++ b/src/nautilus-compress-dialog.c @@ -29,7 +29,7 @@ struct _NautilusCompressDialog gpointer callback_data; }; -G_DEFINE_TYPE (NautilusCompressDialog, nautilus_compress_dialog, ADW_TYPE_WINDOW); +G_DEFINE_TYPE (NautilusCompressDialog, nautilus_compress_dialog, ADW_TYPE_DIALOG); #define NAUTILUS_TYPE_COMPRESS_ITEM (nautilus_compress_item_get_type ()) G_DECLARE_FINAL_TYPE (NautilusCompressItem, nautilus_compress_item, NAUTILUS, COMPRESS_ITEM, GObject) @@ -304,7 +304,7 @@ on_name_accepted (NautilusCompressDialog *self) self->callback (name, passphrase, self->callback_data); - gtk_window_close (GTK_WINDOW (self)); + adw_dialog_close (ADW_DIALOG (self)); } static void @@ -353,7 +353,6 @@ nautilus_compress_dialog_new (GtkWindow *parent_window, gpointer callback_data) { NautilusCompressDialog *self = g_object_new (NAUTILUS_TYPE_COMPRESS_DIALOG, - "transient-for", parent_window, NULL); nautilus_filename_validator_set_containing_directory (self->validator, @@ -366,9 +365,10 @@ nautilus_compress_dialog_new (GtkWindow *parent_window, { gtk_editable_set_text (GTK_EDITABLE (self->name_entry), initial_name); } - gtk_widget_grab_focus (self->name_entry); - gtk_window_present (GTK_WINDOW (self)); + adw_dialog_present (ADW_DIALOG (self), GTK_WIDGET (parent_window)); + + gtk_widget_grab_focus (self->name_entry); return self; } diff --git a/src/nautilus-compress-dialog.h b/src/nautilus-compress-dialog.h index 0efd557a5f5e682a8aa7dea41ef549652360224d..4a242e7ed68516adcd92f82501b7622dd5b72a66 100644 --- a/src/nautilus-compress-dialog.h +++ b/src/nautilus-compress-dialog.h @@ -17,7 +17,7 @@ typedef void (*CompressCallback) (const char *new_name, gpointer user_data); #define NAUTILUS_TYPE_COMPRESS_DIALOG nautilus_compress_dialog_get_type () -G_DECLARE_FINAL_TYPE (NautilusCompressDialog, nautilus_compress_dialog, NAUTILUS, COMPRESS_DIALOG, AdwWindow) +G_DECLARE_FINAL_TYPE (NautilusCompressDialog, nautilus_compress_dialog, NAUTILUS, COMPRESS_DIALOG, AdwDialog) NautilusCompressDialog * nautilus_compress_dialog_new (GtkWindow *parent_window, NautilusDirectory *destination_directory, diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c index 48a4aa11a0d0f4dd12b05300af3767456a295539..a454358de355f0bb924efeda3caa8aa81a5c38a7 100644 --- a/src/nautilus-files-view.c +++ b/src/nautilus-files-view.c @@ -1844,7 +1844,7 @@ action_popup_menu (GSimpleAction *action, } static void -pattern_select_response_select (AdwWindow *dialog, +pattern_select_response_select (AdwDialog *dialog, gpointer user_data) { NautilusFilesView *view = g_object_get_data (G_OBJECT (dialog), "view"); @@ -1863,7 +1863,7 @@ pattern_select_response_select (AdwWindow *dialog, nautilus_files_view_call_set_selection (view, selection); - gtk_window_destroy (GTK_WINDOW (dialog)); + adw_dialog_close (dialog); } static void @@ -1884,8 +1884,6 @@ select_pattern (NautilusFilesView *view) "*.png, file\?\?.txt, pict*.\?\?\?"); gtk_label_set_markup (GTK_LABEL (example), example_pattern); g_free (example_pattern); - gtk_window_set_transient_for (GTK_WINDOW (dialog), - GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (view)))); entry = GTK_WIDGET (gtk_builder_get_object (builder, "pattern_entry")); select_button = GTK_WIDGET (gtk_builder_get_object (builder, "select_button")); @@ -1896,7 +1894,7 @@ select_pattern (NautilusFilesView *view) G_CALLBACK (pattern_select_response_select), dialog); - gtk_window_present (GTK_WINDOW (dialog)); + adw_dialog_present (ADW_DIALOG (dialog), GTK_WIDGET (view)); } static void diff --git a/src/nautilus-minimal-cell.c b/src/nautilus-minimal-cell.c new file mode 100644 index 0000000000000000000000000000000000000000..056fd7ac833d0c36f9ac5b847b9f3b88322579e5 --- /dev/null +++ b/src/nautilus-minimal-cell.c @@ -0,0 +1,176 @@ +/* + * Copyright © 2024 The Files contributors + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Authors: Khalid Abu Shawarib + */ + +#include "nautilus-minimal-cell.h" + +#include +#include + +struct _NautilusMinimalCell +{ + GObject parent_instance; + + gchar *title; + gchar *subtitle; + + GObject *paintable; +}; + +G_DEFINE_TYPE (NautilusMinimalCell, nautilus_minimal_cell, G_TYPE_OBJECT) + +enum +{ + PROP_0, + PROP_PAINTABLE, + PROP_SUBTITLE, + PROP_TITLE, + N_PROPS +}; + +static GParamSpec *properties[N_PROPS]; + +const gchar * +nautilus_minimal_cell_get_subtitle (NautilusMinimalCell *self) +{ + return self->subtitle; +} + +const gchar * +nautilus_minimal_cell_get_title (NautilusMinimalCell *self) +{ + return self->title; +} + +static void +nautilus_minimal_cell_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + NautilusMinimalCell *self = NAUTILUS_MINIMAL_CELL (object); + + switch (property_id) + { + case PROP_PAINTABLE: + { + g_value_set_object (value, self->paintable); + } + break; + + case PROP_SUBTITLE: + { + g_value_set_string (value, self->subtitle); + } + break; + + case PROP_TITLE: + { + g_value_set_string (value, self->title); + } + break; + + default: + { + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } + } +} + +static void +nautilus_minimal_cell_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + NautilusMinimalCell *self = NAUTILUS_MINIMAL_CELL (object); + + switch (property_id) + { + case PROP_PAINTABLE: + { + self->paintable = g_value_get_object (value); + } + break; + + case PROP_SUBTITLE: + { + g_set_str (&self->subtitle, g_value_get_string (value)); + } + break; + + case PROP_TITLE: + { + g_set_str (&self->title, g_value_get_string (value)); + } + break; + + default: + { + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + } + } +} + +static void +nautilus_minimal_cell_init (NautilusMinimalCell *self) +{ +} + +static void +nautilus_minimal_cell_dispose (GObject *object) +{ + NautilusMinimalCell *self = NAUTILUS_MINIMAL_CELL (object); + + g_clear_object (&self->paintable); + g_clear_pointer (&self->subtitle, g_free); + g_clear_pointer (&self->title, g_free); + + G_OBJECT_CLASS (nautilus_minimal_cell_parent_class)->dispose (object); +} + +static void +nautilus_minimal_cell_class_init (NautilusMinimalCellClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->get_property = nautilus_minimal_cell_get_property; + object_class->set_property = nautilus_minimal_cell_set_property; + object_class->dispose = nautilus_minimal_cell_dispose; + + properties[PROP_PAINTABLE] = g_param_spec_object ("paintable", NULL, NULL, + G_TYPE_OBJECT, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + + properties[PROP_SUBTITLE] = g_param_spec_string ("subtitle", NULL, NULL, + NULL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + + properties[PROP_TITLE] = g_param_spec_string ("title", NULL, NULL, + NULL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, N_PROPS, properties); +} + +NautilusMinimalCell * +nautilus_minimal_cell_new (gchar *title, + gchar *subtitle, + GdkPaintable *paintable) +{ + return NAUTILUS_MINIMAL_CELL (g_object_new (NAUTILUS_TYPE_MINIMAL_CELL, + "title", title, + "subtitle", subtitle, + "paintable", paintable, + NULL)); +} diff --git a/src/nautilus-minimal-cell.h b/src/nautilus-minimal-cell.h new file mode 100644 index 0000000000000000000000000000000000000000..8b19fafddad7508a6bf03b6ec11c879b4c036d06 --- /dev/null +++ b/src/nautilus-minimal-cell.h @@ -0,0 +1,26 @@ +/* + * Copyright © 2024 The Files contributors + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Authors: Khalid Abu Shawarib + */ + +#pragma once + +#include "nautilus-view-cell.h" + +G_BEGIN_DECLS + +#define NAUTILUS_TYPE_MINIMAL_CELL (nautilus_minimal_cell_get_type()) + +G_DECLARE_FINAL_TYPE (NautilusMinimalCell, nautilus_minimal_cell, NAUTILUS, MINIMAL_CELL, GObject) + +NautilusMinimalCell * nautilus_minimal_cell_new (gchar *title, + gchar *subtitle, + GdkPaintable *paintable); + +const gchar * nautilus_minimal_cell_get_subtitle (NautilusMinimalCell *self); +const gchar * nautilus_minimal_cell_get_title (NautilusMinimalCell *self); + +G_END_DECLS diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c index 7ce90b7851fce779a582e1589811677594ae39c1..794f286bd22910cc846f293648bfadbc6bbcda20 100644 --- a/src/nautilus-properties-window.c +++ b/src/nautilus-properties-window.c @@ -172,6 +172,7 @@ struct _NautilusPropertiesWindow GroupChange *group_change; OwnerChange *owner_change; + AdwDialog *permissions_dialog; GList *permission_rows; GList *change_permission_combo_rows; GHashTable *initial_permissions; @@ -3242,23 +3243,16 @@ set_recursive_permissions_done (gboolean success, } static void -on_change_permissions_response_cancel (AdwWindow *dialog, - gpointer user_data) +on_change_permissions_response_cancel (NautilusPropertiesWindow *self) { - NautilusPropertiesWindow *self = - NAUTILUS_PROPERTIES_WINDOW (gtk_window_get_transient_for (GTK_WINDOW (dialog))); - g_clear_pointer (&self->change_permission_combo_rows, g_list_free); - gtk_window_destroy (GTK_WINDOW (dialog)); + + adw_dialog_close (self->permissions_dialog); } static void -on_change_permissions_response_change (AdwWindow *dialog, - gpointer user_data) +on_change_permissions_response_change (NautilusPropertiesWindow *self) { - NautilusPropertiesWindow *self = - NAUTILUS_PROPERTIES_WINDOW (gtk_window_get_transient_for (GTK_WINDOW (dialog))); - guint32 file_permission = 0, file_permission_mask = 0; guint32 dir_permission = 0, dir_permission_mask = 0; guint32 vfs_mask, vfs_new_perm; @@ -3326,7 +3320,7 @@ on_change_permissions_response_change (AdwWindow *dialog, } } g_clear_pointer (&self->change_permission_combo_rows, g_list_free); - gtk_window_destroy (GTK_WINDOW (dialog)); + adw_dialog_close (self->permissions_dialog); } static void @@ -3443,7 +3437,7 @@ on_change_permissions_close (GtkWidget *widget, GVariant *args, gpointer user_data) { - on_change_permissions_response_cancel (ADW_WINDOW (user_data), widget); + on_change_permissions_response_cancel (NAUTILUS_PROPERTIES_WINDOW (user_data)); return TRUE; } @@ -3451,7 +3445,6 @@ on_change_permissions_close (GtkWidget *widget, static void on_change_permissions_clicked (NautilusPropertiesWindow *self) { - GtkWidget *dialog; AdwComboRow *combo_row; GtkButton *cancel_button, *change_button; GtkShortcut *esc_shortcut; @@ -3460,8 +3453,7 @@ on_change_permissions_clicked (NautilusPropertiesWindow *self) change_permissions_builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-file-properties-change-permissions.ui"); - dialog = GTK_WIDGET (gtk_builder_get_object (change_permissions_builder, "change_permissions_dialog")); - gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self)); + self->permissions_dialog = ADW_DIALOG (gtk_builder_get_object (change_permissions_builder, "change_permissions_dialog")); /* Owner Permissions */ combo_row = ADW_COMBO_ROW (gtk_builder_get_object (change_permissions_builder, "file_owner_combo_row")); @@ -3507,17 +3499,17 @@ on_change_permissions_clicked (NautilusPropertiesWindow *self) g_signal_connect_swapped (cancel_button, "clicked", G_CALLBACK (on_change_permissions_response_cancel), - dialog); + self); g_signal_connect_swapped (change_button, "clicked", G_CALLBACK (on_change_permissions_response_change), - dialog); + self); esc_shortcut = GTK_SHORTCUT (gtk_builder_get_object (change_permissions_builder, "esc_shortcut")); cb_action = gtk_callback_action_new ((GtkShortcutFunc) on_change_permissions_close, - dialog, NULL); + self, NULL); gtk_shortcut_set_action (esc_shortcut, cb_action); - gtk_window_present (GTK_WINDOW (dialog)); + adw_dialog_present (self->permissions_dialog, GTK_WIDGET (self)); } static void diff --git a/src/nautilus-search-popover.c b/src/nautilus-search-popover.c index c84efc947c96bcf332c0c0fad3a7389fd91a14d5..41ee795ffc3ca6980a08790b89b191ea608ffca1 100644 --- a/src/nautilus-search-popover.c +++ b/src/nautilus-search-popover.c @@ -16,12 +16,17 @@ * along with this program. If not, see . */ +#include +#include + #include "nautilus-enum-types.h" #include "nautilus-search-popover.h" #include "nautilus-mime-actions.h" #include #include "nautilus-file.h" +#include "nautilus-icon-info.h" +#include "nautilus-minimal-cell.h" #include "nautilus-ui-utilities.h" #include "nautilus-global-preferences.h" @@ -49,6 +54,9 @@ struct _NautilusSearchPopover GtkWidget *full_text_search_button; GtkWidget *filename_search_button; + AdwDialog *type_dialog; + GtkStack *type_dialog_stack; + NautilusQuery *query; GtkSingleSelection *other_types_model; @@ -532,167 +540,144 @@ show_date_selection_widgets (NautilusSearchPopover *popover, } static void -on_other_types_dialog_response (GtkDialog *dialog, - gint response_id, - NautilusSearchPopover *popover) +on_other_types_dialog_response (NautilusSearchPopover *popover) { - if (response_id == GTK_RESPONSE_OK) - { - GtkStringObject *item; - const char *mimetype; - g_autofree gchar *description = NULL; + NautilusMinimalCell *item = gtk_single_selection_get_selected_item (popover->other_types_model); + const gchar *description = nautilus_minimal_cell_get_title (item); + const gchar *mimetype = nautilus_minimal_cell_get_subtitle (item); - item = gtk_single_selection_get_selected_item (popover->other_types_model); - mimetype = gtk_string_object_get_string (item); - description = g_content_type_get_description (mimetype); + gtk_label_set_label (GTK_LABEL (popover->type_label), description); - gtk_label_set_label (GTK_LABEL (popover->type_label), description); + g_signal_emit_by_name (popover, "mime-type", -1, mimetype); - g_signal_emit_by_name (popover, "mime-type", -1, mimetype); - - gtk_stack_set_visible_child_name (GTK_STACK (popover->type_stack), "type-button"); - } + gtk_stack_set_visible_child_name (GTK_STACK (popover->type_stack), "type-button"); g_clear_object (&popover->other_types_model); - gtk_window_destroy (GTK_WINDOW (dialog)); + + adw_dialog_close (popover->type_dialog); } -static void -on_other_types_activate (GtkListView *self, - guint position, - gpointer user_data) +static gchar * +join_type_and_description (NautilusMinimalCell *cell) { - GtkDialog *dialog = GTK_DIALOG (user_data); + const gchar *description = nautilus_minimal_cell_get_title (cell); + const gchar *content_type = nautilus_minimal_cell_get_subtitle (cell); - gtk_dialog_response (dialog, GTK_RESPONSE_OK); + return g_strdup_printf ("%s %s", content_type, description); } static void -on_other_types_bind (GtkSignalListItemFactory *factory, - GtkListItem *listitem, - gpointer user_data) +file_type_search_changed (GtkEditable *search_entry, + GParamSpec *pspec, + NautilusSearchPopover *self) { - GtkLabel *label; - GtkStringObject *item; - g_autofree gchar *description = NULL; + const gchar *string = gtk_editable_get_text (search_entry); - label = GTK_LABEL (gtk_list_item_get_child (listitem)); - item = GTK_STRING_OBJECT (gtk_list_item_get_item (listitem)); + if (string == NULL || *string == '\0') + { + gtk_stack_set_visible_child_name (self->type_dialog_stack, "start"); + gtk_widget_set_sensitive (GTK_WIDGET (adw_dialog_get_default_widget (self->type_dialog)), + FALSE); - description = g_content_type_get_description (gtk_string_object_get_string (item)); - gtk_label_set_text (label, description); -} + return; + } -static void -on_other_types_setup (GtkSignalListItemFactory *factory, - GtkListItem *listitem, - gpointer user_data) -{ - GtkWidget *label; + guint result_count = g_list_model_get_n_items (G_LIST_MODEL (self->other_types_model)); - label = gtk_label_new (NULL); - gtk_widget_set_halign (label, GTK_ALIGN_START); - gtk_widget_set_margin_start (label, 12); - gtk_widget_set_margin_end (label, 12); - gtk_widget_set_margin_top (label, 6); - gtk_widget_set_margin_bottom (label, 6); - gtk_list_item_set_child (listitem, label); + if (result_count == 0) + { + gtk_stack_set_visible_child_name (self->type_dialog_stack, "empty"); + gtk_widget_set_sensitive (GTK_WIDGET (adw_dialog_get_default_widget (self->type_dialog)), + FALSE); + } + else + { + gtk_stack_set_visible_child_name (self->type_dialog_stack, "results"); + gtk_widget_set_sensitive (GTK_WIDGET (adw_dialog_get_default_widget (self->type_dialog)), + TRUE); + } } -static gchar * -join_type_and_description (GtkStringObject *object, - gpointer user_data) +static gboolean +click_policy_mapping_get (GValue *gvalue, + GVariant *variant, + gpointer listview) { - const gchar *content_type = gtk_string_object_get_string (object); - g_autofree gchar *description = g_content_type_get_description (content_type); + int click_policy = g_settings_get_enum (nautilus_preferences, + NAUTILUS_PREFERENCES_CLICK_POLICY); - return g_strdup_printf ("%s %s", content_type, description); + g_value_set_boolean (gvalue, click_policy == NAUTILUS_CLICK_POLICY_SINGLE); + + return TRUE; } static void show_other_types_dialog (NautilusSearchPopover *popover) { - GtkStringList *string_model; - GtkStringSorter *sorter; - GtkSortListModel *sort_model; GtkStringFilter *filter; GtkFilterListModel *filter_model; g_autoptr (GList) mime_infos = NULL; - GtkWidget *dialog; + GListStore *file_type_list = g_list_store_new (NAUTILUS_TYPE_MINIMAL_CELL); + g_autoptr (GtkBuilder) builder = NULL; + AdwToolbarView *toolbar_view; GtkWidget *content_area; GtkWidget *search_entry; - GtkWidget *scrolled; - GtkListItemFactory *factory; - GtkWidget *listview; - GtkRoot *toplevel; + GtkListView *listview; + GtkRoot *toplevel = gtk_widget_get_root (GTK_WIDGET (popover)); gtk_popover_popdown (GTK_POPOVER (popover)); - string_model = gtk_string_list_new (NULL); mime_infos = g_content_types_get_registered (); + mime_infos = g_list_sort (mime_infos, (GCompareFunc) g_strcmp0); + gint scale = gtk_widget_get_scale_factor (GTK_WIDGET (toplevel)); for (GList *l = mime_infos; l != NULL; l = l->next) { - gtk_string_list_take (string_model, l->data); + g_autofree gchar *content_type = l->data; + g_autofree gchar *description = g_content_type_get_description (content_type); + g_autoptr (GIcon) icon = g_content_type_get_icon (content_type); + g_autoptr (NautilusIconInfo) icon_info = nautilus_icon_info_lookup (icon, 32, scale); + GdkPaintable *paintable = nautilus_icon_info_get_paintable (icon_info); + + g_list_store_append (file_type_list, nautilus_minimal_cell_new (description, + content_type, + GDK_PAINTABLE (paintable))); } - sorter = gtk_string_sorter_new (gtk_property_expression_new (GTK_TYPE_STRING_OBJECT, NULL, "string")); - sort_model = gtk_sort_list_model_new (G_LIST_MODEL (string_model), GTK_SORTER (sorter)); + filter = gtk_string_filter_new (gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, G_CALLBACK (join_type_and_description), NULL, NULL)); - filter_model = gtk_filter_list_model_new (G_LIST_MODEL (sort_model), GTK_FILTER (filter)); + filter_model = gtk_filter_list_model_new (G_LIST_MODEL (file_type_list), GTK_FILTER (filter)); popover->other_types_model = gtk_single_selection_new (G_LIST_MODEL (filter_model)); - toplevel = gtk_widget_get_root (GTK_WIDGET (popover)); - dialog = gtk_dialog_new_with_buttons (_("Select type"), - GTK_WINDOW (toplevel), - GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_USE_HEADER_BAR, - _("_Cancel"), GTK_RESPONSE_CANCEL, - _("Select"), GTK_RESPONSE_OK, - NULL); - gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); - gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 600); - - /* If there are 0 results, make action insensitive */ - g_object_bind_property (filter_model, - "n-items", - gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK), - "sensitive", - G_BINDING_DEFAULT); - - content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); - - search_entry = gtk_search_entry_new (); - gtk_search_entry_set_key_capture_widget (GTK_SEARCH_ENTRY (search_entry), content_area); - g_object_bind_property (search_entry, "text", filter, "search", G_BINDING_SYNC_CREATE); - gtk_box_append (GTK_BOX (content_area), search_entry); - gtk_widget_set_margin_start (search_entry, 12); - gtk_widget_set_margin_end (search_entry, 12); - gtk_widget_set_margin_top (search_entry, 6); - gtk_widget_set_margin_bottom (search_entry, 6); - - gtk_box_append (GTK_BOX (content_area), gtk_separator_new (GTK_ORIENTATION_VERTICAL)); - - scrolled = gtk_scrolled_window_new (); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - - gtk_widget_set_vexpand (scrolled, TRUE); - gtk_box_append (GTK_BOX (content_area), scrolled); + builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-search-types-dialog.ui"); - factory = gtk_signal_list_item_factory_new (); - g_signal_connect (factory, "setup", G_CALLBACK (on_other_types_setup), NULL); - g_signal_connect (factory, "bind", G_CALLBACK (on_other_types_bind), NULL); + popover->type_dialog = ADW_DIALOG (gtk_builder_get_object (builder, "file_types_dialog")); + search_entry = GTK_WIDGET (gtk_builder_get_object (builder, "search_entry")); + toolbar_view = ADW_TOOLBAR_VIEW (gtk_builder_get_object (builder, "toolbar_view")); + popover->type_dialog_stack = GTK_STACK (gtk_builder_get_object (builder, "search_stack")); + listview = GTK_LIST_VIEW (gtk_builder_get_object (builder, "listview")); - listview = gtk_list_view_new (GTK_SELECTION_MODEL (g_object_ref (popover->other_types_model)), - factory); - g_signal_connect (listview, "activate", G_CALLBACK (on_other_types_activate), dialog); - - gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), listview); - - g_signal_connect (dialog, "response", G_CALLBACK (on_other_types_dialog_response), popover); - gtk_window_present (GTK_WINDOW (dialog)); + content_area = adw_toolbar_view_get_content (toolbar_view); + gtk_search_entry_set_key_capture_widget (GTK_SEARCH_ENTRY (search_entry), content_area); + g_object_bind_property (search_entry, "text", filter, "search", G_BINDING_SYNC_CREATE); + g_signal_connect_after (search_entry, "notify::text", + G_CALLBACK (file_type_search_changed), popover); + + gtk_list_view_set_model (listview, + GTK_SELECTION_MODEL (g_object_ref (popover->other_types_model))); + g_settings_bind_with_mapping (nautilus_preferences, NAUTILUS_PREFERENCES_CLICK_POLICY, + listview, "single-click-activate", G_SETTINGS_BIND_GET, + click_policy_mapping_get, NULL, listview, NULL); + + g_signal_connect_swapped (adw_dialog_get_default_widget (popover->type_dialog), "clicked", + G_CALLBACK (on_other_types_dialog_response), popover); + g_signal_connect_swapped (popover->type_dialog, "close-attempt", + G_CALLBACK (on_other_types_dialog_response), popover); + g_signal_connect_swapped (listview, "activate", + G_CALLBACK (on_other_types_dialog_response), popover); + + adw_dialog_present (popover->type_dialog, GTK_WIDGET (toplevel)); } static void diff --git a/src/nautilus-window.c b/src/nautilus-window.c index fd7f94025399e82da3ffd3f5fd643b58b6ffc675..c94982ef0196cccbc25caa20bf458477f1f1f75a 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -1801,7 +1801,7 @@ nautilus_window_show_about_dialog (NautilusWindow *window) "NAUTILUS_DISABLE_PLUGINS=TRUE nautilus", NULL); } - adw_show_about_window (window ? GTK_WINDOW (window) : NULL, + adw_show_about_dialog (window ? GTK_WIDGET (window) : NULL, "application-name", _("Files"), "application-icon", APPLICATION_ID, "developer-name", _("The GNOME Project"), diff --git a/src/resources/nautilus.gresource.xml b/src/resources/nautilus.gresource.xml index 4dbed18aad7c39c218bbb318bcc27d877654b6d9..c8c2b010cbe5ab8d5f9a731b043e84b1454153a4 100644 --- a/src/resources/nautilus.gresource.xml +++ b/src/resources/nautilus.gresource.xml @@ -3,6 +3,7 @@ ui/nautilus-preferences-window.ui ui/nautilus-search-popover.ui + ui/nautilus-search-types-dialog.ui ui/nautilus-app-chooser.ui ui/nautilus-pathbar-context-menu.ui ui/nautilus-toolbar.ui diff --git a/src/resources/ui/nautilus-compress-dialog.ui b/src/resources/ui/nautilus-compress-dialog.ui index 3a29586a784fbfbf41a4f3c9d52d87de3b59688d..9b641742ff23386f57e89653439ae64592efefac 100644 --- a/src/resources/ui/nautilus-compress-dialog.ui +++ b/src/resources/ui/nautilus-compress-dialog.ui @@ -1,14 +1,11 @@ -