# HG changeset patch # User Colin Clark # Date 1526494932 -3600 # Node ID f2f01d556f516adca798091938a59cc9b561cc33 # Parent db7fa530da47e5e5baa43ed38a205338175ef476 Fix #597: Help file search https://github.com/BestImageViewer/geeqie/issues/597 Only on-line help files are searched. Search engine defined in Preferences/General. Local help files are not searched. diff -r db7fa530da47 -r f2f01d556f51 doc/docbook/GuideMainWindowMenus.xml --- a/doc/docbook/GuideMainWindowMenus.xml Wed May 16 10:04:01 2018 +0100 +++ b/doc/docbook/GuideMainWindowMenus.xml Wed May 16 19:22:12 2018 +0100 @@ -1445,6 +1445,20 @@ + On-line help search + + + + + Use a web browser to search Geeqie's on-line help files. The search engine used is defined in + Preferences General + . + + + + + + Keyboard shortcuts diff -r db7fa530da47 -r f2f01d556f51 doc/docbook/GuideOptionsGeneral.xml --- a/doc/docbook/GuideOptionsGeneral.xml Wed May 16 10:04:01 2018 +0100 +++ b/doc/docbook/GuideOptionsGeneral.xml Wed May 16 19:22:12 2018 +0100 @@ -222,4 +222,15 @@ +
+ On-line help search + + An internet search engine may be used to search the help files on Geeqie's website. The string used to conduct the search is defined here. In most cases it will be in one of two formats: + + https://www.search-engine.com/search?q=site:geeqie.org/help + + https://www.search-engine.com/?q=site:geeqie.org/help' + + +
diff -r db7fa530da47 -r f2f01d556f51 src/layout_util.c --- a/src/layout_util.c Wed May 16 10:04:01 2018 +0100 +++ b/src/layout_util.c Wed May 16 19:22:12 2018 +0100 @@ -1125,6 +1125,14 @@ 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; @@ -1886,6 +1894,7 @@ { "SlideShowSlower", GTK_STOCK_FILE, N_("Slower"), "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) }, + { "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) }, @@ -2189,6 +2198,7 @@ " " " " " " +" " " " " " " " diff -r db7fa530da47 -r f2f01d556f51 src/main.h --- a/src/main.h Wed May 16 10:04:01 2018 +0100 +++ b/src/main.h Wed May 16 19:22:12 2018 +0100 @@ -125,6 +125,8 @@ #define DESKTOP_FILE_TEMPLATE GQ_APP_DIR "/template.desktop" #define TIMEZONE_DATABASE "timezone21.bin" + +#define HELP_SEARCH_ENGINE "https://duckduckgo.com/?q=site:geeqie.org/help " /* *---------------------------------------------------------------------------- * main.c diff -r db7fa530da47 -r f2f01d556f51 src/options.c --- a/src/options.c Wed May 16 10:04:01 2018 +0100 +++ b/src/options.c Wed May 16 19:22:12 2018 +0100 @@ -220,6 +220,8 @@ { options->marks_tooltips[i] = g_strdup_printf("%s%d", _("Mark "), i + 1); } + + options->help_search_engine = g_strdup(HELP_SEARCH_ENGINE); } void copy_layout_options(LayoutOptions *dest, const LayoutOptions *src) diff -r db7fa530da47 -r f2f01d556f51 src/options.h --- a/src/options.h Wed May 16 10:04:01 2018 +0100 +++ b/src/options.h Wed May 16 19:22:12 2018 +0100 @@ -64,6 +64,8 @@ gboolean marks_save; // save marks on exit gchar *marks_tooltips[FILEDATA_MARKS_SIZE]; + gchar *help_search_engine; + /* info sidebar component heights */ struct { gint height; diff -r db7fa530da47 -r f2f01d556f51 src/preferences.c --- a/src/preferences.c Wed May 16 10:04:01 2018 +0100 +++ b/src/preferences.c Wed May 16 19:22:12 2018 +0100 @@ -131,6 +131,7 @@ static GtkWidget *color_profile_screen_file_entry; static GtkWidget *sidecar_ext_entry; +static GtkWidget *help_search_engine_entry; #define CONFIG_WINDOW_DEF_WIDTH 700 @@ -408,6 +409,7 @@ options->info_rating.height = c_options->info_rating.height; options->marks_save = c_options->marks_save; + config_entry_to_option(help_search_engine_entry, &options->help_search_engine, NULL); #ifdef DEBUG set_debug_level(debug_c); @@ -1583,6 +1585,19 @@ } } +static void help_search_engine_entry_icon_cb(GtkEntry *entry, GtkEntryIconPosition pos, + GdkEvent *event, gpointer userdata) +{ + if (pos == GTK_ENTRY_ICON_PRIMARY) + { + gtk_entry_set_text(GTK_ENTRY(userdata), HELP_SEARCH_ENGINE); + } + else + { + gtk_entry_set_text(GTK_ENTRY(userdata), ""); + } +} + /* general options tab */ static void config_tab_general(GtkWidget *notebook) { @@ -1698,6 +1713,27 @@ pref_spin_new_int(hbox, _("Rating:"), NULL, 1, 9999, 1, options->info_rating.height, &c_options->info_rating.height); + + group = pref_group_new(vbox, FALSE, _("On-line help search engine"), GTK_ORIENTATION_VERTICAL); + + help_search_engine_entry = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(help_search_engine_entry), options->help_search_engine); + gtk_box_pack_start(GTK_BOX(group), help_search_engine_entry, FALSE, FALSE, 0); + gtk_widget_show(help_search_engine_entry); + + gtk_widget_set_tooltip_text(help_search_engine_entry, _("The format varies between search engines, e.g the format may be:\nhttps://www.search_engine.com/search?q=site:geeqie.org/help\nhttps://www.search_engine.com/?q=site:geeqie.org/help")); + + gtk_entry_set_icon_from_stock(GTK_ENTRY(help_search_engine_entry), + GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR); + gtk_entry_set_icon_tooltip_text (GTK_ENTRY(help_search_engine_entry), + GTK_ENTRY_ICON_SECONDARY, _("Clear")); + gtk_entry_set_icon_from_stock(GTK_ENTRY(help_search_engine_entry), + GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_REVERT_TO_SAVED); + gtk_entry_set_icon_tooltip_text (GTK_ENTRY(help_search_engine_entry), + GTK_ENTRY_ICON_PRIMARY, _("Default")); + g_signal_connect(GTK_ENTRY(help_search_engine_entry), "icon-press", + G_CALLBACK(help_search_engine_entry_icon_cb), + help_search_engine_entry); } /* image tab */ diff -r db7fa530da47 -r f2f01d556f51 src/rcfile.c --- a/src/rcfile.c Wed May 16 10:04:01 2018 +0100 +++ b/src/rcfile.c Wed May 16 19:22:12 2018 +0100 @@ -344,6 +344,7 @@ WRITE_NL(); WRITE_BOOL(*options, log_window.timer_data); WRITE_NL(); WRITE_BOOL(*options, marks_save); + WRITE_NL(); WRITE_CHAR(*options, help_search_engine); /* File operations Options */ WRITE_NL(); WRITE_BOOL(*options, file_ops.enable_in_place_rename); @@ -669,6 +670,7 @@ if (READ_BOOL(*options, log_window.timer_data)) continue; if (READ_BOOL(*options, marks_save)) continue; + if (READ_CHAR(*options, help_search_engine)) continue; /* Properties dialog options */ if (READ_CHAR(*options, properties.tabs_order)) continue; diff -r db7fa530da47 -r f2f01d556f51 src/window.c --- a/src/window.c Wed May 16 10:04:01 2018 +0100 +++ b/src/window.c Wed May 16 19:22:12 2018 +0100 @@ -25,6 +25,8 @@ #include "pixbuf_util.h" #include "ui_fileops.h" #include "ui_help.h" +#include "ui_misc.h" +#include "ui_utildlg.h" GtkWidget *window_new(GtkWindowType type, const gchar *role, const gchar *icon, const gchar *icon_file, const gchar *subtitle) @@ -313,4 +315,91 @@ } } +/* + *----------------------------------------------------------------------------- + * on-line help search dialog + *----------------------------------------------------------------------------- + */ + +typedef struct _HelpSearchData HelpSearchData; +struct _HelpSearchData { + GenericDialog *gd; + GtkWidget *edit_widget; + gchar *text_entry; +}; + +static void help_search_window_show_icon_press(GtkEntry *entry, GtkEntryIconPosition pos, + GdkEvent *event, gpointer userdata) +{ + HelpSearchData *hsd = userdata; + + g_free(hsd->text_entry); + hsd->text_entry = g_strdup(""); + gtk_entry_set_text(GTK_ENTRY(hsd->edit_widget), hsd->text_entry); +} + +static void help_search_window_ok_cb(GenericDialog *gd, gpointer data) +{ + HelpSearchData *hsd = data; + gchar *search_command; + + search_command = g_strconcat(options->help_search_engine, + gtk_entry_get_text(GTK_ENTRY(hsd->edit_widget)), + NULL); + help_browser_run(search_command); + g_free(search_command); + + g_free(hsd); +} + +static void help_search_window_cancel_cb(GenericDialog *gd, gpointer data) +{ + HelpSearchData *hsd = data; + + g_free(hsd); +} + +void help_search_window_show() +{ + HelpSearchData *hsd; + GenericDialog *gd; + GtkWidget *table; + GtkWidget *label1; + GtkWidget *label2; + + hsd = g_new0(HelpSearchData, 1); + hsd->gd = gd = generic_dialog_new(_("On-line help search"), "help_search", + NULL, TRUE, + help_search_window_cancel_cb, hsd); + generic_dialog_add_message(gd, NULL, _("Search the on-line help files.\n"), NULL, FALSE); + + generic_dialog_add_button(gd, GTK_STOCK_OK, NULL, + help_search_window_ok_cb, TRUE); + + label1 = pref_label_new(GENERIC_DIALOG(gd)->vbox, _("Search engine:")); + gtk_misc_set_alignment(GTK_MISC(label1), 0.0, 0.5); + + label2 = pref_label_new(GENERIC_DIALOG(gd)->vbox, options->help_search_engine); + gtk_misc_set_alignment(GTK_MISC(label2), 0.0, 0.5); + pref_spacer(GENERIC_DIALOG(gd)->vbox, 0); + + table = pref_table_new(gd->vbox, 3, 1, FALSE, TRUE); + pref_table_label(table, 0, 0, _("Search terms:"), 1.0); + hsd->edit_widget = gtk_entry_new(); + gtk_widget_set_size_request(hsd->edit_widget, 300, -1); + gtk_table_attach_defaults(GTK_TABLE(table), hsd->edit_widget, 1, 2, 0, 1); + generic_dialog_attach_default(gd, hsd->edit_widget); + gtk_widget_show(hsd->edit_widget); + + gtk_entry_set_icon_from_stock(GTK_ENTRY(hsd->edit_widget), + GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR); + gtk_entry_set_icon_tooltip_text (GTK_ENTRY(hsd->edit_widget), + GTK_ENTRY_ICON_SECONDARY, _("Clear")); + g_signal_connect(GTK_ENTRY(hsd->edit_widget), "icon-press", + G_CALLBACK(help_search_window_show_icon_press), hsd); + + gtk_widget_grab_focus(hsd->edit_widget); + + gtk_widget_show(gd->dialog); +} /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ diff -r db7fa530da47 -r f2f01d556f51 src/window.h --- a/src/window.h Wed May 16 10:04:01 2018 +0100 +++ b/src/window.h Wed May 16 19:22:12 2018 +0100 @@ -27,7 +27,7 @@ gboolean window_maximized(GtkWidget *window); void help_window_show(const gchar *key); - +void help_search_window_show(); #endif /* WINDOW_H */ /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ diff -r db7fa530da47 -r f2f01d556f51 web/help/GuideImageMarks.html --- a/web/help/GuideImageMarks.html Wed May 16 10:04:01 2018 +0100 +++ b/web/help/GuideImageMarks.html Wed May 16 19:22:12 2018 +0100 @@ -459,23 +459,30 @@ Select menu gives access to the marks operations of setting, filtering and intersection.

