mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-06-30 23:46:35 +00:00
toolbar: Handle prompt for special locations
The last remaining direct interaction between NautilusWindow and the location entry are the location prompt actions. Let's do everything in the toolbar instead, to make it easy to reuse in the upcoming FileChooser dialog. Now the location entry is entirely private to the toolbar. Part of: https://gitlab.gnome.org/GNOME/nautilus/-/work_items/3431
This commit is contained in:
parent
c908c94108
commit
7360be440a
|
@ -112,7 +112,8 @@ toolbar_update_appearance (NautilusToolbar *self)
|
|||
}
|
||||
|
||||
void
|
||||
nautilus_toolbar_open_location_entry (NautilusToolbar *self)
|
||||
nautilus_toolbar_open_location_entry (NautilusToolbar *self,
|
||||
const char *special_text)
|
||||
{
|
||||
if (self->show_location_entry)
|
||||
{
|
||||
|
@ -129,6 +130,13 @@ nautilus_toolbar_open_location_entry (NautilusToolbar *self)
|
|||
toolbar_update_appearance (self);
|
||||
|
||||
gtk_widget_grab_focus (self->location_entry);
|
||||
|
||||
if (special_text != NULL)
|
||||
{
|
||||
nautilus_location_entry_set_special_text (NAUTILUS_LOCATION_ENTRY (self->location_entry),
|
||||
special_text);
|
||||
gtk_editable_set_position (GTK_EDITABLE (self->location_entry), -1);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -410,12 +418,6 @@ nautilus_toolbar_get_path_bar (NautilusToolbar *self)
|
|||
return self->path_bar;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
nautilus_toolbar_get_location_entry (NautilusToolbar *self)
|
||||
{
|
||||
return self->location_entry;
|
||||
}
|
||||
|
||||
static void
|
||||
box_remove_all_children (GtkBox *box)
|
||||
{
|
||||
|
|
|
@ -37,9 +37,9 @@ G_DECLARE_FINAL_TYPE (NautilusToolbar, nautilus_toolbar, NAUTILUS, TOOLBAR, AdwB
|
|||
GtkWidget *nautilus_toolbar_new (void);
|
||||
|
||||
GtkWidget *nautilus_toolbar_get_path_bar (NautilusToolbar *self);
|
||||
GtkWidget *nautilus_toolbar_get_location_entry (NautilusToolbar *self);
|
||||
|
||||
void nautilus_toolbar_open_location_entry (NautilusToolbar *self);
|
||||
void nautilus_toolbar_open_location_entry (NautilusToolbar *self,
|
||||
const char *special_text);
|
||||
|
||||
void nautilus_toolbar_set_active_slot (NautilusToolbar *toolbar,
|
||||
NautilusWindowSlot *slot);
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "nautilus-file-undo-manager.h"
|
||||
#include "nautilus-file-utilities.h"
|
||||
#include "nautilus-global-preferences.h"
|
||||
#include "nautilus-location-entry.h"
|
||||
#include "nautilus-metadata.h"
|
||||
#include "nautilus-network-address-bar.h"
|
||||
#include "nautilus-mime-actions.h"
|
||||
|
@ -74,7 +73,6 @@ static void mouse_back_button_changed (gpointer callback_data);
|
|||
static void mouse_forward_button_changed (gpointer callback_data);
|
||||
static void use_extra_mouse_buttons_changed (gpointer callback_data);
|
||||
static void nautilus_window_initialize_actions (NautilusWindow *window);
|
||||
static GtkWidget *nautilus_window_ensure_location_entry (NautilusWindow *window);
|
||||
static void nautilus_window_back_or_forward (NautilusWindow *window,
|
||||
gboolean back,
|
||||
guint distance);
|
||||
|
@ -294,9 +292,9 @@ action_enter_location (GSimpleAction *action,
|
|||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
NautilusWindow *window = user_data;
|
||||
NautilusWindow *self = user_data;
|
||||
|
||||
nautilus_window_ensure_location_entry (window);
|
||||
nautilus_toolbar_open_location_entry (NAUTILUS_TOOLBAR (self->toolbar), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -338,24 +336,14 @@ action_go_to_tab (GSimpleAction *action,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
prompt_for_location (NautilusWindow *window,
|
||||
const char *path)
|
||||
{
|
||||
GtkWidget *entry;
|
||||
|
||||
entry = nautilus_window_ensure_location_entry (window);
|
||||
nautilus_location_entry_set_special_text (NAUTILUS_LOCATION_ENTRY (entry),
|
||||
path);
|
||||
gtk_editable_set_position (GTK_EDITABLE (entry), -1);
|
||||
}
|
||||
|
||||
static void
|
||||
action_prompt_for_location_root (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
prompt_for_location (NAUTILUS_WINDOW (user_data), "/");
|
||||
NautilusWindow *self = NAUTILUS_WINDOW (user_data);
|
||||
|
||||
nautilus_toolbar_open_location_entry (NAUTILUS_TOOLBAR (self->toolbar), "/");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -363,7 +351,9 @@ action_prompt_for_location_home (GSimpleAction *action,
|
|||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
prompt_for_location (NAUTILUS_WINDOW (user_data), "~");
|
||||
NautilusWindow *self = NAUTILUS_WINDOW (user_data);
|
||||
|
||||
nautilus_toolbar_open_location_entry (NAUTILUS_TOOLBAR (self->toolbar), "~");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1014,18 +1004,6 @@ nautilus_window_sync_location_widgets (NautilusWindow *window)
|
|||
nautilus_window_sync_starred (window);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
nautilus_window_ensure_location_entry (NautilusWindow *window)
|
||||
{
|
||||
GtkWidget *location_entry;
|
||||
|
||||
nautilus_toolbar_open_location_entry (NAUTILUS_TOOLBAR (window->toolbar));
|
||||
|
||||
location_entry = nautilus_toolbar_get_location_entry (NAUTILUS_TOOLBAR (window->toolbar));
|
||||
|
||||
return location_entry;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
toast_undo_deleted_get_label (NautilusFileUndoInfo *undo_info)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user