Fix #759: NetBSD fixes
[geeqie.git] / src / layout_util.c
index 72e1d6c..1a8b069 100644 (file)
@@ -25,6 +25,7 @@
 #include "advanced_exif.h"
 #include "bar_sort.h"
 #include "bar.h"
+#include "bar_keywords.h"
 #include "cache_maint.h"
 #include "collect.h"
 #include "collect-dlg.h"
@@ -44,7 +45,9 @@
 #include "pixbuf_util.h"
 #include "preferences.h"
 #include "print.h"
+#include "rcfile.h"
 #include "search.h"
+#include "search_and_run.h"
 #include "slideshow.h"
 #include "ui_fileops.h"
 #include "ui_menu.h"
@@ -57,6 +60,7 @@
 #include "metadata.h"
 #include "desktop_file.h"
 
+#include <sys/wait.h>
 #include <gdk/gdkkeysyms.h> /* for keyboard values */
 #include "keymap_template.c"
 
@@ -67,6 +71,7 @@ static gboolean layout_bar_enabled(LayoutWindow *lw);
 static gboolean layout_bar_sort_enabled(LayoutWindow *lw);
 static void layout_bars_hide_toggle(LayoutWindow *lw);
 static void layout_util_sync_views(LayoutWindow *lw);
+static void layout_search_and_run_window_new(LayoutWindow *lw);
 
 /*
  *-----------------------------------------------------------------------------
@@ -116,6 +121,15 @@ gboolean layout_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer dat
                        return TRUE;
                        }
                }
+
+       if (lw->vf->file_filter.combo && gtk_widget_has_focus(gtk_bin_get_child(GTK_BIN(lw->vf->file_filter.combo))))
+               {
+               if (gtk_widget_event(gtk_bin_get_child(GTK_BIN(lw->vf->file_filter.combo)), (GdkEvent *)event))
+                       {
+                       return TRUE;
+                       }
+               }
+
        if (lw->vd && lw->options.dir_view_type == DIRVIEW_TREE && gtk_widget_has_focus(lw->vd->view) &&
            !layout_key_match(event->keyval) &&
            gtk_widget_event(lw->vd->view, (GdkEvent *)event))
@@ -170,6 +184,11 @@ gboolean layout_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer dat
 
        if (x != 0 || y!= 0)
                {
+               if (event->state & GDK_SHIFT_MASK)
+                       {
+                       x *= 3;
+                       y *= 3;
+                       }
                keyboard_scroll_calc(&x, &y, event);
                layout_image_scroll(lw, x, y, (event->state & GDK_SHIFT_MASK));
                }
@@ -201,7 +220,7 @@ static void layout_exit_fullscreen(LayoutWindow *lw)
        layout_image_full_screen_stop(lw);
 }
 
-static void layout_menu_new_window_cb(GtkAction *action, gpointer data)
+LayoutWindow *layout_menu_new_window(GtkAction *action, gpointer data)
 {
        LayoutWindow *lw = data;
        LayoutWindow *nw;
@@ -221,6 +240,46 @@ static void layout_menu_new_window_cb(GtkAction *action, gpointer data)
        layout_sort_set(nw, options->file_sort.method, options->file_sort.ascending);
        layout_set_fd(nw, lw->dir_fd);
        options->save_window_positions = tmp;
+
+       return nw;
+}
+
+
+static void clear_marks_cancel_cb(GenericDialog *gd, gpointer data)
+{
+       generic_dialog_close(gd);
+}
+
+static void clear_marks_help_cb(GenericDialog *gd, gpointer data)
+{
+       help_window_show("GuideMainWindowMenus.html");
+}
+
+void layout_menu_clear_marks_ok_cb(GenericDialog *gd, gpointer data)
+{
+       marks_clear_all();
+       generic_dialog_close(gd);
+}
+
+static void layout_menu_clear_marks_cb(GtkAction *action, gpointer data)
+{
+       GenericDialog *gd;
+
+       gd = generic_dialog_new(_("Clear Marks"),
+                               "marks_clear", NULL, FALSE, clear_marks_cancel_cb, NULL);
+       generic_dialog_add_message(gd, GTK_STOCK_DIALOG_QUESTION, "Clear all marks?",
+                               "This will clear all marks for all images,\nincluding those linked to keywords",
+                               TRUE);
+       generic_dialog_add_button(gd, GTK_STOCK_OK, NULL, layout_menu_clear_marks_ok_cb, TRUE);
+       generic_dialog_add_button(gd, GTK_STOCK_HELP, NULL,
+                               clear_marks_help_cb, FALSE);
+
+       gtk_widget_show(gd->dialog);
+}
+
+static void layout_menu_new_window_cb(GtkAction *action, gpointer data)
+{
+       layout_menu_new_window(action, data);
 }
 
 static void layout_menu_new_cb(GtkAction *action, gpointer data)
@@ -288,7 +347,14 @@ static void layout_menu_copy_path_cb(GtkAction *action, gpointer data)
 {
        LayoutWindow *lw = data;
 
-       file_util_copy_path_list_to_clipboard(layout_selection_list(lw));
+       file_util_copy_path_list_to_clipboard(layout_selection_list(lw), TRUE);
+}
+
+static void layout_menu_copy_path_unquoted_cb(GtkAction *action, gpointer data)
+{
+       LayoutWindow *lw = data;
+
+       file_util_copy_path_list_to_clipboard(layout_selection_list(lw), FALSE);
 }
 
 static void layout_menu_move_cb(GtkAction *action, gpointer data)
@@ -309,6 +375,15 @@ static void layout_menu_delete_cb(GtkAction *action, gpointer data)
 {
        LayoutWindow *lw = data;
 
+       options->file_ops.safe_delete_enable = FALSE;
+       file_util_delete(NULL, layout_selection_list(lw), layout_window(lw));
+}
+
+static void layout_menu_move_to_trash_cb(GtkAction *action, gpointer data)
+{
+       LayoutWindow *lw = data;
+
+       options->file_ops.safe_delete_enable = TRUE;
        file_util_delete(NULL, layout_selection_list(lw), layout_window(lw));
 }
 
@@ -318,6 +393,17 @@ static void layout_menu_delete_key_cb(GtkAction *action, gpointer data)
 
        if (options->file_ops.enable_delete_key)
                {
+               options->file_ops.safe_delete_enable = FALSE;
+               file_util_delete(NULL, layout_selection_list(lw), layout_window(lw));
+               }
+}
+static void layout_menu_move_to_trash_key_cb(GtkAction *action, gpointer data)
+{
+       LayoutWindow *lw = data;
+
+       if (options->file_ops.enable_delete_key)
+               {
+               options->file_ops.safe_delete_enable = TRUE;
                file_util_delete(NULL, layout_selection_list(lw), layout_window(lw));
                }
 }
@@ -336,7 +422,7 @@ static void layout_menu_enable_grouping_cb(GtkAction *action, gpointer data)
        file_data_disable_grouping_list(layout_selection_list(lw), FALSE);
 }
 
-static void layout_menu_close_cb(GtkAction *action, gpointer data)
+void layout_menu_close_cb(GtkAction *action, gpointer data)
 {
        LayoutWindow *lw = data;
 
@@ -455,6 +541,20 @@ static void layout_menu_exif_rotate_cb(GtkToggleAction *action, gpointer data)
        layout_image_reset_orientation(lw);
 }
 
+static void layout_menu_select_rectangle_cb(GtkToggleAction *action, gpointer data)
+{
+       LayoutWindow *lw = data;
+
+       options->draw_rectangle = gtk_toggle_action_get_active(action);
+}
+
+static void layout_menu_select_overunderexposed_cb(GtkToggleAction *action, gpointer data)
+{
+       LayoutWindow *lw = data;
+
+       layout_image_set_overunderexposed(lw, gtk_toggle_action_get_active(action));
+}
+
 static void layout_menu_write_rotate(GtkToggleAction *action, gpointer data, gboolean keep_date)
 {
        LayoutWindow *lw = data;
@@ -469,6 +569,7 @@ static void layout_menu_write_rotate(GtkToggleAction *action, gpointer data, gbo
        gint run_result;
        GenericDialog *gd;
        GString *message;
+       int cmdstatus;
 
        if (!layout_valid(&lw)) return;
 
@@ -502,9 +603,9 @@ static void layout_menu_write_rotate(GtkToggleAction *action, gpointer data, gbo
 
                rotation = g_strdup_printf("%d", fd_n->user_orientation);
                command = g_strconcat(GQ_BIN_DIR, "/geeqie-rotate -r ", rotation,
-                                                                                                       keep_date ? " -t " : " ", fd_n->path, NULL);
-
-               run_result = WEXITSTATUS(runcmd(command));
+                                                               keep_date ? " -t \"" : " \"", fd_n->path, "\"", NULL);
+               cmdstatus = runcmd(command);
+               run_result = WEXITSTATUS(cmdstatus);
                if (!run_result)
                        {
                        fd_n->user_orientation = 0;
@@ -514,13 +615,20 @@ static void layout_menu_write_rotate(GtkToggleAction *action, gpointer data, gbo
                        message = g_string_new("");
                        message = g_string_append(message, _("Operation failed:\n"));
 
-                       if (run_result == 3)
-                               message = g_string_append(message, _("Cannot create tmp file"));
-                       else
-                               {
-                               message = g_string_append(message, _("File: "));
-                               message = g_string_append(message, fd_n->name);
-                               }
+                       if (run_result == 1)
+                               message = g_string_append(message, _("No file extension\n"));
+                       else if (run_result == 3)
+                               message = g_string_append(message, _("Cannot create tmp file\n"));
+                       else if (run_result == 4)
+                               message = g_string_append(message, _("Operation not supported for filetype\n"));
+                       else if (run_result == 5)
+                               message = g_string_append(message, _("File is not writable\n"));
+                       else if (run_result == 6)
+                               message = g_string_append(message, _("Exiftran error\n"));
+                       else if (run_result == 7)
+                               message = g_string_append(message, _("Mogrify error\n"));
+
+                       message = g_string_append(message, fd_n->name);
 
                        gd = generic_dialog_new(_("Image orientation"),
                        "Image orientation", NULL, TRUE, NULL, NULL);
@@ -867,6 +975,24 @@ static void layout_menu_histogram_cb(GtkToggleAction *action, gpointer data)
                }
 }
 
+static void layout_menu_guidelines_cb(GtkToggleAction *action, gpointer data)
+{
+       LayoutWindow *lw = data;
+
+       if (gtk_toggle_action_get_active(action))
+               {
+               OsdShowFlags flags = image_osd_get(lw->image);
+               image_osd_set(lw->image, OSD_SHOW_INFO | OSD_SHOW_STATUS | OSD_SHOW_GUIDELINES);
+               layout_util_sync_views(lw);
+               }
+       else
+               {
+               OsdShowFlags flags = image_osd_get(lw->image);
+               if (flags & OSD_SHOW_GUIDELINES)
+                       image_osd_set(lw->image, OSD_SHOW_NOTHING);
+               }
+}
+
 static void layout_menu_animate_cb(GtkToggleAction *action, gpointer data)
 {
        LayoutWindow *lw = data;
@@ -935,6 +1061,15 @@ static void layout_menu_bar_exif_cb(GtkAction *action, gpointer data)
        layout_exif_window_new(lw);
 }
 
+static void layout_menu_search_and_run_cb(GtkAction *action, gpointer data)
+{
+       LayoutWindow *lw = data;
+
+       layout_exit_fullscreen(lw);
+       layout_search_and_run_window_new(lw);
+}
+
+
 static void layout_menu_float_cb(GtkToggleAction *action, gpointer data)
 {
        LayoutWindow *lw = data;
@@ -998,6 +1133,10 @@ static void layout_menu_hide_bars_cb(GtkToggleAction *action, gpointer data)
 {
        LayoutWindow *lw = data;
 
+       if (lw->options.bars_state.hidden == gtk_toggle_action_get_active(action))
+               {
+               return;
+               }
        layout_bars_hide_toggle(lw);
 }
 
@@ -1064,6 +1203,14 @@ static void layout_menu_help_cb(GtkAction *action, gpointer data)
        help_window_show("index.html");
 }
 
+static void layout_menu_help_search_cb(GtkAction *action, gpointer data)
+{
+       LayoutWindow *lw = data;
+
+       layout_exit_fullscreen(lw);
+       help_search_window_show();
+}
+
 static void layout_menu_help_keys_cb(GtkAction *action, gpointer data)
 {
        LayoutWindow *lw = data;
@@ -1099,8 +1246,8 @@ static char *keyboard_map_hardcoded[][2] = {
        {"Right Border", "&lt;Primary&gt;&lt;Shift&gt;Right"},
        {"Scroll", "Up"},
        {"FastScroll", "&lt;Shift&gt;Up"},
-       {"Uper Border", "&lt;Primary&gt;Up"},
-       {"Uper Border", "&lt;Primary&gt;&lt;Shift&gt;Up"},
+       {"Upper Border", "&lt;Primary&gt;Up"},
+       {"Upper Border", "&lt;Primary&gt;&lt;Shift&gt;Up"},
        {"Scroll", "Down"},
        {"FastScroll", "&lt;Shift&gt;Down"},
        {"Lower Border", "&lt;Primary&gt;Down"},
@@ -1293,6 +1440,13 @@ static void layout_menu_invert_selection_cb(GtkAction *action, gpointer data)
        layout_select_invert(lw);
 }
 
+static void layout_menu_file_filter_cb(GtkToggleAction *action, gpointer data)
+{
+       LayoutWindow *lw = data;
+
+       layout_file_filter_set(lw, gtk_toggle_action_get_active(action));
+}
+
 static void layout_menu_marks_cb(GtkToggleAction *action, gpointer data)
 {
        LayoutWindow *lw = data;
@@ -1399,6 +1553,68 @@ static void layout_menu_image_next_cb(GtkAction *action, gpointer data)
        layout_image_next(lw);
 }
 
+static void layout_menu_page_first_cb(GtkAction *action, gpointer data)
+{
+       LayoutWindow *lw = data;
+       FileData *fd = layout_image_get_fd(lw);
+
+       if (fd->page_total > 0)
+               {
+               file_data_set_page_num(fd, 1);
+               }
+}
+
+static void layout_menu_page_last_cb(GtkAction *action, gpointer data)
+{
+       LayoutWindow *lw = data;
+       FileData *fd = layout_image_get_fd(lw);
+
+       if (fd->page_total > 0)
+               {
+               file_data_set_page_num(fd, -1);
+               }
+}
+
+static void layout_menu_page_next_cb(GtkAction *action, gpointer data)
+{
+       LayoutWindow *lw = data;
+       FileData *fd = layout_image_get_fd(lw);
+
+       if (fd->page_total > 0)
+               {
+               file_data_inc_page_num(fd);
+               }
+}
+
+static void layout_menu_page_previous_cb(GtkAction *action, gpointer data)
+{
+       LayoutWindow *lw = data;
+       FileData *fd = layout_image_get_fd(lw);
+
+       if (fd->page_total > 0)
+               {
+               file_data_dec_page_num(fd);
+               }
+}
+
+static void layout_menu_image_forward_cb(GtkAction *action, gpointer data)
+{
+       LayoutWindow *lw = data;
+       FileData *dir_fd;
+
+       /* Obtain next image */
+       layout_set_path(lw, image_chain_forward());
+}
+
+static void layout_menu_image_back_cb(GtkAction *action, gpointer data)
+{
+       LayoutWindow *lw = data;
+       FileData *dir_fd;
+
+       /* Obtain previous image */
+       layout_set_path(lw, image_chain_back());
+}
+
 static void layout_menu_split_pane_next_cb(GtkAction *action, gpointer data)
 {
        LayoutWindow *lw = data;
@@ -1546,6 +1762,25 @@ static void layout_menu_metadata_write_cb(GtkAction *action, gpointer data)
        metadata_write_queue_confirm(TRUE, NULL, NULL);
 }
 
