When navigating to Other Locations with "Open in New Tab" or
"Open in New Window", you are always presented with the icon view
because view_mode_before_places was never initialized. An uninitialized
gint == 0 (and NAUTILUS_VIEW_GRID_ID == 0).
Initialize view_mode_before_places in init to NAUTILUS_VIEW_INVALID_ID
so that it will follow the default behavior. For best practices,
change NAUTILUS_VIEW_INVALID_ID to 0 (which would have also prevented
this issue) and NAUTILUS_VIEW_GRID_ID to 2 (matching the keyboard
shortcut).
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2281
There's a complex set of code to handle DnD on the location entry.
This may have been very useful in the past, but it now a very corner
case situation. Furthermore, the Editable has a DropTarget on it
already within Gtk. The comments themself, indicate that likely
when a user is dropping multiple URI's it's a mistake.
Inserting a prefix calls insert-text which we have a signal
attached to. Add helper nautilus_location_entry_insert_prefix()
to temporarily block the insert-text handler while we insert
the prefix.
We are setting the editable text on the entry, which in turn
calls the insert / delete text functions on the GtkText which
is invoking the signals we attached. We only want the insert-text
and delete-text signals to be called when the user is actually
inputting data. Add helper nautilus_location_entry_set_text()
which temporarily blocks the signals while setting text.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2253
The signals are connected to the NatuilusLocationEntry, which does
not emit these signals. Instead set it to the delegate of the
GTK_EDITABLE for the entry.
a336c68b08 broke the ability to load Places.
There's an incorrect property on the AdwStatusPage "label" which
presumably should be "description". Likely this label property
persisted from when it previously was a GtkLabel. Change "label"
to "description".
Meson builds out-of-tree, these ignored files will never get created in
these directories. If they do, it indicates a build configuration error
and should not be hidden.
In some parts of the code, operations_button was considered as a member
of the child class of class GtkToggleButton. Which is incorrect in gtk4.
Using visibility of popover gives the intended functionality.
Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2313
We have multiple empty state .ui files, which make little sense now
that they are so simple, thanks to AdwStatusPage.
So, instead, add a single UI file for the whole view.
The places view had placeholders in a popover and for search. These
are both use cases where we can and should use AdwStatusPage, now that
we no longer keep this code in sync with GTK.
libadwaita provides a widget for status/empty pages. Instead
of rolling our own lookalike, we can now use the original
since we have a GtkStack instead of a GtkOverlay managing
views.
The port to GTK4 allows us to rework how we structure the view
to use a more modern view management widget: GtkStack. Now instead
of managing visibility with `show()`/`hide()`, we use
`GtkStack:visible-child`.
We've been setting background click gestures on the view_ui widget,
which is either GtkGridView or GtkColumnView.
But this means the empty state widgets don't get to handle these
clicks. And the situation would get worse with AdwStatusPage, which
fills the whole area.
So, follow the lead of the background drop target and set the gestures
on the NautilusFilesView container itself. This has the side effect
of clicks on the floating status bar working like clicks on the empty
space. But it's not a big problem.
Single action for creating a link can be either enabled and visible or disabled and invisible. Creating separate action allows hiding entry in context menu without disabling a shortcut.
Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2315
gtk4-builder-tool tries to port uses of `can_focus` to `focusable`,
but in real code you generally don't need to set `focusable` - the
defaults are always sensible, and removing the explicit property
means less code without any behavior change.
The view can receive focus, which causes it to draw an unnecessary
ring when focused and requires an extra focus step to get into the
items.
The view itself should not be focusable. This was set as a translation
of `can-focus`, but the semantics are different, and you generally
don't want to manually set `focusable` as the widgets set proper
defaults.
When you the navigation buttons to go back and forth very quickly
you can reliably get Nautilus to crash. This happens because there
is an idle timer set to scroll to the item to be selected. If you
change the view before the scroll has happened, the handler will
attempt to scroll to a non-existent item.
Clear scroll_to_file_handle_id before clearing all view items
in real_clear().
Opening a new tab from the main view and side bar is set with
NAUTILUS_OPEN_FLAG_DONT_MAKE_ACTIVE. Prior to
022867e3d3 this was the same for tabs opened
from the pathbar. It appears that the change was unintentional
(GTK Open Flags don't have a "don't make active" flag).
Set new tabs as not active from the path bar.
Middle click should open a new tab. This is consistent with
the main view, sidebar, and pathbar. When opening the new tab
set the location preemptively to either one location forward or
back.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1490
Add function like nautilus_window_back_or_foward(), but instead
of acting on the current slot, open a new tab. This will be used
when middle clicking the navigation buttons in the toolbar.
valign property of the widget responsible for the folder content was
set to GTK_ALIGN_START. This widget was moved to the top part of
the parent if this widget receives enough space. However, this
is not needed in this situation, since GridView already placing
folders and files from top to bottom. Also, the height of
the GridView was bounded by parent height and by some linear
function of the number of elements in a folder.
Changing valign will force the GridView to fill all allowed vertical space.
Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2301
It's possible that nautilus_clipbaord_from_string() receives an
empty string. When an empty string is received nautilus crashes
because g_str_equal() cannot handle the null value returned from
g_strsplit(). We could simply change g_str_equal() to g_strcmp0()
but that opens up the possibility for the for loop to give
unexpected results (it only checks for NULL starting at index=1).
Check if the results from g_strsplit()[0] == NULL and return early.