Mercurial > hg > forks > geeqie
changeset 2631:e493a7df8745
Addl fix #510: Rudimentary video support
https://github.com/BestImageViewer/geeqie/issues/510
Additional option to start video playback via left-click.
author | Tomasz Golinski <tomaszg@math.uwb.edu.pl> |
---|---|
date | Fri, 13 Oct 2017 16:55:27 +0100 |
parents | 28ebd46553b2 |
children | 22a9496e46c0 |
files | doc/docbook/GuideOptionsBehavior.xml src/img-view.c src/layout_image.c src/options.c src/options.h src/preferences.c src/rcfile.c web/help/GuideOptionsBehavior.html |
diffstat | 8 files changed, 82 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/docbook/GuideOptionsBehavior.xml Fri Oct 13 14:19:22 2017 +0100 +++ b/doc/docbook/GuideOptionsBehavior.xml Fri Oct 13 16:55:27 2017 +0100 @@ -183,6 +183,14 @@ <para>If selected, mouse left-click will select the next image; mouse middle-click will select the previous image.</para> </listitem> </varlistentry> + <varlistentry> + <term> + <guilabel>Play video by left click on image</guilabel> + </term> + <listitem> + <para>If selected, mouse left-click on an image belonging to the video class will start a program chosen in a box below.</para> + </listitem> + </varlistentry> </variablelist> </section> <section id="Debugging">
--- a/src/img-view.c Fri Oct 13 14:19:22 2017 +0100 +++ b/src/img-view.c Fri Oct 13 16:55:27 2017 +0100 @@ -580,7 +580,11 @@ switch (event->button) { case MOUSE_BUTTON_LEFT: - if (options->image_lm_click_nav) + if (options->image_l_click_video && options->image_l_click_video_editor && imd->image_fd->format_class == FORMAT_CLASS_VIDEO) + { + start_editor_from_file(options->image_l_click_video_editor, imd->image_fd); + } + else if (options->image_lm_click_nav) view_step_next(vw); break; case MOUSE_BUTTON_MIDDLE:
--- a/src/layout_image.c Fri Oct 13 14:19:22 2017 +0100 +++ b/src/layout_image.c Fri Oct 13 16:55:27 2017 +0100 @@ -1698,7 +1698,11 @@ switch (event->button) { case MOUSE_BUTTON_LEFT: - if (options->image_lm_click_nav && lw->split_mode == SPLIT_NONE) + if (options->image_l_click_video && options->image_l_click_video_editor && imd->image_fd->format_class == FORMAT_CLASS_VIDEO) + { + start_editor_from_file(options->image_l_click_video_editor, imd->image_fd); + } + else if (options->image_lm_click_nav && lw->split_mode == SPLIT_NONE) layout_image_next(lw); break; case MOUSE_BUTTON_MIDDLE:
--- a/src/options.c Fri Oct 13 14:19:22 2017 +0100 +++ b/src/options.c Fri Oct 13 16:55:27 2017 +0100 @@ -123,6 +123,8 @@ options->lazy_image_sync = FALSE; options->mousewheel_scrolls = FALSE; options->image_lm_click_nav = TRUE; + options->image_l_click_video = FALSE; + options->image_l_click_video_editor = NULL; options->open_recent_list_maxsize = 10; options->place_dialogs_under_mouse = FALSE;
--- a/src/options.h Fri Oct 13 14:19:22 2017 +0100 +++ b/src/options.h Fri Oct 13 16:55:27 2017 +0100 @@ -31,6 +31,8 @@ gboolean place_dialogs_under_mouse; gboolean mousewheel_scrolls; gboolean image_lm_click_nav; + gboolean image_l_click_video; + gchar *image_l_click_video_editor; gboolean show_icon_names; /* various */
--- a/src/preferences.c Fri Oct 13 14:19:22 2017 +0100 +++ b/src/preferences.c Fri Oct 13 16:55:27 2017 +0100 @@ -301,6 +301,8 @@ options->mousewheel_scrolls = c_options->mousewheel_scrolls; options->image_lm_click_nav = c_options->image_lm_click_nav; + options->image_l_click_video = c_options->image_l_click_video; + options->image_l_click_video_editor = c_options->image_l_click_video_editor; options->file_ops.enable_in_place_rename = c_options->file_ops.enable_in_place_rename; @@ -741,6 +743,48 @@ gtk_widget_show(combo); } +static void video_menu_cb(GtkWidget *combo, gpointer data) +{ + gchar **option = data; + + EditorDescription *ed = g_list_nth_data(editor_list_get(), gtk_combo_box_get_active(GTK_COMBO_BOX(combo))); + *option = ed->key; +} + +static void video_menu_populate(gpointer data, gpointer user_data) +{ + GtkWidget *combo = user_data; + EditorDescription *ed = data; + + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), ed->name); +} + +static void add_video_menu(GtkWidget *table, gint column, gint row, const gchar *text, + gchar *option, gchar **option_c) +{ + GtkWidget *combo; + gint current; +/* use lists since they are sorted */ + GList *eds = editor_list_get(); + + *option_c = option; + + pref_table_label(table, column, row, text, 0.0); + + combo = gtk_combo_box_text_new(); + g_list_foreach(eds,video_menu_populate,(gpointer)combo); + current = option ? g_list_index(eds,g_hash_table_lookup(editors,option)): -1; + + gtk_combo_box_set_active(GTK_COMBO_BOX(combo), current); + + g_signal_connect(G_OBJECT(combo), "changed", + G_CALLBACK(video_menu_cb), option_c); + + gtk_table_attach(GTK_TABLE(table), combo, column + 1, column + 2, row, row + 1, + GTK_EXPAND | GTK_FILL, 0, 0, 0); + gtk_widget_show(combo); +} + static void filter_store_populate(void) { GList *work; @@ -2220,6 +2264,7 @@ GtkWidget *tabcomp; GtkWidget *ct_button; GtkWidget *spin; + GtkWidget *table; vbox = scrolled_notebook_page(notebook, _("Behavior")); @@ -2289,6 +2334,11 @@ options->mousewheel_scrolls, &c_options->mousewheel_scrolls); pref_checkbox_new_int(group, _("Navigation by left or middle click on image"), options->image_lm_click_nav, &c_options->image_lm_click_nav); + pref_checkbox_new_int(group, _("Play video by left click on image"), + options->image_l_click_video, &c_options->image_l_click_video); + table = pref_table_new(group, 2, 1, FALSE, FALSE); + add_video_menu(table, 0, 0, _("Play with:"), options->image_l_click_video_editor, &c_options->image_l_click_video_editor); + #ifdef DEBUG group = pref_group_new(vbox, FALSE, _("Debugging"), GTK_ORIENTATION_VERTICAL);
--- a/src/rcfile.c Fri Oct 13 14:19:22 2017 +0100 +++ b/src/rcfile.c Fri Oct 13 16:55:27 2017 +0100 @@ -327,6 +327,8 @@ WRITE_NL(); WRITE_BOOL(*options, mousewheel_scrolls); WRITE_NL(); WRITE_BOOL(*options, image_lm_click_nav); + WRITE_NL(); WRITE_BOOL(*options, image_l_click_video); + WRITE_NL(); WRITE_CHAR(*options, image_l_click_video_editor); WRITE_NL(); WRITE_INT(*options, open_recent_list_maxsize); WRITE_NL(); WRITE_INT(*options, dnd_icon_size); WRITE_NL(); WRITE_BOOL(*options, place_dialogs_under_mouse); @@ -623,6 +625,8 @@ if (READ_BOOL(*options, mousewheel_scrolls)) continue; if (READ_BOOL(*options, image_lm_click_nav)) continue; + if (READ_BOOL(*options, image_l_click_video)) continue; + if (READ_CHAR(*options, image_l_click_video_editor)) continue; if (READ_INT(*options, open_recent_list_maxsize)) continue; if (READ_INT(*options, dnd_icon_size)) continue;
--- a/web/help/GuideOptionsBehavior.html Fri Oct 13 14:19:22 2017 +0100 +++ b/web/help/GuideOptionsBehavior.html Fri Oct 13 16:55:27 2017 +0100 @@ -619,6 +619,12 @@ <dd> <p class="para block block-first">If selected, mouse left-click will select the next image; mouse middle-click will select the previous image.</p> </dd> +<dt class="term"> + <span class="guilabel">Play video by left click on image</span> + </dt> +<dd> + <p class="para block block-first">If selected, mouse left-click on an image belonging to the video class will start a program chosen in a box below.</p> + </dd> </dl></div> </div> <div class="division section">