This commit is contained in:
António Fernandes 2024-06-24 13:26:03 +01:00
parent 98296d71cc
commit e73a8e88ec
2 changed files with 28 additions and 20 deletions

View file

@ -173,22 +173,10 @@ selector_can_accept (NautilusFileChooser *self,
static void
emit_accepted (NautilusFileChooser *self,
GList *files)
GList *file_locations)
{
g_autolist (GFile) file_locations = NULL;
gboolean writable = !gtk_check_button_get_active (GTK_CHECK_BUTTON (self->read_only_checkbox));
if (files != NULL)
{
file_locations = g_list_copy_deep (files, (GCopyFunc) nautilus_file_get_activation_location, NULL);
}
else
{
GFile *location = nautilus_window_slot_get_location (self->slot);
file_locations = g_list_prepend (NULL, g_object_ref (location));
}
g_signal_emit (self, signals[SIGNAL_ACCEPTED], 0,
file_locations,
GTK_FILE_FILTER (gtk_drop_down_get_selected_item (self->filters_dropdown)),
@ -213,13 +201,24 @@ on_selector_accept_button_clicked (NautilusFileChooser *self)
{
GList *selection = nautilus_window_slot_get_selection (self->slot);
if (mode_can_accept_files (self->mode, selection))
if (self->mode == NAUTILUS_MODE_SAVE_FILE)
{
emit_accepted (self, selection);
/* TODO */
}
else
{
emit_accepted (self, NULL);
if (mode_can_accept_files (self->mode, selection))
{
g_autolist (GFile) file_locations = g_list_copy_deep (selection, (GCopyFunc) nautilus_file_get_activation_location, NULL);
emit_accepted (self, file_locations);
}
else
{
GFile *location = nautilus_window_slot_get_location (self->slot);
emit_accepted (self, &(GList){ .data = location });
}
}
}
@ -243,7 +242,16 @@ on_slot_activate_files (NautilusFileChooser *self,
{
if (mode_can_accept_files (self->mode, files))
{
emit_accepted (self, files);
if (self->mode == NAUTILUS_MODE_SAVE_FILE)
{
/* TODO */
}
else
{
g_autolist (GFile) file_locations = g_list_copy_deep (files, (GCopyFunc) nautilus_file_get_activation_location, NULL);
emit_accepted (self, file_locations);
}
}
}

View file

@ -6,9 +6,6 @@
<property name="height-request">348</property>
<property name="default-width">890</property>
<property name="default-height">550</property>
<style>
<class name="view"/>
</style>
<child>
<object class="NautilusShortcutManager">
<property name="child">
@ -21,6 +18,9 @@
<property name="max-sidebar-width">240</property>
<property name="sidebar-width-unit">px</property>
<property name="sidebar-width-fraction">0.2</property>
<style>
<class name="view"/>
</style>
<property name="sidebar">
<object class="AdwToolbarView">
<child type="top">