mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-06-30 23:46:35 +00:00
window-slot: Import go up and down actions
To make them reusable in the upcoming FileChooser window. Part of https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3413
This commit is contained in:
parent
2d6f4b8280
commit
da4dd182a1
|
@ -150,6 +150,7 @@ static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
|
|||
|
||||
static const GtkPadActionEntry pad_actions[] =
|
||||
{
|
||||
{ GTK_PAD_ACTION_BUTTON, 3, -1, N_("Parent folder"), "up" },
|
||||
{ GTK_PAD_ACTION_BUTTON, 4, -1, N_("Back"), "back" },
|
||||
{ GTK_PAD_ACTION_BUTTON, 5, -1, N_("Forward"), "forward" },
|
||||
};
|
||||
|
@ -170,6 +171,8 @@ static void nautilus_window_slot_set_location (NautilusWindowSlot *self,
|
|||
static void nautilus_window_slot_set_viewed_file (NautilusWindowSlot *self,
|
||||
NautilusFile *file);
|
||||
static void update_search_information (NautilusWindowSlot *self);
|
||||
static void nautilus_window_slot_go_up (NautilusWindowSlot *self);
|
||||
static void nautilus_window_slot_go_down (NautilusWindowSlot *self);
|
||||
|
||||
void
|
||||
free_navigation_state (gpointer data)
|
||||
|
@ -942,6 +945,26 @@ action_forward_n (GSimpleAction *action,
|
|||
nautilus_window_slot_back_or_forward (self, FALSE, g_variant_get_uint32 (parameter));
|
||||
}
|
||||
|
||||
static void
|
||||
action_up (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
NautilusWindowSlot *self = NAUTILUS_WINDOW_SLOT (user_data);
|
||||
|
||||
nautilus_window_slot_go_up (self);
|
||||
}
|
||||
|
||||
static void
|
||||
action_down (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
NautilusWindowSlot *self = NAUTILUS_WINDOW_SLOT (user_data);
|
||||
|
||||
nautilus_window_slot_go_down (self);
|
||||
}
|
||||
|
||||
static void
|
||||
action_focus_search (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
|
@ -1132,6 +1155,8 @@ const GActionEntry slot_entries[] =
|
|||
{ .name = "forward", .activate = action_forward },
|
||||
{ .name = "back-n", .activate = action_back_n, .parameter_type = "u" },
|
||||
{ .name = "forward-n", .activate = action_forward_n, .parameter_type = "u" },
|
||||
{ .name = "up", .activate = action_up },
|
||||
{ .name = "down", .activate = action_down },
|
||||
{
|
||||
.name = "files-view-mode", .parameter_type = "u",
|
||||
.state = "uint32 " G_STRINGIFY (NAUTILUS_VIEW_INVALID_ID),
|
||||
|
@ -1259,6 +1284,8 @@ nautilus_window_slot_init (NautilusWindowSlot *self)
|
|||
ADD_SHORTCUT_FOR_ACTION (self->shortcuts, "slot.search-global", "<control><shift>f");
|
||||
ADD_SHORTCUT_FOR_ACTION (self->shortcuts, "slot.reload", "F5|<ctrl>r|Refresh|Reload");
|
||||
ADD_SHORTCUT_FOR_ACTION (self->shortcuts, "slot.stop", "Stop");
|
||||
ADD_SHORTCUT_FOR_ACTION (self->shortcuts, "slot.up", "<alt>Up");
|
||||
ADD_SHORTCUT_FOR_ACTION (self->shortcuts, "slot.down", "<alt>Down");
|
||||
|
||||
#undef ADD_SHORTCUT_FOR_ACTION
|
||||
|
||||
|
@ -3265,7 +3292,7 @@ nautilus_window_slot_get_query_editor (NautilusWindowSlot *self)
|
|||
return self->query_editor;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
nautilus_window_slot_go_up (NautilusWindowSlot *self)
|
||||
{
|
||||
GFile *location = nautilus_window_slot_get_location (self);
|
||||
|
@ -3287,7 +3314,7 @@ nautilus_window_slot_go_up (NautilusWindowSlot *self)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
nautilus_window_slot_go_down (NautilusWindowSlot *self)
|
||||
{
|
||||
g_autolist (GFile) down_list = g_steal_pointer (&self->down_list);
|
||||
|
|
|
@ -115,7 +115,4 @@ void nautilus_window_slot_back_or_forward (NautilusWindowSlot *
|
|||
gboolean back,
|
||||
guint distance);
|
||||
|
||||
void nautilus_window_slot_go_up (NautilusWindowSlot *slot);
|
||||
void nautilus_window_slot_go_down (NautilusWindowSlot *slot);
|
||||
|
||||
void free_navigation_state (gpointer data);
|
||||
|
|
|
@ -156,10 +156,9 @@ static GParamSpec *properties[N_PROPS];
|
|||
|
||||
static const GtkPadActionEntry pad_actions[] =
|
||||
{
|
||||
{ GTK_PAD_ACTION_BUTTON, 0, -1, N_("Parent folder"), "up" },
|
||||
{ GTK_PAD_ACTION_BUTTON, 1, -1, N_("Home"), "go-home" },
|
||||
{ GTK_PAD_ACTION_BUTTON, 2, -1, N_("New tab"), "new-tab" },
|
||||
{ GTK_PAD_ACTION_BUTTON, 3, -1, N_("Close current view"), "close-current-view" },
|
||||
{ GTK_PAD_ACTION_BUTTON, 0, -1, N_("Home"), "go-home" },
|
||||
{ GTK_PAD_ACTION_BUTTON, 1, -1, N_("New tab"), "new-tab" },
|
||||
{ GTK_PAD_ACTION_BUTTON, 2, -1, N_("Close current view"), "close-current-view" },
|
||||
/* Button number sequence continues in window-slot.c */
|
||||
};
|
||||
|
||||
|
@ -232,32 +231,6 @@ action_go_starred (GSimpleAction *action,
|
|||
nautilus_window_open_location_full (window, starred, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
action_up (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
NautilusWindowSlot *slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (user_data));
|
||||
|
||||
if (slot != NULL)
|
||||
{
|
||||
nautilus_window_slot_go_up (slot);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
action_down (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
NautilusWindowSlot *slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW (user_data));
|
||||
|
||||
if (slot != NULL)
|
||||
{
|
||||
nautilus_window_slot_go_down (slot);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
action_bookmark_current_location (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
|
@ -1530,8 +1503,6 @@ extra_drag_drop_cb (AdwTabBar *self,
|
|||
|
||||
const GActionEntry win_entries[] =
|
||||
{
|
||||
{ .name = "up", .activate = action_up },
|
||||
{ .name = "down", .activate = action_down },
|
||||
{ .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 },
|
||||
|
@ -1580,8 +1551,6 @@ nautilus_window_initialize_actions (NautilusWindow *window)
|
|||
nautilus_application_set_accelerator (app, "win.redo", "<shift><control>z");
|
||||
/* Only accessible by shorcuts */
|
||||
nautilus_application_set_accelerators (app, "win.bookmark-current-location", ACCELS ("<control>d", "AddFavorite"));
|
||||
nautilus_application_set_accelerator (app, "win.up", "<alt>Up");
|
||||
nautilus_application_set_accelerator (app, "win.down", "<alt>Down");
|
||||
nautilus_application_set_accelerators (app, "win.go-home", ACCELS ("<alt>Home", "HomePage", "Start"));
|
||||
nautilus_application_set_accelerator (app, "win.go-starred", "Favorites");
|
||||
nautilus_application_set_accelerator (app, "win.tab-move-left", "<shift><control>Page_Up");
|
||||
|
|
|
@ -193,7 +193,7 @@
|
|||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="title" translatable="yes" context="shortcut window">Go Up</property>
|
||||
<property name="action-name">win.up</property>
|
||||
<property name="accelerator"><alt>Up</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
|
Loading…
Reference in New Issue
Block a user