Commit graph

23518 commits

Author SHA1 Message Date
Jan Tojnar d47403bced docs: Switch to gi-docgen 2022-09-04 00:03:02 +01:00
Jan Tojnar a7fab868ca docs: remove docs for dropped APIs
These were removed in https://gitlab.gnome.org/GNOME/nautilus/-/merge_requests/927
2022-09-03 22:57:47 +00:00
Corey Berla 7c2297e799 sidebar: Make cloudproviders popover menu nested
libcloudproviders provides a menu_model that we use to build a
popover menu.  It's possible (and true for nextcloud) that these
menus can have sub-menus.  If the sub-menus have much longer
(or shorter) item names, the entire menu will get stretched out.
Use GTK_POPOVER_MENU_NESTED when creating the popover menu, creating
a nested menu which does not exhibit this issue.

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2405
2022-09-03 12:45:51 -07:00
Jürgen Benvenuti c0db5af46d Update German translation 2022-09-03 16:08:27 +00:00
Corey Berla a9214ba53e files-view-dnd: Improve filename generated from dropped text
Make several improvements:

1) Max filename was too long at 128 characters, half it to 64
2) Tweak min filename to 8 characters (still meaningful)
3) Stop at the first sentence rather than last sentence. A filename
should be short and concise, multiple sentences don't make sense.
4) Start at the start_sentence (i.e. eliminate leading whitespace)

Importantly this patch eliminates the potential inclusion of newlines
which is problematic in the views (it causes more than 3 lines of the
filename to appear because of the GtkLabel behavior).
2022-09-03 10:37:52 +00:00
António Fernandes 7700c17bb3 files-view: Add files in right order
When populating a GList in a loop, we should use prepend() for best
performance, then flip it around once with reverse().

The list of pending additions to files view lacks the second part.
This used to be compensated for by the old views:

  * NautilusCanvasView, through NautilusCanvasContainer, would iterate
    this list to populate its own list with prepend(), effectively
    reversing the order, as was necessary.
  * NautilusListView, through NautilusListModel, would iterate this
    list to populate its own list with insert_sorted(), once again
    fixing the loading order.

The new view don't do that, and have no reason to because they don't
have their own GLists (instead, they manage GListModels). But this
means that the item which should be added last actually is added first.
GtkListBase treats the first added item as the initial focus and as
scroll anchor. The end result is that the view always scrolls to the
bottom and, on keyboard focus, the last item is selected first.

The first issue (view always scrolls to the bottom) has been worked
around with a hack, but the second one persists.

Therefore, lets just reverse the list right after it is built. This
way, the first added item is the one actual first item. It gets initial
keyboard focus and anchors the view to the top (allowing to remove the
workaround).

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2353
2022-09-02 17:15:28 +01:00
Ignacy Kuchciński 47ee9eaf54 application: Adopt AdwApplication
Doing this allows us to automatically load stylesheets located in the
resource base path, so move contents of both Adwaita.css and
nautilus.css to style.css in the root of the resource directory, which
will be always automatically loaded.

Additionally, create a style-hc.css which will be used when the system
high contrast preference is enabled, and adjust it to fix issues with
NautilusPathBar.

Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2166
2022-09-01 23:35:15 +00:00
Corey Berla 1e06525a8d window-slot: Show the sharing infobar when for g-u-s fallback
Normally we show the Sharing info bar when we are in the
XDG_PUBLICSHARE_DIR (i.e. G_USER_DIRECTORY_PUBLIC_SHARE).
gnome-user-share has a fallback to ~/Public when the PUBLIC_SHARE
folder is set to the user's home directory.  Match the behavior
that g-u-s uses.

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2459
2022-09-01 22:37:47 +00:00
Goran Vidović 508cc438b8 Update Croatian translation 2022-09-01 22:35:39 +00:00
Corey Berla 5ca1960132 list-base: Check if item_widget is ready before setting focus
We use a hack to set the focus on the item when we set the selection.
Sometimes, the item_widget isn't ready by the time we are setting
the focus, which causes a seg fault.  This became even worse, when
I applied the focus hack more consistently in 2ac420316b

We should find a better solution, but in the meantime, let's stop
crashing.

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2400
2022-09-01 22:33:49 +00:00
António Fernandes 683a3d54ef audio-video-properties: Drop obsolete test program
The properties extension no longer creates a widget, so it's no
longer a simple task of packing that widget into a window.

We never use that test program anyway; manual testing can and
should be performed in the main application.
2022-09-01 22:20:55 +00:00
António Fernandes 83c2c6fdda test/interactive: Drop obsolete test
Originally introduced by 469047a2a5

It's been disabled because it relied on gtk_main* API, which is gone
in GTK4, but even after porting to GMainLoop API, it fails to work
because operations invoke GApplication inhibition.

In other words: I'm confident this test program has been broken for
years without anyone realizing it.

We already have automatic tests for copy operations. Manual testing
can be done with the nautilus application itself with debug messages
enabled.

