Commit e391cf48 authored by Clinton Rogers's avatar Clinton Rogers

Fix for #3144 - this adds the ability to press Ctrl-F in any area of the app...

Fix for #3144 - this adds the ability to press Ctrl-F in any area of the app that has the search box to send focus to it.
parent 29d7bce6
......@@ -523,6 +523,10 @@ public abstract class MediaPage : CheckerboardPage {
public void clear() {
entry.set_text("");
}
public void get_focus() {
entry.grab_focus();
}
private bool on_editing_started(Gdk.EventFocus event) {
// Prevent window from stealing our keystrokes.
......@@ -612,6 +616,13 @@ public abstract class MediaPage : CheckerboardPage {
edit.label = _("_Edit");
actions += edit;
// Ticket #3144 - Add a hotkey to give focus to the search bar.
Gtk.ActionEntry find = { "Find", Gtk.STOCK_FIND, TRANSLATABLE, "<Ctrl>F",
TRANSLATABLE, on_find };
find.label = Resources.FIND_MENU;
find.tooltip = Resources.FIND_TOOLTIP;
actions += find;
Gtk.ActionEntry remove_from_library = { "RemoveFromLibrary", Gtk.STOCK_REMOVE, TRANSLATABLE,
"<Shift>Delete", TRANSLATABLE, on_remove_from_library };
remove_from_library.label = Resources.REMOVE_FROM_LIBRARY_MENU;
......@@ -666,7 +677,7 @@ public abstract class MediaPage : CheckerboardPage {
decrease_size.tooltip = _("Decrease the magnification of the thumbnails");
actions += decrease_size;
Gtk.ActionEntry flag = { "Flag", null, TRANSLATABLE, "<Ctrl>F", TRANSLATABLE, on_flag_unflag };
Gtk.ActionEntry flag = { "Flag", null, TRANSLATABLE, "<Ctrl>G", TRANSLATABLE, on_flag_unflag };
flag.label = Resources.FLAG_MENU;
flag.tooltip = Resources.FLAG_TOOLTIP;
actions += flag;
......@@ -912,6 +923,10 @@ public abstract class MediaPage : CheckerboardPage {
update_flag_action(get_view().get_selected_count());
}
private void on_find() {
connected_search_box.get_focus();
}
private void position_filter_popup(Gtk.Menu menu, out int x, out int y, out bool push_in) {
assert(connected_filter_button != null);
......
......@@ -2333,7 +2333,7 @@ public class LibraryPhotoPage : EditingHostPage {
set_background.tooltip = Resources.SET_BACKGROUND_TOOLTIP;
actions += set_background;
Gtk.ActionEntry flag = { "Flag", null, TRANSLATABLE, "<Ctrl>F", TRANSLATABLE, on_flag_unflag };
Gtk.ActionEntry flag = { "Flag", null, TRANSLATABLE, "<Ctrl>G", TRANSLATABLE, on_flag_unflag };
flag.label = Resources.FLAG_MENU;
flag.tooltip = Resources.FLAG_TOOLTIP;
actions += flag;
......
......@@ -265,6 +265,9 @@ along with Shotwell; if not, write to the Free Software Foundation, Inc.,
public const string FLAG_MENU = _("_Flag");
public const string FLAG_TOOLTIP = _("Flag the photos to work with them together");
public const string FIND_MENU = _("_Find...");
public const string FIND_TOOLTIP = _("Find an image by typing text that appears in its name or tags");
public const string UNFLAG_MENU = _("Un_flag");
public const string UNFLAG_TOOLTIP = _("Unflag the photos");
......
......@@ -20,6 +20,7 @@
<menuitem name="Redo" action="CommonRedo" />
<separator />
<placeholder name="EditExtrasPlaceholder" />
<menuitem name="Find" action="Find" />
<menuitem name="RemoveFromLibrary" action="RemoveFromLibrary" />
<menuitem name="MoveToTrash" action="MoveToTrash" />
<separator />
......
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