From: Colin Clark Date: Wed, 16 May 2018 18:22:12 +0000 (+0100) Subject: Fix #597: Help file search X-Git-Tag: v1.5~146 X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=commitdiff_plain;h=136cf5086f2fdbffd71c838ffa7ad434958b26b4 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 --git a/doc/docbook/GuideMainWindowMenus.xml b/doc/docbook/GuideMainWindowMenus.xml index 24c22d12..ff883bae 100644 --- a/doc/docbook/GuideMainWindowMenus.xml +++ b/doc/docbook/GuideMainWindowMenus.xml @@ -1442,6 +1442,20 @@ 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 + . + + + diff --git a/doc/docbook/GuideOptionsGeneral.xml b/doc/docbook/GuideOptionsGeneral.xml index 4d492b3c..328b8195 100644 --- a/doc/docbook/GuideOptionsGeneral.xml +++ b/doc/docbook/GuideOptionsGeneral.xml @@ -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 --git a/src/layout_util.c b/src/layout_util.c index 9f0c68e1..7c9d013d 100644 --- a/src/layout_util.c +++ b/src/layout_util.c @@ -1125,6 +1125,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; @@ -1886,6 +1894,7 @@ static GtkActionEntry menu_entries[] = { { "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 @@ static const gchar *menu_ui_description = " " " " " " +" " " " " " " " diff --git a/src/main.h b/src/main.h index 120f528f..c892ad4d 100644 --- a/src/main.h +++ b/src/main.h @@ -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 --git a/src/options.c b/src/options.c index 689d81a0..99cb2c0c 100644 --- a/src/options.c +++ b/src/options.c @@ -220,6 +220,8 @@ void setup_default_options(ConfOptions *options) { 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 --git a/src/options.h b/src/options.h index 0415c5c8..7ae033ff 100644 --- a/src/options.h +++ b/src/options.h @@ -64,6 +64,8 @@ struct _ConfOptions 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 --git a/src/preferences.c b/src/preferences.c index 1d908aa9..fda23228 100644 --- a/src/preferences.c +++ b/src/preferences.c @@ -131,6 +131,7 @@ static GtkWidget *color_profile_input_name_entry[COLOR_PROFILE_INPUTS]; 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 @@ static void config_window_apply(void) 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 cache_local_cb(GtkWidget *widget, gpointer data) } } +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 @@ static void config_tab_general(GtkWidget *notebook) 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 --git a/src/rcfile.c b/src/rcfile.c index 467aef86..1724840f 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -344,6 +344,7 @@ static void write_global_attributes(GString *outstr, gint indent) 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 @@ static gboolean load_global_params(const gchar **attribute_names, const gchar ** 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 --git a/src/window.c b/src/window.c index dd70cb46..0b291123 100644 --- a/src/window.c +++ b/src/window.c @@ -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 @@ void help_window_show(const gchar *key) } } +/* + *----------------------------------------------------------------------------- + * 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 --git a/src/window.h b/src/window.h index 1e218d6f..c1c49215 100644 --- a/src/window.h +++ b/src/window.h @@ -27,7 +27,7 @@ void window_set_icon(GtkWidget *window, const gchar *icon, const gchar *file); 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 --git a/web/help/GuideImageMarks.html b/web/help/GuideImageMarks.html index 74d8b542..8ec2f089 100644 --- a/web/help/GuideImageMarks.html +++ b/web/help/GuideImageMarks.html @@ -459,23 +459,30 @@ dd.answer div.label { float: left; } 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 --git a/web/help/GuideMainWindowMenus.html b/web/help/GuideMainWindowMenus.html index 3a0e4fa8..1d634b45 100644 --- a/web/help/GuideMainWindowMenus.html +++ b/web/help/GuideMainWindowMenus.html @@ -731,6 +731,15 @@ dd.answer div.label { float: left; }

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 @@ dd.answer div.label { float: left; }

- Thumbnail maintenance + Cache maintenance

@@ -1317,6 +1326,16 @@ dd.answer div.label { float: left; }

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 --git a/web/help/GuideOptionsBehavior.html b/web/help/GuideOptionsBehavior.html index 0f5c786c..f64f91d5 100644 --- a/web/help/GuideOptionsBehavior.html +++ b/web/help/GuideOptionsBehavior.html @@ -573,6 +573,12 @@ dd.answer div.label { float: left; }

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 --git a/web/help/GuideOptionsGeneral.html b/web/help/GuideOptionsGeneral.html index ed4610bc..6d5e0531 100644 --- a/web/help/GuideOptionsGeneral.html +++ b/web/help/GuideOptionsGeneral.html @@ -470,6 +470,9 @@ dd.answer div.label { float: left; }
  • 11.1.4. Info Sidebar component heights
  • +
  • +11.1.5. On-line help search +
  • 11.1.1. Thumbnails

    @@ -657,6 +660,17 @@ dd.answer div.label { float: left; }
    +
    +

    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' +

    +
    +