So, let's just drop the broken obsolete test code.
2022-09-01 22:20:55 +00:00
António Fernandes 26e9da3ed6 progress-indicator: Fix attention-grabbing animation
Before the GTK 4 port, we had animation theatrics which showed an
expanding "aura" for the newly revealed button, together with a
glowing CSS animation.

Under GTK4 there is currently no available copylib for implementing
similar theatrics.

So, use only the CSS animation, make it simpler, and use accent
color to compensate for otherwise reduced attention-grabbing effect.
2022-09-01 22:20:55 +00:00
António Fernandes 9bcbe0c2f0 placessidebar: Don't unreferece the trash monitor
Using g_clear_object() we release a reference which we never aquired.

This causes crashes.

So, don't do that. And going a step futher: don't even keep a pointer
nor a singal id: just use g_signal_connect_object() and enjoy peace.
2022-09-01 23:09:29 +01:00
António Fernandes bf563f37e1 window: Don't finalize twice
The pad controller owns a reference to the window (as an action group)
and the window (as a widget) owns a reference to the pad controller.
This is a reference cycle.

Usually, reference cycles are resolved in dispose(), which can get
called multiple times. However, GTK removes the controllers during
finalize(). We end up calling finalize() recursively, which is a big
problem.

So our only option is to manually remove the controller before starting
the destruction of the window.
2022-09-01 23:09:29 +01:00
António Fernandes 0782b7cdd2 toolbar: Drop :window property
Toolbar holds a reference to the window, which owns the toolbar.

This reference cycle is problematic, so drop the property and just
peek the window by walking up the hierarchy.

Long term we should just dismantle NautilusToolbar completely, by
moving most logic to each their respective control and manage
everything from NautilusWindow.
2022-09-01 23:09:29 +01:00
António Fernandes 50e3f19587 toolbar: Restore transient location entry behavior
The focus semantics and API changed from GTK 3 to GTK 4.

Specifically, `has-focus` is no longer TRUE for containers of the
actual focus widget. Furthermore, the location entry itself, being
a GtkEntry, never has got focus itself: that's delegated to its
internal GtkText child.

The solution in GTK4 is to use GtkEventControllerFocus, which
provides the hierarchical focus logic we need.

Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2463
2022-09-01 23:09:29 +01:00
Corey Berla 3fa6d51d47 pathbar: Don't unparent unparented popover 2022-09-01 23:09:29 +01:00
Corey Berla 89f2c31757 list-base: Fix memory leaks for view_item and view
Results from nautilus_view_cell_get_view() and
nautilus_view_cell_get_item() need to be freed
2022-09-01 23:09:26 +01:00
Corey Berla a5694f90da list-base: Don't unnecessarily cast NAUTILUS_LIST_BASE 2022-09-01 23:07:58 +01:00
Corey Berla dbeab938cb dnd: Remove already removed code from headers 2022-09-01 21:42:41 +00:00
Corey Berla 4d9906b0bf files-view-dnd: Remove code for NETSCAPE_URL
This logic is handled within GtkDropTarget in gtk4.
2022-09-01 21:42:41 +00:00
Corey Berla 1aca129eb7 dnd: Allow GDK_ACTION_COPY within the same folder
We are setting the preferred action to 0 when the source and dest are
in the same folder.  This prevents the ability to hold CTRL and perform
a copy operation (which worked in 42).  It isn't clear why you can't
override a 0 preferred action with key modifiers.

In order to keep consistency, remove this check in
nautilus_dnd_get_preferred_action() and add it to
nautilus_files_view_drop_proxy_received_uris() (only if the action
is MOVE).

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2438
2022-09-01 21:42:41 +00:00
Corey Berla 96ff1710e4 files-view-dnd: Stop leaking container_uri 2022-09-01 21:42:41 +00:00
Corey Berla 2bed5adac4 list-base: Fix hotspot for DnD drag icon
We use a fixed size drag icon so we need to scale the drag icon
accordingly.  The hotspot doesn't make sense for listview,
and can produce very strange results, so simply set to 0,0.
2022-09-01 21:42:41 +00:00
Corey Berla 0a9f185593 dnd: Expose NAUTILUS_DRAG_SURFACE_ICON_SIZE 2022-09-01 21:42:41 +00:00
Corey Berla 381276be4a list-base: Move nautilus_list_base_get_icon_size() up for reuse 2022-09-01 21:42:41 +00:00
Corey Berla a6d2865de7 files-view: Add Unstar back to file context menu when in Starred folder
Now we have another way to star files (by DnD), but unstarring is
limitted to the properties window and the listview icon.  Add back
the ability to unstar from the files context menu only when in the
starred folder.
2022-09-01 21:42:41 +00:00
Corey Berla a88ad1e3e3 dnd: Allow dropping to starred directory 2022-09-01 21:42:41 +00:00
Corey Berla f8270f7313 file-operations: Allow starring files for COPY operations
If the operation is COPY and it's to the starred directory
simply star the files.  This allows us to DnD to starred.
2022-09-01 21:42:41 +00:00
Corey Berla 4d422bfdf9 list-base: Fix crash when checking preferred action 2022-09-01 21:42:41 +00:00
Corey Berla 2f0b87ffd3 window: Fix mistyped argument 2022-09-01 21:42:41 +00:00
Corey Berla ab80390f02 list-base: Allow dropping text to create text file
We already have the function in nautilus-files-view-dnd.
Allow dropping G_TYPE_STRING and call nautilus_files_view_handle_text_drop()
to generate the filename and create a text file.