-

There are 6 individual marks, any of which can be associated with an image simply by pressing the 1 to 6 keys on the keyboard.

+

There are 10 individual marks, any of which can be associated with an image simply by pressing the 0 to 9 keys on the keyboard, where key 0 represents mark 10.

If the Show Marks - menu has been selected, each image will have a set of 6 check-boxes displayed adjacent to it in the file pane in both icon and list mode. In addition a set of 6 check-boxes will be shown at the top of the files pane. Clicking any of these will filter the displayed list. + menu has been selected, each image will have a set of 10 check-boxes displayed adjacent to it in the file pane in both icon and list mode. In addition a set of 10 check-boxes will be shown at the top of the files pane. Clicking any of these will filter the displayed list.

+

Moving the mouse over any of the check-boxes at the top of the files pane will show mnemonic text for that mark. The text can be modified by right-clicking on the check box.

If the Image Overlay is being displayed, the currently set marks for the image are shown. It is not necessary to include an entry into the overlay template for this to happen.

- A keyword can be associated with a single mark by right-clicking on the keyword in the sidebar panel. When a meta-data write operation for a file is triggered either manually or as defined in + A keyword can be associated with a single mark by right-clicking on the keyword in the sidebar panel. When a meta-data write operation for a file is triggered either + manually + or as defined in Metadata , the keyword data indicated by the current set of mark-to-keyword links will be written.

