#include "pixbuf_util.h"
#include "preferences.h"
#include "print.h"
+#include "rcfile.h"
#include "search.h"
+#include "slideshow.h"
#include "ui_fileops.h"
#include "ui_menu.h"
#include "ui_misc.h"
{
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)
gd = generic_dialog_new(_("Image orientation"),
"Image orientation", NULL, TRUE, NULL, NULL);
generic_dialog_add_message(gd, GTK_STOCK_DIALOG_ERROR,
- "Image orientation", message->str);
+ "Image orientation", message->str, TRUE);
generic_dialog_add_button(gd, GTK_STOCK_OK, NULL, NULL, TRUE);
gtk_widget_show(gd->dialog);
static void layout_menu_rectangular_selection_cb(GtkToggleAction *action, gpointer data)
{
- LayoutWindow *lw = data;
-
options->collections.rectangular_selection = gtk_toggle_action_get_active(action);
}
layout_image_slideshow_pause_toggle(lw);
}
+static void layout_menu_slideshow_slower_cb(GtkAction *action, gpointer data)
+{
+ options->slideshow.delay = options->slideshow.delay + 5;
+ if (options->slideshow.delay > SLIDESHOW_MAX_SECONDS)
+ options->slideshow.delay = SLIDESHOW_MAX_SECONDS;
+}
+
+static void layout_menu_slideshow_faster_cb(GtkAction *action, gpointer data)
+{
+ options->slideshow.delay = options->slideshow.delay - 5;
+ if (options->slideshow.delay < SLIDESHOW_MIN_SECONDS * 10)
+ options->slideshow.delay = SLIDESHOW_MIN_SECONDS * 10;
+}
+
static void layout_menu_stereo_mode_next_cb(GtkAction *action, gpointer data)
{
help_window_show("release_notes");
}
+static void layout_menu_changelog_cb(GtkAction *action, gpointer data)
+{
+ LayoutWindow *lw = data;
+
+ layout_exit_fullscreen(lw);
+ help_window_show("changelog");
+}
+
static char *keyboard_map_hardcoded[][2] = {
{"Scroll","Left"},
{"FastScroll", "<Shift>Left"},
static void layout_menu_kbd_map_cb(GtkAction *action, gpointer data)
{
- LayoutWindow *lw = data;
gint fd = -1;
GPtrArray *array;
char * tmp_file;
fd = g_file_open_tmp("geeqie_keymap_XXXXXX.svg", &tmp_file, &error);
if (error)
{
- DEBUG_0("Keyboard Map - cannot create file:%s\n",error->message);
+ log_printf("Error: Keyboard Map - cannot create file:%s\n",error->message);
g_error_free(error);
}
else
converted_line = g_strconcat(pre_key[0], ">", key_name, "<", post_key[1], "\n", NULL);
g_io_channel_write_chars(channel, converted_line, -1, NULL, &error);
- if (error) {DEBUG_0("Keyboard Map:%s\n",error->message); g_error_free(error);}
+ if (error) {log_printf("Warning: Keyboard Map:%s\n",error->message); g_error_free(error);}
g_free(converted_line);
g_strfreev(pre_key);
else
{
g_io_channel_write_chars(channel, keymap_template[keymap_index], -1, NULL, &error);
- if (error) {DEBUG_0("Keyboard Map:%s\n",error->message); g_error_free(error);}
+ if (error) {log_printf("Warning: Keyboard Map:%s\n",error->message); g_error_free(error);}
g_io_channel_write_chars(channel, "\n", -1, NULL, &error);
- if (error) {DEBUG_0("Keyboard Map:%s\n",error->message); g_error_free(error);}
+ if (error) {log_printf("Warning: Keyboard Map:%s\n",error->message); g_error_free(error);}
}
keymap_index++;
}
g_io_channel_flush(channel, &error);
- if (error) {DEBUG_0("Keyboard Map:%s\n",error->message); g_error_free(error);}
+ if (error) {log_printf("Warning: Keyboard Map:%s\n",error->message); g_error_free(error);}
g_io_channel_unref(channel);
index=0;
LayoutWindow *lw = data;
layout_exit_fullscreen(lw);
- show_about_window();
+ show_about_window(lw);
}
static void layout_menu_log_window_cb(GtkAction *action, gpointer data)
{
LayoutWindow *lw = data;
FileData *dir_fd;
- gchar *path = NULL;
- GList *list = history_list_get_by_key("path_list");
- gint n = 0;
- while (list)
- {
- if (n == 1) {
- /* Previous path from history */
- path = (gchar *)list->data;
- break;
- }
- list = list->next;
- n++;
- }
+ /* Obtain previous path */
+ dir_fd = file_data_new_dir(history_chain_back());
+ layout_set_fd(lw, dir_fd);
+ file_data_unref(dir_fd);
+}
- if (!path) return;
+static void layout_menu_forward_cb(GtkAction *action, gpointer data)
+{
+ LayoutWindow *lw = data;
+ FileData *dir_fd;
- /* Open previous path */
- dir_fd = file_data_new_dir(path);
+ /* Obtain next path */
+ dir_fd = file_data_new_dir(history_chain_forward());
layout_set_fd(lw, dir_fd);
file_data_unref(dir_fd);
}
{ "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 },
{ "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 },
{ "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) },
{ "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) },
{ "OpenRecent", NULL, N_("Open recen_t"), NULL, N_("Open recent"), 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", GTK_STOCK_FILE, 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) },
{ "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) },
{ "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) },
{ "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", GTK_STOCK_FILE, N_("_Thumbnail maintenance..."), NULL, N_("Thumbnail 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) },
{ "ZoomIn", GTK_STOCK_ZOOM_IN, N_("Zoom _in"), "equal", N_("Zoom in"), CB(layout_menu_zoom_in_cb) },
{ "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", GTK_STOCK_FILE, N_("Fit _Horizontally"), "H", N_("Fit Horizontally"), CB(layout_menu_zoom_fit_hor_cb) },
+ { "ZoomFillVert", GTK_STOCK_FILE, 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) },
{ "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", GTK_STOCK_FILE, 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", GTK_STOCK_FILE, N_("Faster"), "<control>KP_Add", N_("Faster"), CB(layout_menu_slideshow_faster_cb) },
+ { "SlideShowSlower", GTK_STOCK_FILE, N_("Slower"), "<control>KP_Subtract", N_("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) },
{ "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) },
{ "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", GTK_STOCK_FILE, 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) },
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", GTK_STOCK_FILE, N_("Show _Marks"), "M", N_("Show Marks"), CB(layout_menu_marks_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", GTK_STOCK_FILE, N_("_Info sidebar"), "<control>K", N_("Info sidebar"), CB(layout_menu_bar_cb), FALSE },
+ { "SBarSort", GTK_STOCK_FILE, 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},
" <menuitem action='LastImage'/>"
" <separator/>"
" <menuitem action='Back'/>"
+" <menuitem action='Forward'/>"
" <menuitem action='Up'/>"
" <menuitem action='Home'/>"
" <separator/>"
" <placeholder name='SelectSection'/>"
" <separator/>"
" <menuitem action='CopyPath'/>"
+" <menuitem action='CopyPathUnquoted'/>"
" <placeholder name='ClipboardSection'/>"
" <separator/>"
" <menuitem action='ShowMarks'/>"
" <separator/>"
" </menu>"
" <menu action='EditMenu'>"
-" <menu action='ExternalMenu'>"
-" </menu>"
" <placeholder name='EditSection'/>"
" <separator/>"
" <menu action='OrientationMenu'>"
" <menuitem action='SaveMetadata'/>"
" <placeholder name='PropertiesSection'/>"
" <separator/>"
-" <menu action='PreferencesMenu'>"
-" <menuitem action='Preferences'/>"
-" <menuitem action='Editors'/>"
-" <menuitem action='LayoutConfig'/>"
-" <menuitem action='Maintenance'/>"
-" </menu>"
+" <menuitem action='Preferences'/>"
+" <menuitem action='Plugins'/>"
+" <menuitem action='LayoutConfig'/>"
+" <menuitem action='Maintenance'/>"
" <placeholder name='PreferencesSection'/>"
" <separator/>"
#if !GTK_CHECK_VERSION(3,0,0)
#endif
" <separator/>"
" </menu>"
+" <menu action='PluginsMenu'>"
+" </menu>"
" <menu action='ViewMenu'>"
" <menuitem action='ViewInNewWindow'/>"
" <menuitem action='PanView'/>"
" <menuitem action='Animate'/>"
" <menuitem action='SlideShow'/>"
" <menuitem action='SlideShowPause'/>"
+" <menuitem action='SlideShowFaster'/>"
+" <menuitem action='SlideShowSlower'/>"
+" <separator/>"
" <menuitem action='Refresh'/>"
" <placeholder name='SlideShowSection'/>"
" <separator/>"
" <menuitem action='HelpShortcuts'/>"
" <menuitem action='HelpKbd'/>"
" <menuitem action='HelpNotes'/>"
+" <menuitem action='HelpChangeLog'/>"
" <placeholder name='HelpSection'/>"
" <separator/>"
" <menuitem action='About'/>"
" </menu>"
" </menubar>"
" <toolbar name='ToolBar'>"
-" <toolitem action='Thumbnails'/>"
-" <toolitem action='Back'/>"
-" <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'/>"
gtk_action_group_add_actions(lw->action_group, &entry, 1, lw);
action = gtk_action_group_get_action(lw->action_group, name);
- g_object_set_data(G_OBJECT(action), "mark_num", GINT_TO_POINTER(mark));
+ g_object_set_data(G_OBJECT(action), "mark_num", GINT_TO_POINTER(mark > 0 ? mark : 10));
}
static void layout_actions_setup_marks(LayoutWindow *lw)
for (mark = 1; mark <= FILEDATA_MARKS_SIZE; mark++)
{
- layout_actions_setup_mark(lw, mark, "Mark%d", _("Mark _%d"), NULL, NULL, NULL);
- layout_actions_setup_mark(lw, mark, "SetMark%d", _("_Set mark %d"), NULL, _("Set mark %d"), G_CALLBACK(layout_menu_set_mark_sel_cb));
- layout_actions_setup_mark(lw, mark, "ResetMark%d", _("_Reset mark %d"), NULL, _("Reset mark %d"), G_CALLBACK(layout_menu_res_mark_sel_cb));
- layout_actions_setup_mark(lw, mark, "ToggleMark%d", _("_Toggle mark %d"), "%d", _("Toggle mark %d"), G_CALLBACK(layout_menu_toggle_mark_sel_cb));
- layout_actions_setup_mark(lw, mark, "ToggleMark%dAlt1", _("_Toggle mark %d"), "KP_%d", _("Toggle mark %d"), G_CALLBACK(layout_menu_toggle_mark_sel_cb));
- layout_actions_setup_mark(lw, mark, "SelectMark%d", _("Se_lect mark %d"), "<control>%d", _("Select mark %d"), G_CALLBACK(layout_menu_sel_mark_cb));
- layout_actions_setup_mark(lw, mark, "SelectMark%dAlt1", _("_Select mark %d"), "<control>KP_%d", _("Select mark %d"), G_CALLBACK(layout_menu_sel_mark_cb));
- layout_actions_setup_mark(lw, mark, "AddMark%d", _("_Add mark %d"), NULL, _("Add mark %d"), G_CALLBACK(layout_menu_sel_mark_or_cb));
- layout_actions_setup_mark(lw, mark, "IntMark%d", _("_Intersection with mark %d"), NULL, _("Intersection with mark %d"), G_CALLBACK(layout_menu_sel_mark_and_cb));
- layout_actions_setup_mark(lw, mark, "UnselMark%d", _("_Unselect mark %d"), NULL, _("Unselect mark %d"), G_CALLBACK(layout_menu_sel_mark_minus_cb));
- layout_actions_setup_mark(lw, mark, "FilterMark%d", _("_Filter mark %d"), NULL, _("Filter mark %d"), G_CALLBACK(layout_menu_mark_filter_toggle_cb));
+ gint i = (mark < 10 ? mark : 0);
+
+ layout_actions_setup_mark(lw, i, "Mark%d", _("Mark _%d"), NULL, NULL, NULL);
+ layout_actions_setup_mark(lw, i, "SetMark%d", _("_Set mark %d"), NULL, _("Set mark %d"), G_CALLBACK(layout_menu_set_mark_sel_cb));
+ layout_actions_setup_mark(lw, i, "ResetMark%d", _("_Reset mark %d"), NULL, _("Reset mark %d"), G_CALLBACK(layout_menu_res_mark_sel_cb));
+ layout_actions_setup_mark(lw, i, "ToggleMark%d", _("_Toggle mark %d"), "%d", _("Toggle mark %d"), G_CALLBACK(layout_menu_toggle_mark_sel_cb));
+ layout_actions_setup_mark(lw, i, "ToggleMark%dAlt1", _("_Toggle mark %d"), "KP_%d", _("Toggle mark %d"), G_CALLBACK(layout_menu_toggle_mark_sel_cb));
+ layout_actions_setup_mark(lw, i, "SelectMark%d", _("Se_lect mark %d"), "<control>%d", _("Select mark %d"), G_CALLBACK(layout_menu_sel_mark_cb));
+ layout_actions_setup_mark(lw, i, "SelectMark%dAlt1", _("_Select mark %d"), "<control>KP_%d", _("Select mark %d"), G_CALLBACK(layout_menu_sel_mark_cb));
+ layout_actions_setup_mark(lw, i, "AddMark%d", _("_Add mark %d"), NULL, _("Add mark %d"), G_CALLBACK(layout_menu_sel_mark_or_cb));
+ layout_actions_setup_mark(lw, i, "IntMark%d", _("_Intersection with mark %d"), NULL, _("Intersection with mark %d"), G_CALLBACK(layout_menu_sel_mark_and_cb));
+ layout_actions_setup_mark(lw, i, "UnselMark%d", _("_Unselect mark %d"), NULL, _("Unselect mark %d"), G_CALLBACK(layout_menu_sel_mark_minus_cb));
+ layout_actions_setup_mark(lw, i, "FilterMark%d", _("_Filter mark %d"), NULL, _("Filter mark %d"), G_CALLBACK(layout_menu_mark_filter_toggle_cb));
g_string_append_printf(desc,
" <menu action='Mark%d'>"
" <separator/>"
" <menuitem action='FilterMark%d'/>"
" </menu>",
- mark, mark, mark, mark, mark, mark, mark, mark, mark);
+ i, i, i, i, i, i, i, i, i);
}
g_string_append(desc,
" </menubar>");
for (mark = 1; mark <= FILEDATA_MARKS_SIZE; mark++)
{
+ gint i = (mark < 10 ? mark : 0);
+
g_string_append_printf(desc,
"<accelerator action='ToggleMark%dAlt1'/>"
"<accelerator action='SelectMark%dAlt1'/>",
- mark, mark);
+ i, i);
}
g_string_append(desc, "</ui>" );
void layout_actions_setup(LayoutWindow *lw)
{
GError *error;
- gint i;
DEBUG_1("%s layout_actions_setup: start", get_exec_time());
if (lw->ui_manager) return;
exit(EXIT_FAILURE);
}
+ layout_toolbar_clear(lw, TOOLBAR_MAIN);
+ layout_toolbar_add_default(lw, TOOLBAR_MAIN);
+
DEBUG_1("%s layout_actions_setup: marks", get_exec_time());
layout_actions_setup_marks(lw);
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());
return lw->toolbar[type];
}
+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;
+ 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;
+ 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;
+ 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
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), layout_image_get_desaturate(lw));
}
+void layout_util_sync_marks(LayoutWindow *lw)
+{
+ GtkAction *action;
+
+ if (!lw->action_group) return;
+
+ action = gtk_action_group_get_action(lw->action_group, "ShowMarks");
+ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->options.show_marks);
+}
+
static void layout_util_sync_views(LayoutWindow *lw)
{
GtkAction *action;
action = gtk_action_group_get_action(lw->action_group, "ShowInfoPixel");
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->options.show_info_pixel);
- action = gtk_action_group_get_action(lw->action_group, "ShowMarks");
- gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->options.show_marks);
-
action = gtk_action_group_get_action(lw->action_group, "SlideShow");
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), layout_image_slideshow_active(lw));
gtk_action_set_sensitive(action, lw->split_mode != SPLIT_NONE);
action = gtk_action_group_get_action(lw->action_group, "WriteRotation");
- gtk_action_set_sensitive(action, !(runcmd("which exiftran >/dev/null") ||
- runcmd("which mogrify >/dev/null") || options->metadata.write_orientation));
+ gtk_action_set_sensitive(action, !(runcmd("which exiftran >/dev/null 2>&1") ||
+ runcmd("which mogrify >/dev/null 2>&1") || options->metadata.write_orientation));
action = gtk_action_group_get_action(lw->action_group, "WriteRotationKeepDate");
- gtk_action_set_sensitive(action, !(runcmd("which exiftran >/dev/null") ||
- runcmd("which mogrify >/dev/null") || options->metadata.write_orientation));
+ gtk_action_set_sensitive(action, !(runcmd("which exiftran >/dev/null 2>&1") ||
+ runcmd("which mogrify >/dev/null 2>&1") || options->metadata.write_orientation));
action = gtk_action_group_get_action(lw->action_group, "StereoAuto");
gtk_radio_action_set_current_value(GTK_RADIO_ACTION(action), layout_image_stereo_pixbuf_get(lw));
+ layout_util_sync_marks(lw);
layout_util_sync_color(lw);
}