This only worked in the main view in previous versions, so lets keep
that the same for simplicity.
2022-09-01 21:42:41 +00:00
Nathan Follens 18961912e8 Update Dutch translation 2022-09-01 15:56:15 +00:00
Sabri Ünal 5836889b2b Update Turkish translation 2022-09-01 15:53:43 +00:00
Christopher Davis 52f55829bc appdata: Update screenshots for GNOME 43 2022-09-01 14:26:26 +00:00
António Fernandes 278435e3c2 thumbnails: Create larger thumbnails for higher density displays 2022-09-01 12:23:06 +01:00
António Fernandes bf2b63569d dnd: Make it easier to identify pile of dragged thumbnails
Offset each picture 6 pixels in either direction.

Also have a stronger shadow, with same alpha as shadows in the view.
2022-09-01 12:23:06 +01:00
António Fernandes b0636ee2fa dnd: Drop excessive rounded clip
It's inconsistent with the view. The motivation was making it easier
to tell each thumbnail appart. But we are going to use another
solution to that problem.
2022-09-01 12:23:06 +01:00
António Fernandes 6708c4c375 file: Slightly soften thumbnail corners
Sharp corners give an unpolished feel to thumbnail.

We've been trying to give the illusion of round corners using shadows.

But now that we already use GtkSnapshot, properly clipping round
corners is too easy not to do it.
2022-09-01 12:23:06 +01:00
António Fernandes f236675f0f file: Drop "spacial file manager" leftovers
These flags were relevant when each folder opened in its own window,
such that the open folders would have a different icon. Also, we would
ignore that icon in properties.

Spacial nautilus has been gone for maybe 15 years now.
2022-09-01 12:23:06 +01:00
António Fernandes ee0500c035 properties: Use existing flag to get mount icon
Instead of duplicating the work here.

Also push "upstream" the root directory special case which was
recently added in commit 5722c39456.
2022-09-01 12:23:06 +01:00
António Fernandes d4c800362d icon-info: Add HiDPI support for custom icons too
The properties dialog provides the ability to set a custom icon.

These are not icon paintables, but rather loadable icons, just
like thumbnails are. Therefore, they need to be snapshot into
the real area too, otherwise they are going to be too large.
2022-09-01 12:23:06 +01:00
António Fernandes a9b1395662 general: Support HiDPI icons again
This brings back a feature originally introduced by commit 0d4555d76f

Back then, it used gdk_cairo_surface_create_from_pixbuf() to apply the
scaling factor, but in GTK 4 we can no longer consume cairo surfaces
directly. Instead, we are to use paintables.

For themed icons we already use GtkIconPaintable, which just works.
2022-09-01 12:23:06 +01:00
António Fernandes 86b8a43710 file: Scale down thumbnails using GtkSnapshot
We've also been scaling thumbnails down in advance using GdkPixbuf API,
and keeping a cache of scaled thumbnails.

But nowadays we can push that scaling job into the render nodes,
taking advantage of GPU. This is also a lot simpler.
2022-09-01 12:23:06 +01:00
António Fernandes acb74897f6 ui-utilities: Add filmholes using GdkSnapshot
This can take advantage of GPU and prepares for next changes.
2022-09-01 12:23:06 +01:00
António Fernandes 314fc335dc xicon-info: Take a paintables instead of pixbufs
This is more generic and is going to allow HiDPI icons and GPU usage.

GdkPixbuf can be easily converted into GdkTexture, which is a GdkPaintable.
2022-09-01 12:23:06 +01:00
António Fernandes 287299e56b file-conflict-dialog: Use GtkPicture instead of GtkImage for icons
Picture will automatically take the size of the paintable, while
Image defaults to 16px.

Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2432
2022-09-01 12:23:02 +01:00
António Fernandes 3c9a154a3e properties-window: Fix disproportionate icons
Thumbnails in Properties were sometimes larger than the requested size.

This is because we didn't pass the FORCE_THUMBNAIL_SIZE flag.

There were probably good reasons for this flag in the past, but there
are none now. If we request a size, that should be the size we get.

So, drop this flag entirely and default to forcing the size everywhere.
2022-09-01 09:28:40 +01:00
António Fernandes 735b6aae88 flatpak: Allow to talk with sushi over DBus
Otherwise, the previewing functionality doesn't work while sandboxed.
2022-09-01 08:58:57 +01:00