-

Neither marks, nor the associations between keywords and marks, are preserved when Geeqie is shut down.

+

+ The associations between keywords and marks is preserved when Geeqie is shut down. The current setting of marks can also be optionally saved - the setting is in the + Behavior tab of Preferences + . +

diff -r db7fa530da47 -r f2f01d556f51 web/help/GuideMainWindowMenus.html --- a/web/help/GuideMainWindowMenus.html Wed May 16 10:04:01 2018 +0100 +++ b/web/help/GuideMainWindowMenus.html Wed May 16 19:22:12 2018 +0100 @@ -732,6 +732,15 @@

Displays marks in the file list

+ Clear marks +
+
+

Clear all marks for all images

+
+

Marks that are linked to keywords will also be cleared. This may result in a metadata write operation being triggered.

+
+
+
Mark n
@@ -984,7 +993,7 @@

- Thumbnail maintenance + Cache maintenance

@@ -1318,6 +1327,16 @@

Opens the Geeqie user manual in a new browser window.

+ On-line help search +
+
+

+ Use a web browser to search Geeqie's on-line help files. The search engine used is defined in + Preferences General + . +

+
+
Keyboard shortcuts
diff -r db7fa530da47 -r f2f01d556f51 web/help/GuideOptionsBehavior.html --- a/web/help/GuideOptionsBehavior.html Wed May 16 10:04:01 2018 +0100 +++ b/web/help/GuideOptionsBehavior.html Wed May 16 19:22:12 2018 +0100 @@ -574,6 +574,12 @@

If selected, a single click will enter a directory, rather than the GTK+ default of a double click.

+ Save marks on exit +
+
+

Save all marks that have been set. Note that marks that are linked to a keyword will always be saved irrespective of this setting.

+
+
Recent folder list maximum size
diff -r db7fa530da47 -r f2f01d556f51 web/help/GuideOptionsGeneral.html --- a/web/help/GuideOptionsGeneral.html Wed May 16 10:04:01 2018 +0100 +++ b/web/help/GuideOptionsGeneral.html Wed May 16 19:22:12 2018 +0100 @@ -470,6 +470,9 @@
  • 11.1.4. Info Sidebar component heights
  • +
  • +11.1.5. On-line help search +
  • 11.1.1. Thumbnails

    @@ -657,6 +660,17 @@
    +
    +

    11.1.5. On-line help search

    +

    + An internet search engine may be used to search the help files on Geeqie's website. The string used to conduct the search is defined here. In most cases it will be in one of two formats: +

    + https://www.search-engine.com/search?q=site:geeqie.org/help +

    + https://www.search-engine.com/?q=site:geeqie.org/help' +

    +
    +