Commit 675ad5e9 authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson
Browse files

Don't send slash to typeahead

2005-10-18  Alexander Larsson  <alexl@redhat.com>

	* libnautilus-private/nautilus-icon-container.c: (key_press_event):
	Don't send slash to typeahead

	* src/nautilus-location-dialog.[ch]:
	Add nautilus_location_dialog_set_location.

	* src/nautilus-navigation-window-menus.c:
	* src/nautilus-navigation-window.c:
	* src/nautilus-spatial-window.c:
	* src/nautilus-window.[ch]:
	Open location dialog/entry when you press '/'.
parent 627737fb
2005-10-18 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-icon-container.c: (key_press_event):
Don't send slash to typeahead
* src/nautilus-location-dialog.[ch]:
Add nautilus_location_dialog_set_location.
* src/nautilus-navigation-window-menus.c:
* src/nautilus-navigation-window.c:
* src/nautilus-spatial-window.c:
* src/nautilus-window.[ch]:
Open location dialog/entry when you press '/'.
2005-10-18 Alexander Larsson <alexl@redhat.com>
* src/file-manager/fm-list-view.c:
......
......@@ -4205,7 +4205,8 @@ key_press_event (GtkWidget *widget,
/* We pass the event to the search_entry. If its text changes, then we
* start the typeahead find capabilities.
* Copied from NautilusIconContainer */
if (!handled) {
if (!handled &&
event->keyval != GDK_slash /* don't steal slash key event, used for "go to" */) {
GdkEvent *new_event;
char *old_text;
const char *new_text;
......
......@@ -201,7 +201,7 @@ nautilus_location_dialog_new (NautilusWindow *window)
location = nautilus_window_get_location (window);
if (location != NULL) {
if(NAUTILUS_IS_DESKTOP_WINDOW (window)) {
if (NAUTILUS_IS_DESKTOP_WINDOW (window)) {
formatted_location = nautilus_get_desktop_directory ();
} else {
formatted_location = eel_format_uri_for_display (location);
......@@ -212,6 +212,17 @@ nautilus_location_dialog_new (NautilusWindow *window)
g_free (formatted_location);
g_free (location);
}
gtk_widget_grab_focus (NAUTILUS_LOCATION_DIALOG (dialog)->details->entry);
return dialog;
}
void
nautilus_location_dialog_set_location (NautilusLocationDialog *dialog,
const char *location)
{
nautilus_entry_set_text (NAUTILUS_ENTRY (NAUTILUS_LOCATION_DIALOG (dialog)->details->entry), location);
gtk_editable_select_region (GTK_EDITABLE (NAUTILUS_LOCATION_DIALOG (dialog)->details->entry), 0, 0);
gtk_editable_set_position (GTK_EDITABLE (NAUTILUS_LOCATION_DIALOG (dialog)->details->entry), -1);
}
......@@ -45,7 +45,9 @@ struct _NautilusLocationDialogClass {
GtkDialogClass parent_class;
};
GType nautilus_location_dialog_get_type (void);
GtkWidget* nautilus_location_dialog_new (NautilusWindow *window);
GType nautilus_location_dialog_get_type (void);
GtkWidget* nautilus_location_dialog_new (NautilusWindow *window);
void nautilus_location_dialog_set_location (NautilusLocationDialog *dialog,
const char *location);
#endif /* NAUTILUS_LOCATION_DIALOG_H */
......@@ -409,7 +409,7 @@ action_go_to_location_callback (GtkAction *action,
window = NAUTILUS_WINDOW (user_data);
nautilus_window_prompt_for_location (window);
nautilus_window_prompt_for_location (window, NULL);
}
static const GtkActionEntry navigation_entries[] = {
......
......@@ -904,9 +904,15 @@ nautilus_navigation_window_show_location_bar_temporarily (NautilusNavigationWind
}
static void
real_prompt_for_location (NautilusWindow *window)
real_prompt_for_location (NautilusWindow *window, const char *initial)
{
nautilus_navigation_window_show_location_bar_temporarily (NAUTILUS_NAVIGATION_WINDOW (window), FALSE);
if (initial) {
nautilus_navigation_bar_set_location (NAUTILUS_NAVIGATION_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->navigation_bar),
initial);
}
}
void
......
......@@ -305,11 +305,17 @@ action_close_all_folders_callback (GtkAction *action,
}
static void
real_prompt_for_location (NautilusWindow *window)
real_prompt_for_location (NautilusWindow *window,
const char *initial)
{
GtkWidget *dialog;
dialog = nautilus_location_dialog_new (window);
if (initial != NULL) {
nautilus_location_dialog_set_location (NAUTILUS_LOCATION_DIALOG (dialog),
initial);
}
gtk_widget_show (dialog);
}
......@@ -707,8 +713,8 @@ action_go_to_location_callback (GtkAction *action,
window = NAUTILUS_WINDOW (user_data);
nautilus_window_prompt_for_location (window);
}
nautilus_window_prompt_for_location (window, NULL);
}
static void
action_add_bookmark_callback (GtkAction *action,
......
......@@ -378,12 +378,13 @@ nautilus_window_go_home (NautilusWindow *window)
}
void
nautilus_window_prompt_for_location (NautilusWindow *window)
nautilus_window_prompt_for_location (NautilusWindow *window,
const char *initial)
{
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
prompt_for_location, (window));
prompt_for_location, (window, initial));
}
char *
......@@ -1542,8 +1543,8 @@ nautilus_window_class_init (NautilusWindowClass *class)
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (NautilusWindowClass, prompt_for_location),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1, G_TYPE_STRING);
binding_set = gtk_binding_set_by_class (class);
gtk_binding_entry_add_signal (binding_set, GDK_BackSpace, 0,
......@@ -1551,8 +1552,9 @@ nautilus_window_class_init (NautilusWindowClass *class)
G_TYPE_BOOLEAN, FALSE);
gtk_binding_entry_add_signal (binding_set, GDK_F5, 0,
"reload", 0);
gtk_binding_entry_add_signal (binding_set, GDK_d, GDK_MOD1_MASK,
"prompt-for-location", 0);
gtk_binding_entry_add_signal (binding_set, GDK_slash, 0,
"prompt-for-location", 1,
G_TYPE_STRING, "/");
class->reload = nautilus_window_reload;
class->go_up = nautilus_window_go_up_signal;
......
......@@ -76,7 +76,7 @@ typedef struct {
gboolean active);
void (* set_allow_up) (NautilusWindow *window, gboolean allow);
void (* reload) (NautilusWindow *window);
void (* prompt_for_location) (NautilusWindow *window);
void (* prompt_for_location) (NautilusWindow *window, const char *initial);
void (* get_default_size) (NautilusWindow *window, guint *default_width, guint *default_height);
void (* show_window) (NautilusWindow *window);
void (* close) (NautilusWindow *window);
......@@ -126,7 +126,8 @@ void nautilus_window_go_to_with_selection (NautilusWindow *window
void nautilus_window_go_home (NautilusWindow *window);
void nautilus_window_go_up (NautilusWindow *window,
gboolean close_behind);
void nautilus_window_prompt_for_location (NautilusWindow *window);
void nautilus_window_prompt_for_location (NautilusWindow *window,
const char *initial);
void nautilus_window_launch_cd_burner (NautilusWindow *window);
void nautilus_window_update_title (NautilusWindow *window);
void nautilus_window_display_error (NautilusWindow *window,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment