summaryrefslogtreecommitdiff
path: root/src/nautilus-window.c
Commit message (Collapse)AuthorAgeFilesLines
* window: Dismiss previous undo toast when undo action has changedCorey Berla2023-04-211-0/+8
| | | | | | | | | | | | | | | | We present a new toast every time the undo action changed which is confusing because you might have several undo toasts appearing over each other. To complicate matters, the previous undo toasts lie (undo'ing would actually undo a different action). There was a proposal in #2350 to batch undo toasts, but that's problematic because our undo manager is designed to undo exactly 1 action, we do not have an undo stack. The more straightforward solution seems to be simply dismissing the old undo toasts, when we popup a new undo toast. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2350
* window: Initialize drag action for tab barOndrej Holy2023-03-291-16/+10
| | | | | | | The `‘action’ may be used uninitialized` warning is shown during build currently. It can really happen that uninitialized value is used when dropping something else then the `GDK_TYPE_FILE_LIST` and `G_TYPE_STRING` on the tab bar. Let's initialize the action to prevent this.
* dnd: Don't handle drops without urisPeter Eisenmann2023-01-231-3/+1
| | | | | | | | | | Add a check to assert nautilus_files_view_drop_proxy_received_uris is not called with an empty source uri list. Make nautilus_dnd_perform_drop return whether the drop event was actually handled. Adjust callers accordingly. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2787
* window: Reset actions when tab menu is closedCorey Berla2023-01-101-8/+8
| | | | | | | In some cases, an action that was disabled when opening the tab menu might stay disabled when you close the tab menu because of an early return. Make sure to reenable all of the actions when the tab menu is closed.
* window: Add drop targets back to tabsCorey Berla2023-01-091-0/+72
| | | | | | | | | With the introduction of ::extra-drag-value in AdwTabBar, we can now dynamically set the preferred action on the AdwTabBar. Use the "extra" drop target on the AdwTabBar, and use our existing code making this fairly simple. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2495
* window: Add restore closed tab to tab menuCorey Berla2023-01-091-0/+5
| | | | Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1620
* window: Add detach tab menu optionCorey Berla2023-01-091-0/+13
|
* window: Add close-other-tabs actionCorey Berla2023-01-091-0/+12
| | | | | Add the ability from the tab menu to close all other tabs.
* window: Make new tabs use location from menu tab or current tabCorey Berla2023-01-091-1/+3
| | | | | | New tabs are always taking the location of the current tab even if the new tab was generated from a non-current tab using the tab bar context menu.
* window: Open new tabs relative to the context menu tabCorey Berla2023-01-091-1/+1
| | | | | | New tabs open up relative to the selected tab. Make new tabs open up relative to the tab in which the context menu was opened if applicable (otherwise open relative to the selected tab)
* window: tab_view_setup_menu_cb stop setting incorrect actionsCorey Berla2023-01-091-5/+7
| | | | | | | | This isn't a problem now but would cause problems with the following commits Return early so we don't set incorrect actions when the callback passes a NULL page on close.
* window: Refactor tab code for re-useCorey Berla2023-01-091-18/+14
| | | | | Refactoring existing code to simplify, this will help with the following commits. No logical or functional changes.
* window: Remove view-menu actionCorey Berla2023-01-091-14/+0
| | | | Use of this action was removed in 4ca63d19eb3e522eea54a92c0f479911e2a17f4a
* nautilus-window: Fix window maximized notify signalGary Li2022-12-281-1/+1
| | | | | | | | | | | | Nautilus does not persist the window maximized state. This is because we are listening to the property is-maximized for change, which is now maximized in GTK4. https://docs.gtk.org/gtk4/property.Window.maximized.html Use notify::maximized instead of notify::is-maximized. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2682
* nautilus-window: do not override last_location for root promptGary Li2022-12-261-14/+13
| | | | | | | | | | | | | Currently, nautilus_location_entry_cancel uses the last_location GFile to reset the location entry path if the user cancels. However, the root prompt immediately overrides last_location by setting the location to "/", which results in the user always seeing "/" even if they cancel location bar entry then use CTRL-L to check current path. To fix this, use the same logic as the home prompt, which only sets the entry text. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2249
* window: Avoid crash when closing windowAntónio Fernandes2022-12-231-4/+12
| | | | | | | | | | | | | | We remove the pad controller before calling gtk_window_destroy() to break a dependency cycle. However, if for some reason the controller has already been removed by the time we reach that part of our code, we access a pointer to and already destroyed object. Try to avoid this with a weak pointer, such that we skip the step if the pointer is already NULL. Presumably fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2572
* general: Replace GtkStyleContext with GtkWidget functionsCorey Berla2022-12-191-2/+1
| | | | | | | GtkStyleContext is deprecated in 4.10, use the corresponding GtkWidget functions. Also bump GTK version to use the new gtk_widget_get_color().
* window: Disconnect NautilusBookmarkList "changed" signal on window destructionCorey Berla2022-12-151-3/+4
| | | | | | Use g_signal_connect_object to automatically disconnect the signal Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2548
* about: Add support-urlHari Rana2022-11-241-0/+1
| | | | This adds a support URL to the Nautilus forums for easier access to ask questions
* window: Don't finalize twiceAntónio Fernandes2022-09-011-4/+18
| | | | | | | | | | | | | | 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.
* toolbar: Drop :window propertyAntónio Fernandes2022-09-011-3/+0
| | | | | | | | | | | 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.
* window: Fix mistyped argumentCorey Berla2022-09-011-3/+3
|
* window: Change toast title "deleted" to "moved to trash"Gotam Gorabh2022-08-101-1/+1
| | | | | | Consistent with the context menu "Move to Trash" label. Fixes #2360
* window: Use bindings to manage toolbar slotChristopher Davis2022-07-311-2/+0
|
* window: Make active-slot a propertyChristopher Davis2022-07-311-0/+67
| | | | | This will make managing the toolbars and child widgets easier.
* window: Close window when closing last tabChristopher Davis2022-07-301-0/+6
| | | | | | | | Prevents a crash from trying to update the selected page after the last page is closed. Instead of letting the code progress to that point, we simply check for the number of pages and close the window at the right point.
* window: Port to AdwTabView and AdwTabBarAlexander Mikhaylenko2022-07-301-187/+163
| | | | | | | | | | | | | | | | | | | They are better fit than GtkNotebook for our use cases and provide more features and better visuals. Also, they include DND support for switching tabs on hover. There is a small regression: files can no longer be dropped in the tab itself; this is because on one hand the AdwTabBar extra drop API is too limiting for our needs (it lacks a means to check the value before drop to pick a preferred action), and on the other hand our new DND code is too new and our needs might change, so we shouldn't be asking for more API yet. With this we also reenable detachable tabs. Closes https://gitlab.gnome.org/GNOME/nautilus/-/issues/615 (Rebased and amended by António Fernandes and Christopher Davis)
* window: Remove "dnd-window-slot" hackAntónio Fernandes2022-07-301-11/+5
| | | | | | | | | | | | | | | | | | | When a tab is moved into another window, we must remove the slot from the old window. Currently, we do this conditionally in `GtkNotebook::page-removed`. The condition we use is a hack: we check for a boolean set as data. This hack is wrong because it catches only the cases when a tab is detached into a new window, not when it's detached and attached to an already existing window. So, instead, we can use a simpler condition: check whether the slot has been removed from the slots list already. This way we can drop the hack. (Note: tab detaching is currently disabled, but this is a preparation to reenable it after porting to AdwTabView.)
* window: Refine slot removal codeAntónio Fernandes2022-07-301-35/+15
| | | | | | | | | | `clost_slot()` does not necessarily closes the tab. This happens only if the 3rd parameter is TRUE. This is misleading. Now that there is only 1 case where the 3rd parameter is TRUE, let's extract the tab-closing part out and rename the function accordingly. Also, swap its parameters in order to make it `g_list_foreach()`-able.
* window: Simplify slot cleanupAntónio Fernandes2022-07-301-25/+3
| | | | | | | | | We currently rely on sorting the list of slots in order to close the active slot last when disposing of a window. But the bug this works around only happens because we are actually closing the tabs too. That's not necessary: widgets are going to be destroyed later anyway along with their parents.
* window: Add slot in a single pathAntónio Fernandes2022-07-301-17/+0
| | | | | | | | | | | | | | | | | | | | | | Currently, we add a slot to the window in 2 situations: 1. When a new slot is created (`nautilus_window_initialize_slot()`); 2. When a slot moves to another window (`notebook_page_added_cb()`). However, `GtkNotebook::page-added` triggers in both cases, so we use a hack with g_object_set_data() to know whether it happened by DND. This hack is wrong because it catches only the cases when a tab is detached into a new window, not when it's detached and attached to an already existing window. Fortunately, `nautilus_window_initialize_slot()` already calls `nautilus_notebook_add_tab()`, which is going to cause an emission of `GtkNotebook::page-added`. Therefore, we can simply add the slot unconditionally and exclusively in `notebook_page_added_cb()`. (Note, tab detaching is currently disabled, but this is a preparation to reenable it after porting to AdwTabView.)
* window: Don't create slot on constructionAntónio Fernandes2022-07-301-14/+0
| | | | | | | | | | | | | | | | | | | | | | We create a view-less slot when the new window is constructed. This is undesirable if the new window was created by detaching a tab, because we already have got a slot (the one being detached); as a workaround, we currently use a g_object_set_data() hack to close the undesired tab. But even in the other cases, this is entirely unnecessary, because `nautilus_window_open_location_full()` creates the slot on demand! So, let's just not create a slot on construction and wait for either the detached tab or the open location. Contrary to what an old comment states, the list of slots, and the active_slot weak pointer can be NULL, as we perform NULL-checks everywhere for them already. (Note, tab detaching is currently disabled, but this is a preparation to reenable it after porting to AdwTabView.)
* general: Remove tab position settingChristopher Davis2022-07-301-13/+1
| | | | | | | | | | | | | | | | | This hidden setting was added back when tabs were introduced in commit 07cf7db47fd5fae64201f1cff73e39fd8aed2f54 That commit provides no motivation for this setting, and neither does the bug it references: https://bugzilla.gnome.org/show_bug.cgi?id=48034 The same commit added a "tabs_enable" setting too, so it's fair assume this setting doesn't solve any problem, it was just a trend of older times to make everything configurable. Let's remove the setting and assume the default behavior. Also remove the related NAUTILUS_OPEN_FLAG_SLOT_APPEND flag. (Diff and message amended by António Fernandes<antoniof@gnome.org>)
* window: Add debug-info property to AdwAboutPageCorey Berla2022-07-201-0/+17
| | | | | Put a list of currently installed extensions in debug-info. This shows up under Troubleshooting in the about page.
* window: Add helper to open new tab from a back / forward selectionCorey Berla2022-07-161-0/+48
| | | | | | 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.
* general: GtkPaned -> AdwFlapChristopher Davis2022-07-111-66/+23
| | | | | | | | | | | Exchange the adjustable GtkPaned widget for AdwFlap. We lose a resizable sidebar, but gain an adaptive one. For windows narrower than 600px, we fold the sidebar. The loss of the resizable sidebar means that all settings related to it are removed. Fixes #2156
* general: Always show sidebarChristopher Davis2022-07-111-32/+0
| | | | | | Always show the sidebar, and remove the setting to hide it. We are going to introduce a replacement next commit: AdwFlap.
* window: Use NautilusGtkPlacesSidebar directlyChristopher Davis2022-07-091-15/+6
| | | | | Get rid of the middleman; Use `g_type_ensure()` to initialize the type.
* window: Port about to AdwAboutWindowChristopher Davis2022-07-091-15/+9
|
* general: Fix typo in nautilus_dnd_get_preferred_action()Corey Berla2022-07-071-1/+1
|
* window: Enable signals for DND to sidebar and cleanup DND code for gtk4Corey Berla2022-07-021-69/+9
| | | | Remove old components such as GdkDragContext. Reenable signals for DND.
* window: Remove unused DND codeCorey Berla2022-07-021-22/+0
|
* window: Remove unused header inclusionAntónio Fernandes2022-05-251-1/+0
|
* window: Remove unused code for sidebarCorey Berla2022-05-021-43/+0
| | | | Remove code that now exists in src/gtk/nautilusgtkplacessidebar.c
* sidebar: Implement format volume actionCorey Berla2022-05-021-78/+0
| | | | | | | | | The format volume action needs to be re-implemented for GTK4. Move the existing code from nautilus-window to nautilusgtkplacessidebar and necessary tweaks. Drop --xid flag for gnome-disks command as that has been ignored by gnome-disks since version 40.beta https://gitlab.gnome.org/GNOME/gnome-disk-utility/-/commit/9f6571532c6b6f9c78f0ec4ce47ec3d0b178dba7
* sidebar: Restore "Empty Trash..." menu itemCorey Berla2022-05-021-35/+0
| | | | Also add Properties menu item to the Trash row context menu too.
* sidebar: Restore "Properties" menu itemCorey Berla2022-05-021-35/+0
| | | | | | | | With the changes for GTK4, the sidebar items no longer have support for populating the context menus with additional items. Add a Properties action directly in the sidebar, by moving and adapting code from NautilusWindow.
* window: Fix crash when opening new window from pathbarCorey Berla2022-04-151-1/+9
| | | | | | | | | | | Changes as part of commit 022867e3d3370560f2c6c07f90ad5fdfd7916d50 switched the handler of the pathbar signal. The new handler raises an exception for NAUTILUS_OPEN_FLAG_NEW_WINDOW. Use nautilus_application API should be used when handling new windows. Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2208
* window: Use AdwToastOverlay and AdwToastChristopher Davis2022-03-221-190/+41
| | | | | | | | | | | AdwToastOverlay is the new recommended widget for the in-app notification pattern. Instead of using GtkFrame and the old pattern, we can use this instead. AdwToast's API uses GActions, so I added an action for opening `folder_to_open`. Closes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2104
* window: Attach tab context menu to the tabAntónio Fernandes2022-02-121-11/+15
| | | | | | | | | | | Due to GtkPopover now being a child of the window, instead of setting an attach widget we need to pass it the allocation of the tab, with the origin coordinates translated to the window coordinate space. Also use double instead of int when appropriate and replace GdkEvent usage with event controller method to get modifier status. Closes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2101