1
0
mirror of https://gitlab.gnome.org/GNOME/nautilus synced 2024-06-30 23:46:35 +00:00

window-slot: Import open-location action

This will allow the network address bar to use on the upcoming
FileChooser window.

Part of https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3413
This commit is contained in:
António Fernandes 2024-06-10 11:42:07 +01:00
parent 83d595afa3
commit 38055570b3
3 changed files with 14 additions and 16 deletions

View File

@ -123,7 +123,7 @@ server_mount_ready_cb (GObject *source_file,
}
gtk_widget_activate_action (GTK_WIDGET (self),
"win.open-location", "s", uri_to_open);
"slot.open-location", "s", uri_to_open);
}
}
}

View File

@ -950,6 +950,17 @@ update_back_forward_actions (NautilusWindowSlot *self)
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
}
static void
action_open_location (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
NautilusWindowSlot *self = NAUTILUS_WINDOW_SLOT (user_data);
g_autoptr (GFile) location = g_file_new_for_uri (g_variant_get_string (state, NULL));
nautilus_window_slot_open_location_full (self, location, NAUTILUS_OPEN_FLAG_NORMAL, NULL);
}
static void
action_back (GSimpleAction *action,
GVariant *state,
@ -1196,6 +1207,7 @@ action_stop (GSimpleAction *action,
const GActionEntry slot_entries[] =
{
{ .name = "open-location", .activate = action_open_location, .parameter_type = "s" },
{ .name = "back", .activate = action_back },
{ .name = "forward", .activate = action_forward },
{ .name = "back-n", .activate = action_back_n, .parameter_type = "u" },

View File

@ -385,19 +385,6 @@ action_show_current_location_menu (GSimpleAction *action,
nautilus_toolbar_show_current_location_menu (NAUTILUS_TOOLBAR (self->toolbar));
}
static void
action_open_location (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
NautilusWindow *window = NAUTILUS_WINDOW (user_data);
g_autoptr (GFile) folder_to_open = NULL;
folder_to_open = g_file_new_for_uri (g_variant_get_string (state, NULL));
nautilus_window_open_location_full (window, folder_to_open, 0, NULL, NULL);
}
static void
on_location_changed (NautilusWindow *window)
{
@ -1116,7 +1103,7 @@ nautilus_window_show_operation_notification (NautilusWindow *window,
button_label = g_strdup_printf (_("Open %s"),
nautilus_file_get_display_name (folder));
adw_toast_set_button_label (toast, button_label);
adw_toast_set_action_name (toast, "win.open-location");
adw_toast_set_action_name (toast, "slot.open-location");
adw_toast_set_action_target_value (toast, target);
}
@ -1264,7 +1251,6 @@ extra_drag_drop_cb (AdwTabBar *self,
const GActionEntry win_entries[] =
{
{ .name = "current-location-menu", .activate = action_show_current_location_menu },
{ .name = "open-location", .activate = action_open_location, .parameter_type = "s" },
{ .name = "new-tab", .activate = action_new_tab },
{ .name = "enter-location", .activate = action_enter_location },
{ .name = "bookmark-current-location", .activate = action_bookmark_current_location },