diff --git a/src/nautilus-application.c b/src/nautilus-application.c index 505001f1a031115c6e3f295aac67af5e7d753df8..d7854dcecd8f42bbb9e4f9c30129915e5c51d78f 100644 --- a/src/nautilus-application.c +++ b/src/nautilus-application.c @@ -1113,45 +1113,29 @@ nautilus_application_init (NautilusApplication *self) } static void -theme_changed (GtkSettings *settings) +setup_theme_extensions (void) { static GtkCssProvider *provider = NULL; static GtkCssProvider *permanent_provider = NULL; - gchar *theme; GdkDisplay *display; - GFile *file; - g_object_get (settings, "gtk-theme-name", &theme, NULL); display = gdk_display_get_default (); /* CSS that themes can override */ - if (g_str_equal (theme, "Adwaita") || g_str_equal (theme, "Adwaita-dark")) + if (provider == NULL) { - if (provider == NULL) - { - provider = gtk_css_provider_new (); - file = g_file_new_for_uri ("resource:///org/gnome/nautilus/css/Adwaita.css"); - gtk_css_provider_load_from_file (provider, file); - g_object_unref (file); - } - + provider = gtk_css_provider_new (); + gtk_css_provider_load_from_resource (provider, "/org/gnome/nautilus/css/Adwaita.css"); gtk_style_context_add_provider_for_display (display, GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } - else if (provider != NULL) - { - gtk_style_context_remove_provider_for_display (display, - GTK_STYLE_PROVIDER (provider)); - g_clear_object (&provider); - } /* CSS we want to always load for any theme */ if (permanent_provider == NULL) { permanent_provider = gtk_css_provider_new (); - file = g_file_new_for_uri ("resource:///org/gnome/nautilus/css/nautilus.css"); - gtk_css_provider_load_from_file (permanent_provider, file); + gtk_css_provider_load_from_resource (permanent_provider, "/org/gnome/nautilus/css/nautilus.css"); /* The behavior of two style providers with the same priority is * undefined and gtk happens to prefer the provider that got added last. * Use a higher priority here to avoid this problem. @@ -1159,24 +1143,7 @@ theme_changed (GtkSettings *settings) gtk_style_context_add_provider_for_display (display, GTK_STYLE_PROVIDER (permanent_provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION + 1); - g_object_unref (file); } - - g_free (theme); -} - -static void -setup_theme_extensions (void) -{ - GtkSettings *settings; - - /* Set up a handler to load our custom css for Adwaita. - * See https://bugzilla.gnome.org/show_bug.cgi?id=732959 - * for a more automatic solution that is still under discussion. - */ - settings = gtk_settings_get_default (); - g_signal_connect (settings, "notify::gtk-theme-name", G_CALLBACK (theme_changed), NULL); - theme_changed (settings); } NautilusApplication * diff --git a/src/nautilus-compress-dialog-controller.c b/src/nautilus-compress-dialog-controller.c index 17a5be4b7de552e3717034d6dbba4cc15550dccb..13ac2548b0792e622e17c0dcbde21089231b5afa 100644 --- a/src/nautilus-compress-dialog-controller.c +++ b/src/nautilus-compress-dialog-controller.c @@ -308,7 +308,6 @@ passphrase_entry_on_changed (GtkEditable *editable, static void passphrase_entry_on_icon_press (GtkEntry *entry, GtkEntryIconPosition icon_pos, - GdkEvent *event, gpointer user_data) { NautilusCompressDialogController *self; diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c index c815e8c742022b78000c81b4ab0740f3d1f46ace..eb07d9f9524dfd10ade7ca9e65d90414a8548ea4 100644 --- a/src/nautilus-files-view.c +++ b/src/nautilus-files-view.c @@ -8316,6 +8316,8 @@ nautilus_files_view_pop_up_background_context_menu (NautilusFilesView *view, { priv->background_menu = gtk_popover_menu_new_from_model (NULL); gtk_widget_set_parent (priv->background_menu, GTK_WIDGET (view)); + gtk_popover_set_has_arrow (GTK_POPOVER (priv->background_menu), FALSE); + gtk_widget_set_halign (priv->background_menu, GTK_ALIGN_START); g_signal_connect (priv->background_menu, "destroy", G_CALLBACK (gtk_widget_unparent), NULL); } gtk_popover_menu_set_menu_model (GTK_POPOVER_MENU (priv->background_menu), diff --git a/src/nautilus-location-entry.c b/src/nautilus-location-entry.c index 73fda840f5c717398c58ab6637bb333135bbf957..bc37cc201ba8fcd1b772513581dc9aa03f9394eb 100644 --- a/src/nautilus-location-entry.c +++ b/src/nautilus-location-entry.c @@ -644,7 +644,6 @@ nautilus_location_entry_text_changed (NautilusLocationEntry *entry, static void nautilus_location_entry_icon_release (GtkEntry *gentry, GtkEntryIconPosition position, - GdkEvent *event, gpointer unused) { NautilusLocationEntry *entry; diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c index a359a210189830463adf15bd6fa6604a002c213a..6050683f2816a79ed4751d3d488b79125893d063 100644 --- a/src/nautilus-properties-window.c +++ b/src/nautilus-properties-window.c @@ -456,6 +456,7 @@ update_properties_window_icon (NautilusPropertiesWindow *self) { g_autoptr (GdkPaintable) paintable = NULL; g_autofree char *name = NULL; + gint pixel_size; get_image_for_properties_window (self, &name, &paintable); @@ -464,8 +465,13 @@ update_properties_window_icon (NautilusPropertiesWindow *self) gtk_window_set_icon_name (GTK_WINDOW (self), name); } + pixel_size = MAX (gdk_paintable_get_intrinsic_width (paintable), + gdk_paintable_get_intrinsic_width (paintable)); + gtk_image_set_from_paintable (GTK_IMAGE (self->icon_image), paintable); gtk_image_set_from_paintable (GTK_IMAGE (self->icon_button_image), paintable); + gtk_image_set_pixel_size (GTK_IMAGE (self->icon_image), pixel_size); + gtk_image_set_pixel_size (GTK_IMAGE (self->icon_button_image), pixel_size); } #if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c index 15bcd1f57e62f282245362c0c20c6ddd914b9c02..98d69f3b0f2275464005c3a8bc9f36071cd2f821 100644 --- a/src/nautilus-query-editor.c +++ b/src/nautilus-query-editor.c @@ -795,6 +795,7 @@ nautilus_query_editor_handle_event (NautilusQueryEditor *self, guint keyval, GdkModifierType state) { + GtkWidget *text; g_return_val_if_fail (NAUTILUS_IS_QUERY_EDITOR (self), GDK_EVENT_PROPAGATE); g_return_val_if_fail (controller != NULL, GDK_EVENT_PROPAGATE); @@ -806,5 +807,19 @@ nautilus_query_editor_handle_event (NautilusQueryEditor *self, return GDK_EVENT_PROPAGATE; } - return gtk_event_controller_key_forward (controller, GTK_WIDGET (self->entry)); + text = gtk_widget_get_first_child (GTK_WIDGET (self->entry)); + while (text != NULL) + { + if (GTK_IS_TEXT (text)) + { + break; + } + text = gtk_widget_get_next_sibling (text); + } + + if (text == NULL) + { + return FALSE; + } + return gtk_event_controller_key_forward (controller, text); } diff --git a/src/nautilus-search-popover.c b/src/nautilus-search-popover.c index 20559fa9eb0dd7e9cb0daf61c14fc485dbac581a..be30c7fe0a16467d6e0d8af22229e6fe58591b6e 100644 --- a/src/nautilus-search-popover.c +++ b/src/nautilus-search-popover.c @@ -278,7 +278,6 @@ select_type_button_clicked (GtkButton *button, static void toggle_calendar_icon_clicked (GtkEntry *entry, GtkEntryIconPosition position, - GdkEvent *event, NautilusSearchPopover *popover) { const gchar *current_visible_child; diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c index 670508933f0f9f5b06be76458efd8bb1d43484d1..835d8add13fd588736e011b91317dc20691d08e5 100644 --- a/src/nautilus-toolbar.c +++ b/src/nautilus-toolbar.c @@ -78,9 +78,8 @@ struct _NautilusToolbar GtkWidget *operations_revealer; GtkWidget *operations_icon; - GtkWidget *view_toggle_button; + GtkWidget *view_split_button; GtkWidget *view_toggle_icon; - GtkWidget *view_button; GMenuModel *view_menu; GtkWidget *app_button; @@ -1129,9 +1128,8 @@ nautilus_toolbar_class_init (NautilusToolbarClass *klass) gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, operations_popover); gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, operations_list); gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, operations_revealer); - gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, view_button); gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, view_menu); - gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, view_toggle_button); + gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, view_split_button); gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, view_toggle_icon); gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, app_button); gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, undo_redo_section); @@ -1226,7 +1224,7 @@ on_slot_toolbar_menu_sections_changed (NautilusToolbar *self, new_sections = nautilus_window_slot_get_toolbar_menu_sections (slot); - gtk_widget_set_sensitive (self->view_button, (new_sections != NULL)); + gtk_widget_set_sensitive (self->view_split_button, (new_sections != NULL)); if (new_sections == NULL) { return; @@ -1326,7 +1324,7 @@ nautilus_toolbar_set_window_slot_real (NautilusToolbar *self, NULL); self->tooltip_binding = g_object_bind_property_full (self->window_slot, "tooltip", - self->view_toggle_button, "tooltip-text", + self->view_split_button, "tooltip-text", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE, (GBindingTransformFunc) nautilus_toolbar_view_toggle_tooltip_transform_to, NULL, diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-view-icon-controller.c index ffd12e4328562630cdcc89081a8ef6d2b030843e..f46044034555594faf221f6ac53221807bb64f11 100644 --- a/src/nautilus-view-icon-controller.c +++ b/src/nautilus-view-icon-controller.c @@ -1478,6 +1478,7 @@ nautilus_view_icon_controller_class_init (NautilusViewIconControllerClass *klass static void nautilus_view_icon_controller_init (NautilusViewIconController *self) { + gtk_widget_add_css_class (GTK_WIDGET (self), "view"); set_click_mode_from_settings (self); g_signal_connect_swapped (nautilus_preferences, diff --git a/src/nautilus-view-icon-item-ui.c b/src/nautilus-view-icon-item-ui.c index 344e0fc2a019519b04edb9baa96486e3d3058f24..8bb1e2abe69aca0f4b3795ccd5f7997e9bbdba9b 100644 --- a/src/nautilus-view-icon-item-ui.c +++ b/src/nautilus-view-icon-item-ui.c @@ -47,7 +47,7 @@ update_icon (NautilusViewIconItemUi *self) NAUTILUS_FILE_ICON_FLAGS_USE_ONE_EMBLEM; icon_paintable = nautilus_file_get_icon_paintable (file, icon_size, 1, flags); - gtk_image_set_from_paintable (GTK_IMAGE (self->icon), icon_paintable); + gtk_picture_set_paintable (GTK_PICTURE (self->icon), icon_paintable); gtk_widget_set_size_request (self->fixed_height_box, icon_size, icon_size); if (icon_size < NAUTILUS_GRID_ICON_SIZE_LARGEST) diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 244adbf2a3f13b2f2b326548adc5700aac5ad839..93d3b56ff93f0528323f50a7c70217387bd149b1 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -829,12 +829,12 @@ save_sidebar_width_cb (gpointer user_data) /* side pane helpers */ static void -side_pane_size_allocate_callback (GtkWidget *widget, - GtkAllocation *allocation, - gpointer user_data) +side_pane_notify_position_callback (GObject *object, + GParamSpec *pspec, + gpointer user_data) { NautilusWindow *window = user_data; - + gint position; if (window->sidebar_width_handler_id != 0) { @@ -842,10 +842,11 @@ side_pane_size_allocate_callback (GtkWidget *widget, window->sidebar_width_handler_id = 0; } - if (allocation->width != window->side_pane_width && - allocation->width > 1) + position = gtk_paned_get_position (GTK_PANED (window->content_paned)); + if (position != window->side_pane_width && + position > 1) { - window->side_pane_width = allocation->width; + window->side_pane_width = position; window->sidebar_width_handler_id = g_idle_add (save_sidebar_width_cb, window); @@ -1312,9 +1313,9 @@ static void nautilus_window_set_up_sidebar (NautilusWindow *window) { setup_side_pane_width (window); - g_signal_connect (window->sidebar, - "size-allocate", - G_CALLBACK (side_pane_size_allocate_callback), + g_signal_connect (window->content_paned, + "notify::position", + G_CALLBACK (side_pane_notify_position_callback), window); nautilus_gtk_places_sidebar_set_open_flags (NAUTILUS_GTK_PLACES_SIDEBAR (window->places_sidebar), diff --git a/src/resources/css/Adwaita.css b/src/resources/css/Adwaita.css index 8a0bb9c0129b7cc8cb29a0ed4926fd5c550694c9..4edefa20673355246ff64f943bdc3a62e5e46862 100644 --- a/src/resources/css/Adwaita.css +++ b/src/resources/css/Adwaita.css @@ -1,9 +1,3 @@ -.nautilus-window, -.nautilus-window notebook, -.nautilus-window notebook > stack { - background: @theme_base_color; -} - .nautilus-empty-state-icon { opacity: 0.50; } @@ -15,8 +9,8 @@ @keyframes needs_attention_keyframes { 0% {background-image: linear-gradient(to bottom, #fafafa, #ededed 40%, #e0e0e0); border-color: @borders; } /* can't do animation-direction, so holding the color on two keyframes */ - 30% {background-image: linear-gradient(to bottom, @theme_base_color, @theme_base_color, @theme_base_color); border-color: @theme_fg_color; } - 90% {background-image: linear-gradient(to bottom, @theme_base_color, @theme_base_color, @theme_base_color); border-color: @theme_fg_color; } + 30% {background-image: linear-gradient(to bottom, @view_bg_color, @view_bg_color, @view_bg_color); border-color: @window_fg_color; } + 90% {background-image: linear-gradient(to bottom, @view_bg_color, @view_bg_color, @view_bg_color); border-color: @window_fg_color; } 100% {background-image: linear-gradient(to bottom, #fafafa, #ededed 40%, #e0e0e0); border-color: @borders; } } @@ -35,25 +29,20 @@ background: none; } -.disclosure-button { - padding-left: 4px; - padding-right: 4px; -} - /* Path bar */ -.nautilus-path-bar scrolledwindow { - border-radius: 5px 0px 0px 5px; - border: 1px @borders solid; +.nautilus-path-bar > scrolledwindow { + margin: 6px 0px 6px 0px; + border-radius: 6px 0px 0px 6px; border-right-width: 0px; - background-color: @theme_bg_color; + background-color: alpha(currentColor, 0.1); } -.path-bar-box scrolledwindow undershoot.left { - border-radius: 5px 0px 0px 5px; - background: linear-gradient(to right, @theme_bg_color 6px, alpha(@theme_bg_color, 0) 24px); +.nautilus-path-bar > scrolledwindow undershoot.left { + border-radius: 6px 0px 0px 6px; + background: linear-gradient(to right, @headerbar_shade_color 6px, alpha(@headerbar_shade_color, 0) 24px); } -.path-bar-box scrolledwindow undershoot.right { - background: linear-gradient(to left, @theme_bg_color 6px, alpha(@theme_bg_color, 0) 24px); +.nautilus-path-bar > scrolledwindow undershoot.right { + background: linear-gradient(to left, @headerbar_shade_color 6px, alpha(@headerbar_shade_color, 0) 24px); } .nautilus-path-bar > button, @@ -62,56 +51,31 @@ } .path-buttons-box button { - background-image: none; + margin: 0px; box-shadow: none; border-radius: 7px; border-width: 0px; -gtk-icon-shadow: none; } -.path-buttons-box button:not(.current-dir):not(:backdrop):hover { - background: alpha(@theme_fg_color, 0.15); - box-shadow: inset 0 0 0 2px @theme_bg_color; +.path-buttons-box button:not(:hover), +.path-buttons-box button.current-dir +{ + background: none; } -.path-buttons-box button:not(.current-dir):not(:backdrop):hover * { +.path-buttons-box button:not(.current-dir):not(:backdrop):hover label { opacity: 1; } -/* Make the tags fit into the box */ -entry.search > * { - margin: 5px; -} - -/* Sidebar */ - -.nautilus-window .sidebar-row:selected { - background: mix(@theme_bg_color, @theme_fg_color, 0.07); -} - -.nautilus-window .sidebar-row:selected, -.nautilus-window .sidebar-row:selected image, -.nautilus-window .sidebar-row:selected label { - color: mix(@theme_fg_color, @theme_text_color, 0.5); -} - -.nautilus-window .sidebar-row:selected:backdrop { - background: mix(@theme_unfocused_bg_color, @theme_unfocused_fg_color, 0.07); -} - -.nautilus-window .sidebar-row:selected:backdrop, -.nautilus-window .sidebar-row:selected:backdrop label { - color: mix(@theme_unfocused_fg_color, @theme_unfocused_text_color, 0.15); -} - /* Floating status bar */ .floating-bar { padding: 3px; - background-color: @theme_base_color; + background-color: @view_bg_color; border-width: 1px; border-style: solid solid none; border-color: @borders; - border-radius: 8px 8px 0 0; + border-radius: 8px 0 0 0; } .floating-bar.bottom.left { /* axes left border and border radius */ @@ -124,7 +88,7 @@ entry.search > * { } .floating-bar:backdrop { - background-color: @theme_unfocused_base_color; + background-color: @view_bg_color; border-color: @unfocused_borders; } @@ -172,34 +136,23 @@ entry.search > * { * horizontal grid lines are enabled, we add them using CSS instead. Exclude the * drop targets to let through the default feedback style. */ .nautilus-list-view .view:not(:drop(active)) { - border-bottom: 1px solid @theme_bg_color; + border-bottom: 1px solid @window_bg_color; } .search-information { - background-color: @theme_selected_bg_color; + background-color: @accent_bg_color; color:white; padding:2px; } -@define-color conflict_bg #fef6b6; - .conflict-row { - background: @conflict_bg; - color: black; -} - -.conflict-row:hover { - background-color: shade(@conflict_bg, 0.9); -} - -.conflict-row:selected { - background: @theme_selected_bg_color; - color: @theme_selected_fg_color; + background: @warning_bg_color; + color: @warning_fg_color; } /* Icon view */ flowbox { - padding: 18px + padding: 18px; } flowboxchild { @@ -208,31 +161,26 @@ flowboxchild { flowboxchild:selected { background-color:transparent; - outline-color: transparent; } flowboxchild .thumbnail { margin: 4px; - box-shadow: 0px 1px 2px 0px alpha(@borders, 0.5), - 0px 0px 0px 1px alpha(@borders, 0.5), - 0px 2px 0px 0px alpha(@borders, 0.5); + box-shadow: 0px 1px 2px 0px @shade_color, + 0px 0px 0px 1px @shade_color, + 0px 2px 0px 0px @shade_color; border-radius: 2px; } .icon-ui-labels-box { padding: 2px 4px; - border-radius: 4px; + border-radius: 5px; } flowboxchild:selected .icon-ui-labels-box { - color: @theme_selected_fg_color; - background-color: @theme_selected_bg_color; + background-color: @accent_bg_color; + color: @accent_fg_color; } -flowboxchild:selected image { - -gtk-icon-effect: dim; /* GTK 3 only */ - /* GTK 4 TODO: Replace previous line with the following one: - -gtk-icon-filter: opacity(0.5); - */ - -gtk-icon-shadow: 0px 0px @theme_selected_bg_color; +flowboxchild:selected picture { + filter: sepia(1.5) hue-rotate(180deg) brightness(0.5) saturate(2.0); } diff --git a/src/resources/ui/nautilus-toolbar.ui b/src/resources/ui/nautilus-toolbar.ui index e9a1010298489d9e4e397550cf517cc7ac590772..1397646123d53d003f7824a569a91958d91540c0 100644 --- a/src/resources/ui/nautilus-toolbar.ui +++ b/src/resources/ui/nautilus-toolbar.ui @@ -130,7 +130,6 @@ False - 270 6 @@ -191,137 +190,112 @@ - + + True + Go back + center + center + win.back - - True - Go back - center - center - win.back - - - go-previous-symbolic - 1 - - - + + go-previous-symbolic + 1 + + + + + + True + Go forward + center + center + win.forward - - True - Go forward - center - center - win.forward - - - go-next-symbolic - 1 - - - + + go-next-symbolic + 1 + + + + + - - 72 + + True + center + center + app_menu - - center - center - slide-right - - - True - Show operations - 6 - operations_popover - - - 16 - 16 - center - center - - - - - + + open-menu-symbolic + 1 + + + + + + center + center + 6 + True + Toggle view + slot.files-view-mode-toggle + view_menu - - center - center - 6 - - - True - Toggle view - slot.files-view-mode-toggle - - - 1 - - - - - - - - True - True - View options - start - view_menu - - - pan-down-symbolic - - - - - - + + 1 - - + + + + + center + center + slide-right + + True - center - center - app_menu + Show operations + 6 + operations_popover - - open-menu-symbolic - 1 + + 16 + 16 + center + center - + + + + + + diff --git a/src/resources/ui/nautilus-view-icon-item-ui.ui b/src/resources/ui/nautilus-view-icon-item-ui.ui index fa1fe25e10d56824bb0f090ff37caf1a6ed334a2..7ec4eb839a0b983d57aad36ef9cac9e7dbc2eed2 100644 --- a/src/resources/ui/nautilus-view-icon-item-ui.ui +++ b/src/resources/ui/nautilus-view-icon-item-ui.ui @@ -17,11 +17,12 @@ center 96 - + center True end True + False @@ -56,7 +57,7 @@ word-char start @@ -70,7 +71,7 @@ word-char start @@ -84,7 +85,7 @@ word-char start