+static GtkWidget *last_focussed = NULL;
+static void layout_menu_keyword_autocomplete_cb(GtkAction *action, gpointer data)
+{
+       LayoutWindow *lw = data;
+       GtkWidget *tmp;
+       gboolean auto_has_focus;
+
+       tmp = gtk_window_get_focus(GTK_WINDOW(lw->window));
+       auto_has_focus = bar_keywords_autocomplete_focus(lw);
+
+       if (auto_has_focus)
+               {
+               gtk_widget_grab_focus(last_focussed);
+               }
+       else
+               {
+               last_focussed = tmp;
+               }
+}
 
 /*
  *-----------------------------------------------------------------------------
@@ -1710,7 +1945,6 @@ static GtkActionEntry menu_entries[] = {
   { "SelectMenu",      NULL,                   N_("_Select"),                          NULL,                   NULL,                                   NULL },
   { "OrientationMenu", NULL,                   N_("_Orientation"),                     NULL,                   NULL,                                   NULL },
   { "RatingMenu",      NULL,                   N_("_Rating"),                                  NULL,                   NULL,                                   NULL },
-  { "ExternalMenu",    NULL,                   N_("E_xternal Editors"),                NULL,                   NULL,                                   NULL },
   { "PreferencesMenu", NULL,                   N_("P_references"),                     NULL,                   NULL,                                   NULL },
   { "ViewMenu",                NULL,                   N_("_View"),                            NULL,                   NULL,                                   NULL },
   { "FileDirMenu",     NULL,                   N_("_Files and Folders"),               NULL,                   NULL,                                   NULL },
@@ -1720,6 +1954,8 @@ static GtkActionEntry menu_entries[] = {
   { "SplitMenu",       NULL,                   N_("Spli_t"),                           NULL,                   NULL,                                   NULL },
   { "StereoMenu",      NULL,                   N_("Stere_o"),                          NULL,                   NULL,                                   NULL },
   { "OverlayMenu",     NULL,                   N_("Image _Overlay"),                   NULL,                   NULL,                                   NULL },
+  { "PluginsMenu",     NULL,                   N_("_Plugins"),                         NULL,                   NULL,                                   NULL },
+  { "SarMenu",         NULL,                   N_("S_aR"),                             NULL,                   NULL,                                   NULL },
   { "HelpMenu",                NULL,                   N_("_Help"),                            NULL,                   NULL,                                   NULL },
 
   { "FirstImage",      GTK_STOCK_GOTO_TOP,     N_("_First Image"),                     "Home",                 N_("First Image"),                      CB(layout_menu_image_first_cb) },
@@ -1728,34 +1964,46 @@ static GtkActionEntry menu_entries[] = {
   { "PrevImageAlt2",   GTK_STOCK_GO_UP,        N_("_Previous Image"),                  "KP_Page_Up",           N_("Previous Image"),                   CB(layout_menu_image_prev_cb) },
   { "NextImage",       GTK_STOCK_GO_DOWN,      N_("_Next Image"),                      "space",                N_("Next Image"),                       CB(layout_menu_image_next_cb) },
   { "NextImageAlt1",   GTK_STOCK_GO_DOWN,      N_("_Next Image"),                      "Page_Down",            N_("Next Image"),                       CB(layout_menu_image_next_cb) },
-  { "NextImageAlt2",   GTK_STOCK_GO_DOWN,      N_("_Next Image"),                      "KP_Page_Down",         N_("Next Image"),                       CB(layout_menu_image_next_cb) },
+
+  { "ImageForward",    GTK_STOCK_GOTO_LAST,    N_("Image Forward"),    NULL,   N_("Forward in image history"), CB(layout_menu_image_forward_cb) },
+  { "ImageBack",       GTK_STOCK_GOTO_FIRST,   N_("Image Back"),               NULL,   N_("Back in image history"),            CB(layout_menu_image_back_cb) },
+
+  { "FirstPage",GTK_STOCK_MEDIA_PREVIOUS,      N_("_First Page"),              NULL,   N_( "First Page of multi-page image"),  CB(layout_menu_page_first_cb) },
+  { "LastPage",        GTK_STOCK_MEDIA_NEXT,           N_("_Last Page"),               NULL,   N_("Last Page of multi-page image"),    CB(layout_menu_page_last_cb) },
+  { "NextPage",        GTK_STOCK_MEDIA_FORWARD,        N_("_Next Page"),               NULL,   N_("Next Page of multi-page image"),    CB(layout_menu_page_next_cb) },
+  { "PrevPage",        GTK_STOCK_MEDIA_REWIND,         N_("_Previous Page"),   NULL,   N_("Previous Page of multi-page image"),        CB(layout_menu_page_previous_cb) },
+
+
+  { "NextImageAlt2",   GTK_STOCK_GO_DOWN,      N_("_Next Image"),                      "KP_Page_Down",         N_("Next Image"),               CB(layout_menu_image_next_cb) },
   { "LastImage",       GTK_STOCK_GOTO_BOTTOM,  N_("_Last Image"),                      "End",                  N_("Last Image"),                       CB(layout_menu_image_last_cb) },
-  { "Back",            GTK_STOCK_GO_BACK,      N_("_Back"),                            NULL,                   N_("Back"),                             CB(layout_menu_back_cb) },
-  { "Forward", GTK_STOCK_GO_FORWARD,   N_("_Forward"),                 NULL,                   N_("Forward"),                          CB(layout_menu_forward_cb) },
-  { "Home",            GTK_STOCK_HOME,         N_("_Home"),                            NULL,                   N_("Home"),                             CB(layout_menu_home_cb) },
-  { "Up",              GTK_STOCK_GO_UP,        N_("_Up"),                              NULL,                   N_("Up"),                               CB(layout_menu_up_cb) },
+  { "Back",            GTK_STOCK_GO_BACK,      N_("_Back"),                    NULL,   N_("Back in folder history"),           CB(layout_menu_back_cb) },
+  { "Forward", GTK_STOCK_GO_FORWARD,   N_("_Forward"),         NULL,   N_("Forward in folder history"),        CB(layout_menu_forward_cb) },
+  { "Home",            GTK_STOCK_HOME,         N_("_Home"),                    NULL,   N_("Home"),                             CB(layout_menu_home_cb) },
+  { "Up",              GTK_STOCK_GO_UP,        N_("_Up"),                              NULL,   N_("Up one folder"),                            CB(layout_menu_up_cb) },
 
   { "NewWindow",       GTK_STOCK_NEW,          N_("New _window"),                      "<control>N",           N_("New window"),                       CB(layout_menu_new_window_cb) },
   { "NewCollection",   GTK_STOCK_INDEX,        N_("_New collection"),                  "C",                    N_("New collection"),                   CB(layout_menu_new_cb) },
   { "OpenCollection",  GTK_STOCK_OPEN,         N_("_Open collection..."),              "O",                    N_("Open collection..."),               CB(layout_menu_open_cb) },
-  { "OpenRecent",      NULL,                   N_("Open recen_t"),                     NULL,                   N_("Open recent"),                      NULL },
+  { "OpenRecent",      NULL,                   N_("Open recen_t"),                     NULL,                   N_("Open recent collection"),                   NULL },
   { "Search",          GTK_STOCK_FIND,         N_("_Search..."),                       "F3",                   N_("Search..."),                        CB(layout_menu_search_cb) },
   { "FindDupes",       GTK_STOCK_FIND,         N_("_Find duplicates..."),              "D",                    N_("Find duplicates..."),               CB(layout_menu_dupes_cb) },
-  { "PanView",         NULL,                   N_("Pa_n view"),                        "<control>J",           N_("Pan view"),                         CB(layout_menu_pan_cb) },
+  { "PanView", PIXBUF_INLINE_ICON_PANORAMA,    N_("Pa_n view"),                        "<control>J",           N_("Pan view"),                         CB(layout_menu_pan_cb) },
   { "Print",           GTK_STOCK_PRINT,        N_("_Print..."),                        "<shift>P",             N_("Print..."),                         CB(layout_menu_print_cb) },
   { "NewFolder",       GTK_STOCK_DIRECTORY,    N_("N_ew folder..."),                   "<control>F",           N_("New folder..."),                    CB(layout_menu_dir_cb) },
   { "Copy",            GTK_STOCK_COPY,         N_("_Copy..."),                         "<control>C",           N_("Copy..."),                          CB(layout_menu_copy_cb) },
-  { "Move",            NULL,                   N_("_Move..."),                         "<control>M",           N_("Move..."),                          CB(layout_menu_move_cb) },
-  { "Rename",          NULL,                   N_("_Rename..."),                       "<control>R",           N_("Rename..."),                        CB(layout_menu_rename_cb) },
-  { "Delete",          GTK_STOCK_DELETE,       N_("_Delete..."),                       "<control>D",           N_("Delete..."),                        CB(layout_menu_delete_cb) },
-  { "DeleteAlt1",      GTK_STOCK_DELETE,       N_("_Delete..."),                       "Delete",               N_("Delete..."),                        CB(layout_menu_delete_key_cb) },
-  { "DeleteAlt2",      GTK_STOCK_DELETE,       N_("_Delete..."),                       "KP_Delete",            N_("Delete..."),                        CB(layout_menu_delete_key_cb) },
+  { "Move",    PIXBUF_INLINE_ICON_MOVE,                        N_("_Move..."),                         "<control>M",           N_("Move..."),                          CB(layout_menu_move_cb) },
+  { "Rename",  PIXBUF_INLINE_ICON_RENAME,      N_("_Rename..."),                       "<control>R",           N_("Rename..."),                        CB(layout_menu_rename_cb) },
+  { "Delete",  PIXBUF_INLINE_ICON_TRASH,       N_("Move to Trash..."),         "<control>D",   N_("Move to Trash..."),         CB(layout_menu_move_to_trash_cb) },
+  { "DeleteAlt1",      PIXBUF_INLINE_ICON_TRASH,N_("Move to Trash..."),        "Delete",               N_("Move to Trash..."),         CB(layout_menu_move_to_trash_key_cb) },
+  { "DeleteAlt2",      PIXBUF_INLINE_ICON_TRASH,N_("Move to Trash..."),        "KP_Delete",    N_("Move to Trash..."),         CB(layout_menu_move_to_trash_key_cb) },
+  { "PermanentDelete", GTK_STOCK_DELETE,       N_("Delete..."),                        "<shift>Delete",N_("Delete..."),                        CB(layout_menu_delete_cb) }, 
   { "EnableGrouping",  NULL,                   N_("Enable file _grouping"),            NULL,                   N_("Enable file grouping"),             CB(layout_menu_enable_grouping_cb) },
   { "DisableGrouping", NULL,                   N_("Disable file groupi_ng"),           NULL,                   N_("Disable file grouping"),            CB(layout_menu_disable_grouping_cb) },
   { "CopyPath",                NULL,                   N_("_Copy path to clipboard"),          NULL,                   N_("Copy path to clipboard"),           CB(layout_menu_copy_path_cb) },
+  { "CopyPathUnquoted",                NULL,                   N_("_Copy path unquoted to clipboard"),         NULL,                   N_("Copy path unquoted to clipboard"),          CB(layout_menu_copy_path_unquoted_cb) },
   { "CloseWindow",     GTK_STOCK_CLOSE,        N_("C_lose window"),                    "<control>W",           N_("Close window"),                     CB(layout_menu_close_cb) },
   { "Quit",            GTK_STOCK_QUIT,         N_("_Quit"),                            "<control>Q",           N_("Quit"),                             CB(layout_menu_exit_cb) },
-  { "RotateCW",                NULL,                   N_("_Rotate clockwise"),                "bracketright",         N_("Rotate clockwise"),                 CB(layout_menu_alter_90_cb) },
+  { "RotateCW",                PIXBUF_INLINE_ICON_CW,                  N_("_Rotate clockwise 90°"),           "bracketright",         N_("Image Rotate clockwise 90°"),                      CB(layout_menu_alter_90_cb) },
   { "Rating0",         NULL,                   N_("_Rating 0"),        "<alt>KP_0",    N_("Rating 0"),                 CB(layout_menu_rating_0_cb) },
   { "Rating1",         NULL,                   N_("_Rating 1"),        "<alt>KP_1",    N_("Rating 1"),                 CB(layout_menu_rating_1_cb) },
   { "Rating2",         NULL,                   N_("_Rating 2"),        "<alt>KP_2",    N_("Rating 2"),                 CB(layout_menu_rating_2_cb) },
@@ -1763,20 +2011,21 @@ static GtkActionEntry menu_entries[] = {
   { "Rating4",         NULL,                   N_("_Rating 4"),        "<alt>KP_4",    N_("Rating 4"),                 CB(layout_menu_rating_4_cb) },
   { "Rating5",         NULL,                   N_("_Rating 5"),        "<alt>KP_5",    N_("Rating 5"),                 CB(layout_menu_rating_5_cb) },
   { "RatingM1",                NULL,                   N_("_Rating -1"),       "<alt>KP_Subtract",     N_("Rating -1"),        CB(layout_menu_rating_m1_cb) },
-  { "RotateCCW",       NULL,                   N_("Rotate _counterclockwise"),         "bracketleft",          N_("Rotate counterclockwise"),          CB(layout_menu_alter_90cc_cb) },
-  { "Rotate180",       NULL,                   N_("Rotate 1_80"),                      "<shift>R",             N_("Rotate 180"),                       CB(layout_menu_alter_180_cb) },
-  { "Mirror",          NULL,                   N_("_Mirror"),                          "<shift>M",             N_("Mirror"),                           CB(layout_menu_alter_mirror_cb) },
-  { "Flip",            NULL,                   N_("_Flip"),                            "<shift>F",             N_("Flip"),                             CB(layout_menu_alter_flip_cb) },
-  { "AlterNone",       NULL,                   N_("_Original state"),                  "<shift>O",             N_("Original state"),                   CB(layout_menu_alter_none_cb) },
-  { "SelectAll",       NULL,                   N_("Select _all"),                      "<control>A",           N_("Select all"),                       CB(layout_menu_select_all_cb) },
-  { "SelectNone",      NULL,                   N_("Select _none"),                     "<control><shift>A",    N_("Select none"),                      CB(layout_menu_unselect_all_cb) },
-  { "SelectInvert",    NULL,                   N_("_Invert Selection"),                "<control><shift>I",    N_("Invert Selection"),                 CB(layout_menu_invert_selection_cb) },
+  { "RotateCCW",       PIXBUF_INLINE_ICON_CCW, N_("Rotate _counterclockwise 90°"),            "bracketleft",          N_("Rotate counterclockwise 90°"),             CB(layout_menu_alter_90cc_cb) },
+  { "Rotate180",       PIXBUF_INLINE_ICON_180, N_("Rotate 1_80°"),    "<shift>R",             N_("Image Rotate 180°"),                       CB(layout_menu_alter_180_cb) },
+  { "Mirror",          PIXBUF_INLINE_ICON_MIRROR,      N_("_Mirror"),  "<shift>M",             N_("Image Mirror"),                             CB(layout_menu_alter_mirror_cb) },
+  { "Flip",            PIXBUF_INLINE_ICON_FLIP,        N_("_Flip"),    "<shift>F",             N_("Image Flip"),                               CB(layout_menu_alter_flip_cb) },
+  { "AlterNone",       PIXBUF_INLINE_ICON_ORIGINAL,    N_("_Original state"),  "<shift>O",             N_("Image rotate Original state"),                      CB(layout_menu_alter_none_cb) },
+  { "SelectAll",       PIXBUF_INLINE_ICON_SELECT_ALL,                  N_("Select _all"),                      "<control>A",           N_("Select all"),                       CB(layout_menu_select_all_cb) },
+  { "SelectNone",      PIXBUF_INLINE_ICON_SELECT_NONE,                 N_("Select _none"),                     "<control><shift>A",    N_("Select none"),                      CB(layout_menu_unselect_all_cb) },
+  { "SelectInvert",    PIXBUF_INLINE_ICON_SELECT_INVERT,                       N_("_Invert Selection"),                "<control><shift>I",    N_("Invert Selection"),                 CB(layout_menu_invert_selection_cb) },
   { "Preferences",     GTK_STOCK_PREFERENCES,  N_("P_references..."),                  "<control>O",           N_("Preferences..."),                   CB(layout_menu_config_cb) },
-  { "Editors",         GTK_STOCK_PREFERENCES,  N_("Configure _Editors..."),            NULL,                   N_("Configure Editors..."),             CB(layout_menu_editors_cb) },
+  { "Plugins",         GTK_STOCK_PREFERENCES,  N_("Configure _Plugins..."),            NULL,                   N_("Configure Plugins..."),             CB(layout_menu_editors_cb) },
   { "LayoutConfig",    GTK_STOCK_PREFERENCES,  N_("_Configure this window..."),        NULL,                   N_("Configure this window..."),         CB(layout_menu_layout_config_cb) },
-  { "Maintenance",     NULL,                   N_("_Thumbnail maintenance..."),        NULL,                   N_("Thumbnail maintenance..."),         CB(layout_menu_remove_thumb_cb) },
+  { "Maintenance",     PIXBUF_INLINE_ICON_MAINTENANCE, N_("_Cache maintenance..."),    NULL,                   N_("Cache maintenance..."),             CB(layout_menu_remove_thumb_cb) },
   { "Wallpaper",       NULL,                   N_("Set as _wallpaper"),                NULL,                   N_("Set as wallpaper"),                 CB(layout_menu_wallpaper_cb) },
   { "SaveMetadata",    GTK_STOCK_SAVE,         N_("_Save metadata"),                   "<control>S",           N_("Save metadata"),                    CB(layout_menu_metadata_write_cb) },
+  { "KeywordAutocomplete",     NULL,   N_("Keyword autocomplete"),             "<alt>K",               N_("Keyword Autocomplete"),                     CB(layout_menu_keyword_autocomplete_cb) },
   { "ZoomIn",          GTK_STOCK_ZOOM_IN,      N_("Zoom _in"),                         "equal",                N_("Zoom in"),                          CB(layout_menu_zoom_in_cb) },
   { "ZoomInAlt1",      GTK_STOCK_ZOOM_IN,      N_("Zoom _in"),                         "KP_Add",               N_("Zoom in"),                          CB(layout_menu_zoom_in_cb) },
   { "ZoomOut",         GTK_STOCK_ZOOM_OUT,     N_("Zoom _out"),                        "minus",                N_("Zoom out"),                         CB(layout_menu_zoom_out_cb) },
@@ -1785,14 +2034,14 @@ static GtkActionEntry menu_entries[] = {
   { "Zoom100Alt1",     GTK_STOCK_ZOOM_100,     N_("Zoom _1:1"),                        "KP_Divide",            N_("Zoom 1:1"),                         CB(layout_menu_zoom_1_1_cb) },
   { "ZoomFit",         GTK_STOCK_ZOOM_FIT,     N_("_Zoom to fit"),                     "X",                    N_("Zoom to fit"),                      CB(layout_menu_zoom_fit_cb) },
   { "ZoomFitAlt1",     GTK_STOCK_ZOOM_FIT,     N_("_Zoom to fit"),                     "KP_Multiply",          N_("Zoom to fit"),                      CB(layout_menu_zoom_fit_cb) },
-  { "ZoomFillHor",     NULL,                   N_("Fit _Horizontally"),                "H",                    N_("Fit Horizontally"),                 CB(layout_menu_zoom_fit_hor_cb) },
-  { "ZoomFillVert",    NULL,                   N_("Fit _Vertically"),                  "W",                    N_("Fit Vertically"),                   CB(layout_menu_zoom_fit_vert_cb) },
-  { "Zoom200",         NULL,                   N_("Zoom _2:1"),                        NULL,                   N_("Zoom 2:1"),                         CB(layout_menu_zoom_2_1_cb) },
-  { "Zoom300",         NULL,                   N_("Zoom _3:1"),                        NULL,                   N_("Zoom 3:1"),                         CB(layout_menu_zoom_3_1_cb) },
-  { "Zoom400",         NULL,                   N_("Zoom _4:1"),                        NULL,                   N_("Zoom 4:1"),                         CB(layout_menu_zoom_4_1_cb) },
-  { "Zoom50",          NULL,                   N_("Zoom 1:2"),                         NULL,                   N_("Zoom 1:2"),                         CB(layout_menu_zoom_1_2_cb) },
-  { "Zoom33",          NULL,                   N_("Zoom 1:3"),                         NULL,                   N_("Zoom 1:3"),                         CB(layout_menu_zoom_1_3_cb) },
-  { "Zoom25",          NULL,                   N_("Zoom 1:4"),                         NULL,                   N_("Zoom 1:4"),                         CB(layout_menu_zoom_1_4_cb) },
+  { "ZoomFillHor",     PIXBUF_INLINE_ICON_ZOOMFILLHOR, N_("Fit _Horizontally"),                "H",                    N_("Fit Horizontally"),                 CB(layout_menu_zoom_fit_hor_cb) },
+  { "ZoomFillVert",    PIXBUF_INLINE_ICON_ZOOMFILLVERT,        N_("Fit _Vertically"),                  "W",                    N_("Fit Vertically"),                   CB(layout_menu_zoom_fit_vert_cb) },
+  { "Zoom200",         GTK_STOCK_FILE,                 N_("Zoom _2:1"),                        NULL,                   N_("Zoom 2:1"),                         CB(layout_menu_zoom_2_1_cb) },
+  { "Zoom300",         GTK_STOCK_FILE,                 N_("Zoom _3:1"),                        NULL,                   N_("Zoom 3:1"),                         CB(layout_menu_zoom_3_1_cb) },
+  { "Zoom400",         GTK_STOCK_FILE,                 N_("Zoom _4:1"),                        NULL,                   N_("Zoom 4:1"),                         CB(layout_menu_zoom_4_1_cb) },
+  { "Zoom50",          GTK_STOCK_FILE,                 N_("Zoom 1:2"),                         NULL,                   N_("Zoom 1:2"),                         CB(layout_menu_zoom_1_2_cb) },
+  { "Zoom33",          GTK_STOCK_FILE,                 N_("Zoom 1:3"),                         NULL,                   N_("Zoom 1:3"),                         CB(layout_menu_zoom_1_3_cb) },
+  { "Zoom25",          GTK_STOCK_FILE,                 N_("Zoom 1:4"),                         NULL,                   N_("Zoom 1:4"),                         CB(layout_menu_zoom_1_4_cb) },
   { "ConnectZoomIn",   GTK_STOCK_ZOOM_IN,      N_("Zoom _in"),                         "plus",                 N_("Connected Zoom in"),                CB(layout_menu_connect_zoom_in_cb) },
   { "ConnectZoomInAlt1",GTK_STOCK_ZOOM_IN,     N_("Zoom _in"),                         "<shift>KP_Add",        N_("Connected Zoom in"),                CB(layout_menu_connect_zoom_in_cb) },
   { "ConnectZoomOut",  GTK_STOCK_ZOOM_OUT,     N_("Zoom _out"),                        "underscore",           N_("Connected Zoom out"),               CB(layout_menu_connect_zoom_out_cb) },
@@ -1818,47 +2067,53 @@ static GtkActionEntry menu_entries[] = {
   { "ImageOverlayCycle",NULL,                  N_("_Cycle through overlay modes"),     "I",                    N_("Cycle through Overlay modes"),      CB(layout_menu_overlay_toggle_cb) },
   { "HistogramChanCycle",NULL,                 N_("Cycle through histogram ch_annels"),"K",                    N_("Cycle through histogram channels"), CB(layout_menu_histogram_toggle_channel_cb) },
   { "HistogramModeCycle",NULL,                 N_("Cycle through histogram mo_des"),   "J",                    N_("Cycle through histogram modes"),    CB(layout_menu_histogram_toggle_mode_cb) },
-  { "HideTools",       NULL,                   N_("_Hide file list"),                  "<control>H",           N_("Hide file list"),                   CB(layout_menu_hide_cb) },
+  { "HideTools",       PIXBUF_INLINE_ICON_HIDETOOLS,   N_("_Hide file list"),                  "<control>H",           N_("Hide file list"),                   CB(layout_menu_hide_cb) },
   { "SlideShowPause",  GTK_STOCK_MEDIA_PAUSE,  N_("_Pause slideshow"),                 "P",                    N_("Pause slideshow"),                  CB(layout_menu_slideshow_pause_cb) },
-  { "SlideShowFaster", NULL,   N_("Faster"),           "<control>KP_Add",                      N_("Faster"),                   CB(layout_menu_slideshow_faster_cb) },
-  { "SlideShowSlower", NULL,   N_("Slower"),           "<control>KP_Subtract",                 N_("Slower"),                   CB(layout_menu_slideshow_slower_cb) },
+  { "SlideShowFaster", GTK_STOCK_FILE, N_("Faster"),           "<control>KP_Add",                      N_("Slideshow Faster"),                         CB(layout_menu_slideshow_faster_cb) },
+  { "SlideShowSlower", GTK_STOCK_FILE, N_("Slower"),           "<control>KP_Subtract",                 N_("Slideshow Slower"),                         CB(layout_menu_slideshow_slower_cb) },
   { "Refresh",         GTK_STOCK_REFRESH,      N_("_Refresh"),                         "R",                    N_("Refresh"),                          CB(layout_menu_refresh_cb) },
   { "HelpContents",    GTK_STOCK_HELP,         N_("_Contents"),                        "F1",                   N_("Contents"),                         CB(layout_menu_help_cb) },
+  { "HelpSearch",      NULL,           N_("On-line help search"),                      NULL,                   N_("On-line help search"),                              CB(layout_menu_help_search_cb) },
   { "HelpShortcuts",   NULL,                   N_("_Keyboard shortcuts"),              NULL,                   N_("Keyboard shortcuts"),               CB(layout_menu_help_keys_cb) },
   { "HelpKbd",         NULL,                   N_("_Keyboard map"),                    NULL,                   N_("Keyboard map"),                     CB(layout_menu_kbd_map_cb) },
   { "HelpNotes",       NULL,                   N_("_Release notes"),                   NULL,                   N_("Release notes"),                    CB(layout_menu_notes_cb) },
   { "HelpChangeLog",   NULL,                   N_("_ChangeLog"),                       NULL,                   N_("ChangeLog notes"),                  CB(layout_menu_changelog_cb) },
+  { "SearchAndRunCommand",     GTK_STOCK_FIND,         N_("Search and Run command"),   "slash",        N_("Search commands by keyword and run them"),  CB(layout_menu_search_and_run_cb) },
   { "About",           GTK_STOCK_ABOUT,        N_("_About"),                           NULL,                   N_("About"),                            CB(layout_menu_about_cb) },
   { "LogWindow",       NULL,                   N_("_Log Window"),                      NULL,                   N_("Log Window"),                       CB(layout_menu_log_window_cb) },
-  { "ExifWin",         NULL,                   N_("_Exif window"),                     "<control>E",           N_("Exif window"),                      CB(layout_menu_bar_exif_cb) },
+  { "ExifWin",         PIXBUF_INLINE_ICON_EXIF,        N_("_Exif window"),                     "<control>E",           N_("Exif window"),                      CB(layout_menu_bar_exif_cb) },
   { "StereoCycle",     NULL,                   N_("_Cycle through stereo modes"),      NULL,                   N_("Cycle through stereo modes"),       CB(layout_menu_stereo_mode_next_cb) },
-  { "SplitNextPane",   NULL,                   N_("_Next Pane"),       "<alt>Right",                   N_("Next Pane"),        CB(layout_menu_split_pane_next_cb) },
-  { "SplitPreviousPane",       NULL,                   N_("_Previous Pane"),   "<alt>Left",                    N_("Previous Pane"),    CB(layout_menu_split_pane_prev_cb) },
-  { "SplitUpPane",     NULL,                   N_("_Up Pane"), "<alt>Up",                      N_("Up Pane"),  CB(layout_menu_split_pane_updown_cb) },
-  { "SplitDownPane",   NULL,                   N_("_Down Pane"),       "<alt>Down",                    N_("Down Pane"),        CB(layout_menu_split_pane_updown_cb) },
+  { "SplitNextPane",   NULL,                   N_("_Next Pane"),       "<alt>Right",                   N_("Next Split Pane"),  CB(layout_menu_split_pane_next_cb) },
+  { "SplitPreviousPane",       NULL,                   N_("_Previous Pane"),   "<alt>Left",                    N_("Previous Split Pane"),      CB(layout_menu_split_pane_prev_cb) },
+  { "SplitUpPane",     NULL,                   N_("_Up Pane"), "<alt>Up",                      N_("Up Split Pane"),    CB(layout_menu_split_pane_updown_cb) },
+  { "SplitDownPane",   NULL,                   N_("_Down Pane"),       "<alt>Down",                    N_("Down Split Pane"),  CB(layout_menu_split_pane_updown_cb) },
   { "WriteRotation",   NULL,                   N_("_Write orientation to file"),               NULL,           N_("Write orientation to file"),                        CB(layout_menu_write_rotate_cb) },
   { "WriteRotationKeepDate",   NULL,                   N_("_Write orientation to file (preserve timestamp)"),                  NULL,           N_("Write orientation to file (preserve timestamp)"),                   CB(layout_menu_write_rotate_keep_date_cb) },
-
+  { "ClearMarks",      NULL,           N_("Clear Marks..."),                   NULL,           N_("Clear Marks"),                      CB(layout_menu_clear_marks_cb) },
 };
 
 static GtkToggleActionEntry menu_toggle_entries[] = {
   { "Thumbnails",      PIXBUF_INLINE_ICON_THUMB,N_("Show _Thumbnails"),                "T",                    N_("Show Thumbnails"),                  CB(layout_menu_thumb_cb),        FALSE },
-  { "ShowMarks",        NULL,                  N_("Show _Marks"),                      "M",                    N_("Show Marks"),                       CB(layout_menu_marks_cb),        FALSE  },
+  { "ShowMarks",        PIXBUF_INLINE_ICON_MARKS,      N_("Show _Marks"),                      "M",                    N_("Show Marks"),                       CB(layout_menu_marks_cb),        FALSE  },
+  { "ShowFileFilter", PIXBUF_INLINE_ICON_FILE_FILTER,  N_("Show File Filter"), NULL,   N_("Show File Filter"), CB(layout_menu_file_filter_cb),  FALSE  },
   { "ShowInfoPixel",   GTK_STOCK_COLOR_PICKER, N_("Pi_xel Info"),                      NULL,                   N_("Show Pixel Info"),                  CB(layout_menu_info_pixel_cb),   FALSE  },
   { "FloatTools",      PIXBUF_INLINE_ICON_FLOAT,N_("_Float file list"),                "L",                    N_("Float file list"),                  CB(layout_menu_float_cb),        FALSE  },
   { "HideToolbar",     NULL,                   N_("Hide tool_bar"),                    NULL,                   N_("Hide toolbar"),                     CB(layout_menu_toolbar_cb),      FALSE  },
-  { "SBar",            NULL,                   N_("_Info sidebar"),                    "<control>K",           N_("Info sidebar"),                     CB(layout_menu_bar_cb),          FALSE  },
-  { "SBarSort",                NULL,                   N_("Sort _manager"),                    "<shift>S",             N_("Sort manager"),                     CB(layout_menu_bar_sort_cb),     FALSE  },
+  { "SBar",    PIXBUF_INLINE_ICON_INFO,        N_("_Info sidebar"),                    "<control>K",           N_("Info sidebar"),                     CB(layout_menu_bar_cb),          FALSE  },
+  { "SBarSort",        PIXBUF_INLINE_ICON_SORT,        N_("Sort _manager"),                    "<shift>S",             N_("Sort manager"),                     CB(layout_menu_bar_sort_cb),     FALSE  },
   { "HideBars",                NULL,                   N_("Hide Bars"),                        "grave",                N_("Hide Bars"),                        CB(layout_menu_hide_bars_cb),    FALSE  },
   { "SlideShow",       GTK_STOCK_MEDIA_PLAY,   N_("Toggle _slideshow"),                "S",                    N_("Toggle slideshow"),                 CB(layout_menu_slideshow_cb),    FALSE  },
   { "UseColorProfiles",        GTK_STOCK_SELECT_COLOR, N_("Use _color profiles"),              NULL,                   N_("Use color profiles"),               CB(layout_color_menu_enable_cb), FALSE},
   { "UseImageProfile", NULL,                   N_("Use profile from _image"),          NULL,                   N_("Use profile from image"),           CB(layout_color_menu_use_image_cb), FALSE},
-  { "Grayscale",       NULL,                   N_("Toggle _grayscale"),                "<shift>G",             N_("Toggle grayscale"),                 CB(layout_menu_alter_desaturate_cb), FALSE},
+  { "Grayscale",       PIXBUF_INLINE_ICON_GRAYSCALE,   N_("Toggle _grayscale"),        "<shift>G",             N_("Toggle grayscale"),         CB(layout_menu_alter_desaturate_cb), FALSE},
   { "ImageOverlay",    NULL,                   N_("Image _Overlay"),                   NULL,                   N_("Image Overlay"),                    CB(layout_menu_overlay_cb),      FALSE },
   { "ImageHistogram",  NULL,                   N_("_Show Histogram"),                  NULL,                   N_("Show Histogram"),                   CB(layout_menu_histogram_cb),    FALSE },
-  { "RectangularSelection",    NULL,                   N_("Rectangular Selection"),                    "<alt>R",                       N_("Rectangular Selection"),                    CB(layout_menu_rectangular_selection_cb),        FALSE },
+  { "ImageGuidelines", PIXBUF_INLINE_ICON_GUIDELINES,          N_("_Show Guidelines"),                 NULL,           N_("Show Guidelines"),                  CB(layout_menu_guidelines_cb),   FALSE },
+  { "RectangularSelection",    PIXBUF_INLINE_ICON_SELECT_RECTANGLE,    N_("Rectangular Selection"),                    "<alt>R",                       N_("Rectangular Selection"),                    CB(layout_menu_rectangular_selection_cb),        FALSE },
   { "Animate", NULL,   N_("GIF _animation"),           "A",                    N_("Toggle GIF animation"),                     CB(layout_menu_animate_cb),      FALSE  },
   { "ExifRotate",      GTK_STOCK_ORIENTATION_PORTRAIT,                 N_("_Exif rotate"),             "<alt>X",               N_("Exif rotate"),                      CB(layout_menu_exif_rotate_cb), FALSE },
+  { "DrawRectangle",   PIXBUF_INLINE_ICON_DRAW_RECTANGLE,                      N_("Draw Rectangle"),           NULL,           N_("Draw Rectangle"),                   CB(layout_menu_select_rectangle_cb), FALSE },
+  { "OverUnderExposed",        PIXBUF_INLINE_ICON_EXPOSURE,    N_("Over/Under Exposed"),       "<shift>E",             N_("Over/Under Exposed"),               CB(layout_menu_select_overunderexposed_cb), FALSE },
 };
 
 static GtkRadioActionEntry menu_radio_entries[] = {
@@ -1930,7 +2185,10 @@ static const gchar *menu_ui_description =
 "      <menuitem action='Copy'/>"
 "      <menuitem action='Move'/>"
 "      <menuitem action='Rename'/>"
+"      <separator/>"
 "      <menuitem action='Delete'/>"
+"      <menuitem action='PermanentDelete'/>"
+"      <separator/>"
 "      <placeholder name='FileOpsSection'/>"
 "      <separator/>"
 "      <placeholder name='QuitSection'/>"
@@ -1943,30 +2201,37 @@ static const gchar *menu_ui_description =
 "      <menuitem action='PrevImage'/>"
 "      <menuitem action='NextImage'/>"
 "      <menuitem action='LastImage'/>"
+"      <menuitem action='ImageBack'/>"
+"      <menuitem action='ImageForward'/>"
 "      <separator/>"
 "      <menuitem action='Back'/>"
 "      <menuitem action='Forward'/>"
 "      <menuitem action='Up'/>"
 "      <menuitem action='Home'/>"
 "      <separator/>"
+"      <menuitem action='FirstPage'/>"
+"      <menuitem action='LastPage'/>"
+"      <menuitem action='NextPage'/>"
+"      <menuitem action='PrevPage'/>"
 "    </menu>"
 "    <menu action='SelectMenu'>"
 "      <menuitem action='SelectAll'/>"
 "      <menuitem action='SelectNone'/>"
 "      <menuitem action='SelectInvert'/>"
 "      <menuitem action='RectangularSelection'/>"
+"      <menuitem action='ShowFileFilter'/>"
 "      <placeholder name='SelectSection'/>"
 "      <separator/>"
 "      <menuitem action='CopyPath'/>"
+"      <menuitem action='CopyPathUnquoted'/>"
 "      <placeholder name='ClipboardSection'/>"
 "      <separator/>"
 "      <menuitem action='ShowMarks'/>"
+"      <menuitem action='ClearMarks'/>"
 "      <placeholder name='MarksSection'/>"
 "      <separator/>"
 "    </menu>"
 "    <menu action='EditMenu'>"
-"      <menu action='ExternalMenu'>"
-"      </menu>"
 "      <placeholder name='EditSection'/>"
 "      <separator/>"
 "      <menu action='OrientationMenu'>"
@@ -1994,14 +2259,15 @@ static const gchar *menu_ui_description =
 "        <separator/>"
 "      </menu>"
 "      <menuitem action='SaveMetadata'/>"
+"      <menuitem action='KeywordAutocomplete'/>"
 "      <placeholder name='PropertiesSection'/>"
 "      <separator/>"
-"        <menu action='PreferencesMenu'>"
-"        <menuitem action='Preferences'/>"
-"        <menuitem action='Editors'/>"
-"        <menuitem action='LayoutConfig'/>"
-"        <menuitem action='Maintenance'/>"
-"      </menu>"
+"      <menuitem action='DrawRectangle'/>"
+"      <separator/>"
+"      <menuitem action='Preferences'/>"
+"      <menuitem action='Plugins'/>"
+"      <menuitem action='LayoutConfig'/>"
+"      <menuitem action='Maintenance'/>"
 "      <placeholder name='PreferencesSection'/>"
 "      <separator/>"
 #if !GTK_CHECK_VERSION(3,0,0)
@@ -2009,6 +2275,8 @@ static const gchar *menu_ui_description =
 #endif
 "      <separator/>"
 "    </menu>"
+"    <menu action='PluginsMenu'>"
+"    </menu>"
 "    <menu action='ViewMenu'>"
 "      <menuitem action='ViewInNewWindow'/>"
 "      <menuitem action='PanView'/>"
@@ -2091,6 +2359,7 @@ static const gchar *menu_ui_description =
 "      </menu>"
 "      <menu action='OverlayMenu'>"
 "        <menuitem action='ImageOverlay'/>"
+"        <menuitem action='ImageGuidelines'/>"
 "        <menuitem action='ImageHistogram'/>"
 "        <menuitem action='ImageOverlayCycle'/>"
 "        <separator/>"
@@ -2105,6 +2374,7 @@ static const gchar *menu_ui_description =
 "        <menuitem action='HistogramModeLog'/>"
 "        <menuitem action='HistogramModeCycle'/>"
 "      </menu>"
+"      <menuitem action='OverUnderExposed'/>"
 "      <menuitem action='FullScreen'/>"
 "      <placeholder name='ViewSection'/>"
 "      <separator/>"
@@ -2124,9 +2394,13 @@ static const gchar *menu_ui_description =
 "      <placeholder name='SlideShowSection'/>"
 "      <separator/>"
 "    </menu>"
+"    <menu action='SarMenu'>"
+"      <menuitem action='SearchAndRunCommand'/>"
+"    </menu>"
 "    <menu action='HelpMenu'>"
 "      <separator/>"
 "      <menuitem action='HelpContents'/>"
+"      <menuitem action='HelpSearch'/>"
 "      <menuitem action='HelpShortcuts'/>"
 "      <menuitem action='HelpKbd'/>"
 "      <menuitem action='HelpNotes'/>"
@@ -2140,24 +2414,8 @@ static const gchar *menu_ui_description =
 "    </menu>"
 "  </menubar>"
 "  <toolbar name='ToolBar'>"
-"    <toolitem action='Thumbnails'/>"
-"    <toolitem action='Back'/>"
-"    <toolitem action='Forward'/>"
-"    <toolitem action='Up'/>"
-"    <toolitem action='Home'/>"
-"    <toolitem action='Refresh'/>"
-"    <toolitem action='ZoomIn'/>"
-"    <toolitem action='ZoomOut'/>"
-"    <toolitem action='ZoomFit'/>"
-"    <toolitem action='Zoom100'/>"
-"    <toolitem action='Preferences'/>"
-"    <toolitem action='FloatTools'/>"
 "  </toolbar>"
 "  <toolbar name='StatusBar'>"
-"    <toolitem action='ExifRotate'/>"
-"    <toolitem action='ShowInfoPixel'/>"
-"    <toolitem action='UseColorProfiles'/>"
-"    <toolitem action='SaveMetadata'/>"
 "  </toolbar>"
 "<accelerator action='PrevImageAlt1'/>"
 "<accelerator action='PrevImageAlt2'/>"
@@ -2438,6 +2696,8 @@ static void layout_actions_setup_editors(LayoutWindow *lw)
 void layout_actions_setup(LayoutWindow *lw)
 {
        GError *error;
+       gint i;
+       GtkAction *action;
 
        DEBUG_1("%s layout_actions_setup: start", get_exec_time());
        if (lw->ui_manager) return;
@@ -2485,6 +2745,13 @@ void layout_actions_setup(LayoutWindow *lw)
                exit(EXIT_FAILURE);
                }
 
+       DEBUG_1("%s layout_actions_setup: add toolbar", get_exec_time());
+       for (i = 0; i < TOOLBAR_COUNT; i++)
+               {
+               layout_toolbar_clear(lw, i);
+               layout_toolbar_add_default(lw, i);
+               }
+
        DEBUG_1("%s layout_actions_setup: marks", get_exec_time());
        layout_actions_setup_marks(lw);
 
@@ -2528,6 +2795,10 @@ static gboolean layout_editors_reload_idle_cb(gpointer data)
                        LayoutWindow *lw = work->data;
                        work = work->next;
                        layout_actions_setup_editors(lw);
+                       if (lw->bar_sort_enabled)
+                               {
+                               layout_bar_sort_toggle(lw);
+                               }
                        }
 
                DEBUG_1("%s layout_editors_reload_idle_cb: setup_editors done", get_exec_time());
@@ -2606,6 +2877,226 @@ GtkWidget *layout_actions_toolbar(LayoutWindow *lw, ToolbarType type)
        return lw->toolbar[type];
 }
 
+GtkWidget *layout_actions_menu_tool_bar(LayoutWindow *lw)
+{
+       GtkWidget *menu_bar;
+       GtkWidget *toolbar;
+
+       if (lw->menu_tool_bar) return lw->menu_tool_bar;
+
+       menu_bar = layout_actions_menu_bar(lw);
+       DEBUG_NAME(menu_bar);
+       toolbar = layout_actions_toolbar(lw, TOOLBAR_MAIN);
+       DEBUG_NAME(toolbar);
+       lw->menu_tool_bar = gtk_vbox_new(FALSE, 0);
+
+       gtk_box_pack_start(GTK_BOX(lw->menu_tool_bar), menu_bar, FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(lw->menu_tool_bar), toolbar, FALSE, FALSE, 0);
+
+       g_object_ref(lw->menu_tool_bar);
+       return lw->menu_tool_bar;
+}
+
+void layout_toolbar_clear(LayoutWindow *lw, ToolbarType type)
+{
+       if (lw->toolbar_merge_id[type])
+               {
+               gtk_ui_manager_remove_ui(lw->ui_manager, lw->toolbar_merge_id[type]);
+               gtk_ui_manager_ensure_update(lw->ui_manager);
+               }
+       string_list_free(lw->toolbar_actions[type]);
+       lw->toolbar_actions[type] = NULL;
+
+       lw->toolbar_merge_id[type] = gtk_ui_manager_new_merge_id(lw->ui_manager);
+}
+
+void layout_toolbar_add(LayoutWindow *lw, ToolbarType type, const gchar *action)
+{
+       const gchar *path = NULL;
+
+       if (!action || !lw->ui_manager) return;
+
+       if (g_list_find_custom(lw->toolbar_actions[type], action, (GCompareFunc)strcmp)) return;
+
+       switch (type)
+               {
+               case TOOLBAR_MAIN:
+                       path = "/ToolBar";
+                       break;
+               case TOOLBAR_STATUS:
+                       path = "/StatusBar";
+                       break;
+               default:
+                       break;
+               }
+
+
+       if (g_str_has_suffix(action, ".desktop"))
+               {
+               /* this may be called before the external editors are read
+                  create a dummy action for now */
+               if (!lw->action_group_editors)
+                       {
+                       lw->action_group_editors = gtk_action_group_new("MenuActionsExternal");
+                       gtk_ui_manager_insert_action_group(lw->ui_manager, lw->action_group_editors, 1);
+                       }
+               if (!gtk_action_group_get_action(lw->action_group_editors, action))
+                       {
+                       GtkActionEntry entry = { action,
+                                                GTK_STOCK_MISSING_IMAGE,
+                                                action,
+                                                NULL,
+                                                NULL,
+                                                NULL };
+                       DEBUG_1("Creating temporary action %s", action);
+                       gtk_action_group_add_actions(lw->action_group_editors, &entry, 1, lw);
+                       }
+               }
+       gtk_ui_manager_add_ui(lw->ui_manager, lw->toolbar_merge_id[type], path, action, action, GTK_UI_MANAGER_TOOLITEM, FALSE);
+       lw->toolbar_actions[type] = g_list_append(lw->toolbar_actions[type], g_strdup(action));
+}
+
+
+void layout_toolbar_add_default(LayoutWindow *lw, ToolbarType type)
+{
+       LayoutWindow *lw_first;
+       GList *work_action;
+
+       switch (type)
+               {
+               case TOOLBAR_MAIN:
+                       if (layout_window_list)
+                               {
+                               lw_first = layout_window_list->data;
+                               if (lw_first->toolbar_actions[TOOLBAR_MAIN])
+                                       {
+                                       work_action = lw_first->toolbar_actions[type];
+                                       while (work_action)
+                                               {
+                                               gchar *action = work_action->data;
+                                               work_action = work_action->next;
+                                               layout_toolbar_add(lw, type, action);
+                                               }
+                                       }
+                               else
+                                       {
+                                       layout_toolbar_add(lw, type, "Thumbnails");
+                                       layout_toolbar_add(lw, type, "Back");
+                                       layout_toolbar_add(lw, type, "Forward");
+                                       layout_toolbar_add(lw, type, "Up");
+                                       layout_toolbar_add(lw, type, "Home");
+                                       layout_toolbar_add(lw, type, "Refresh");
+                                       layout_toolbar_add(lw, type, "ZoomIn");
+                                       layout_toolbar_add(lw, type, "ZoomOut");
+                                       layout_toolbar_add(lw, type, "ZoomFit");
+                                       layout_toolbar_add(lw, type, "Zoom100");
+                                       layout_toolbar_add(lw, type, "Preferences");
+                                       layout_toolbar_add(lw, type, "FloatTools");
+                                       }
+                               }
+                       else
+                               {
+                               layout_toolbar_add(lw, type, "Thumbnails");
+                               layout_toolbar_add(lw, type, "Back");
+                               layout_toolbar_add(lw, type, "Forward");
+                               layout_toolbar_add(lw, type, "Up");
+                               layout_toolbar_add(lw, type, "Home");
+                               layout_toolbar_add(lw, type, "Refresh");
+                               layout_toolbar_add(lw, type, "ZoomIn");
+                               layout_toolbar_add(lw, type, "ZoomOut");
+                               layout_toolbar_add(lw, type, "ZoomFit");
+                               layout_toolbar_add(lw, type, "Zoom100");
+                               layout_toolbar_add(lw, type, "Preferences");
+                               layout_toolbar_add(lw, type, "FloatTools");
+                               }
+                       break;
+               case TOOLBAR_STATUS:
+                       if (layout_window_list)
+                               {
+                               lw_first = layout_window_list->data;
+                               if (lw_first->toolbar_actions[TOOLBAR_MAIN])
+                                       {
+                                       work_action = lw_first->toolbar_actions[type];
+                                       while (work_action)
+                                               {
+                                               gchar *action = work_action->data;
+                                               work_action = work_action->next;
+                                               layout_toolbar_add(lw, type, action);
+                                               }
+                                       }
+                               else
+                                       {
+                                       layout_toolbar_add(lw, type, "ExifRotate");
+                                       layout_toolbar_add(lw, type, "ShowInfoPixel");
+                                       layout_toolbar_add(lw, type, "UseColorProfiles");
+                                       layout_toolbar_add(lw, type, "SaveMetadata");
+                                       }
+                               }
+                       else
+                               {
+                               layout_toolbar_add(lw, type, "ExifRotate");
+                               layout_toolbar_add(lw, type, "ShowInfoPixel");
+                               layout_toolbar_add(lw, type, "UseColorProfiles");
+                               layout_toolbar_add(lw, type, "SaveMetadata");
+                               }
+                       break;
+               default:
+                       break;
+               }
+}
+
+
+
+void layout_toolbar_write_config(LayoutWindow *lw, ToolbarType type, GString *outstr, gint indent)
+{
+       const gchar *name = NULL;
+       GList *work = lw->toolbar_actions[type];
+
+       switch (type)
+               {
+               case TOOLBAR_MAIN:
+                       name = "toolbar";
+                       break;
+               case TOOLBAR_STATUS:
+                       name = "statusbar";
+                       break;
+               default:
+                       break;
+               }
+
+       WRITE_NL(); WRITE_STRING("<%s>", name);
+       indent++;
+       WRITE_NL(); WRITE_STRING("<clear/>");
+       while (work)
+               {
+               gchar *action = work->data;
+               work = work->next;
+               WRITE_NL(); WRITE_STRING("<toolitem ");
+               write_char_option(outstr, indent + 1, "action", action);
+               WRITE_STRING("/>");
+               }
+       indent--;
+       WRITE_NL(); WRITE_STRING("</%s>", name);
+}
+
+void layout_toolbar_add_from_config(LayoutWindow *lw, ToolbarType type, const char **attribute_names, const gchar **attribute_values)
+{
+       gchar *action = NULL;
+
+       while (*attribute_names)
+               {
+               const gchar *option = *attribute_names++;
+               const gchar *value = *attribute_values++;
+
+               if (READ_CHAR_FULL("action", action)) continue;
+
+               log_printf("unknown attribute %s = %s\n", option, value);
+               }
+
+       layout_toolbar_add(lw, type, action);
+       g_free(action);
+}
+
 /*
  *-----------------------------------------------------------------------------
  * misc
@@ -2725,6 +3216,16 @@ void layout_util_sync_color(LayoutWindow *lw)
        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), layout_image_get_desaturate(lw));
 }
 
+void layout_util_sync_file_filter(LayoutWindow *lw)
+{
+       GtkAction *action;
+
+       if (!lw->action_group) return;
+
+       action = gtk_action_group_get_action(lw->action_group, "ShowFileFilter");
+       gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->options.show_file_filter);
+}
+
 void layout_util_sync_marks(LayoutWindow *lw)
 {
        GtkAction *action;
@@ -2787,12 +3288,27 @@ static void layout_util_sync_views(LayoutWindow *lw)
        action = gtk_action_group_get_action(lw->action_group, "ImageHistogram");
        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), osd_flags & OSD_SHOW_HISTOGRAM);
 
+       action = gtk_action_group_get_action(lw->action_group, "ImageGuidelines");
+       gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), osd_flags & OSD_SHOW_GUIDELINES);
+
        action = gtk_action_group_get_action(lw->action_group, "ExifRotate");
        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), options->image.exif_rotate_enable);
 
+       action = gtk_action_group_get_action(lw->action_group, "OverUnderExposed");
+       gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), options->overunderexposed);
+
+       action = gtk_action_group_get_action(lw->action_group, "DrawRectangle");
+       gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), options->draw_rectangle);
+
        action = gtk_action_group_get_action(lw->action_group, "RectangularSelection");
        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), options->collections.rectangular_selection);
 
+       action = gtk_action_group_get_action(lw->action_group, "ShowFileFilter");
+       gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->options.show_file_filter);
+
+       action = gtk_action_group_get_action(lw->action_group, "HideBars");
+       gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), (lw->options.bars_state.hidden));
+
        if (osd_flags & OSD_SHOW_HISTOGRAM)
                {
                action = gtk_action_group_get_action(lw->action_group, "HistogramChanR");
@@ -2838,6 +3354,34 @@ void layout_util_sync(LayoutWindow *lw)
 //     layout_menu_edit_update(lw);
 }
 
+/**
+ * @brief Checks if event key is mapped to Help
+ * @param event 
+ * @returns 
+ * 
+ * Used to check if the user has re-mapped the Help key
+ * in Preferences/Keyboard
+ * 
+ * Note: help_key.accel_mods and event->state
+ * differ in the higher bits
+ */
+gboolean is_help_key(GdkEventKey *event)
+{
+       GtkAccelKey help_key;
+       gboolean ret = FALSE;
+       guint mask = GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK;
+
+       if (gtk_accel_map_lookup_entry("<Actions>/MenuActions/HelpContents", &help_key))
+               {
+               if (help_key.accel_key == event->keyval &&
+                                       (help_key.accel_mods & mask) == (event->state & mask))
+                       {
+                       ret = TRUE;
+                       }
+               }
+
+       return ret;
+}
 
 /*
  *-----------------------------------------------------------------------------
@@ -2870,6 +3414,7 @@ static void layout_bar_set_default(LayoutWindow *lw)
        if (!lw->utility_box) return;
 
        bar = bar_new(lw);
+       DEBUG_NAME(bar);
 
        layout_bar_set(lw, bar);
 
@@ -3017,7 +3562,14 @@ static void layout_bars_hide_toggle(LayoutWindow *lw)
                lw->options.bars_state.hidden = FALSE;
                if (lw->options.bars_state.sort)
                        {
-                       gtk_widget_show(lw->bar_sort);
+                       if (lw->bar_sort)
+                               {
+                               gtk_widget_show(lw->bar_sort);
+                               }
+                       else
+                               {
+                               layout_bar_sort_set_default(lw);
+                               }
                        }
                if (lw->options.bars_state.info)
                        {
@@ -3034,7 +3586,11 @@ static void layout_bars_hide_toggle(LayoutWindow *lw)
                lw->options.bars_state.tools_float = lw->options.tools_float;
                lw->options.bars_state.tools_hidden = lw->options.tools_hidden;
 
-               gtk_widget_hide(lw->bar);
+               if (lw->bar)
+                       {
+                       gtk_widget_hide(lw->bar);
+                       }
+
                if (lw->bar_sort)
                        gtk_widget_hide(lw->bar_sort);
                layout_tools_float_set(lw, lw->options.tools_float, TRUE);
@@ -3064,6 +3620,7 @@ GtkWidget *layout_bars_prepare(LayoutWindow *lw, GtkWidget *image)
        if (lw->utility_box) return lw->utility_box;
        lw->utility_box = gtk_hbox_new(FALSE, PREF_PAD_GAP);
        lw->utility_paned = gtk_hpaned_new();
+       DEBUG_NAME(lw->utility_paned);
        gtk_box_pack_start(GTK_BOX(lw->utility_box), lw->utility_paned, TRUE, TRUE, 0);
 
        gtk_paned_pack1(GTK_PANED(lw->utility_paned), image, TRUE, FALSE);
@@ -3098,4 +3655,15 @@ void layout_exif_window_new(LayoutWindow *lw)
        advanced_exif_set_fd(lw->exif_window, layout_image_get_fd(lw));
 }
 
+static void layout_search_and_run_window_new(LayoutWindow *lw)
+{
+       if (lw->sar_window)
+               {
+               gtk_window_present(GTK_WINDOW(lw->sar_window));
+               return;
+               }
+
+       lw->sar_window = search_and_run_new(lw);
+}
+
 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */