Klaus Ethgen <Klaus+geekie@...> writes: Ian> I can make a patch. It probably won't be trivially short; where do Ian> you want it posted?
Klaus> Here would be great. Or fork the repo on gitorious and create a Klaus> merge request. Here is a patch. Since perfection seems to be out of reach, I took the most conservative path (a configuration option). diff --git a/doc/docbook/GuideOptionsBehavior.xml b/doc/docbook/GuideOptionsBehavior.xml index 3e107ec..24b767d 100644 --- a/doc/docbook/GuideOptionsBehavior.xml +++ b/doc/docbook/GuideOptionsBehavior.xml @@ -93,7 +93,17 @@ Enable this option to show a "Copy path" menu item in applicable menus. </para> <para> - This allows to copy path to files or directories to the clipboard, names are enclosed with double quotes and separated by space. + This allows to copy path to files or directories to the primary selection, names are enclosed with double quotes and separated by space. + </para> + <variablelist><varlistentry><term> + Copy path to clipboard instead of primary selection + </term><listitem><para/></listitem></varlistentry></variablelist> + <para> + If this is set, the "Copy path" menu item will affect the clipboard and not the primary selection. + </para> + <para> + Setting the clipboard is the behavior resembling most modern Gtk applications. + The old behavior (setting the primary selection) is the default for backward compatibility reasons. </para> <variablelist><varlistentry><term> Open recent list maximum size diff --git a/src/options.c b/src/options.c index 4972967..54c6430 100644 --- a/src/options.c +++ b/src/options.c @@ -90,6 +90,7 @@ ConfOptions *init_options(ConfOptions *options) options->mousewheel_scrolls = FALSE; options->open_recent_list_maxsize = 10; options->place_dialogs_under_mouse = FALSE; + options->copy_path_to_clipboard = FALSE; options->progressive_key_scrolling = TRUE; diff --git a/src/options.h b/src/options.h index 1556dac..75d2023 100644 --- a/src/options.h +++ b/src/options.h @@ -35,6 +35,7 @@ struct _ConfOptions gboolean save_window_positions; gboolean tools_restore_state; + gboolean copy_path_to_clipboard; /* file ops */ struct { diff --git a/src/preferences.c b/src/preferences.c index 4f3e21a..a92a2d7 100644 --- a/src/preferences.c +++ b/src/preferences.c @@ -291,6 +291,7 @@ static void config_window_apply(void) options->tree_descend_subdirs = c_options->tree_descend_subdirs; options->open_recent_list_maxsize = c_options->open_recent_list_maxsize; + options->copy_path_to_clipboard = c_options->copy_path_to_clipboard; options->dnd_icon_size = c_options->dnd_icon_size; options->metadata.save_in_image_file = c_options->metadata.save_in_image_file; @@ -1928,6 +1929,9 @@ static void config_tab_behavior(GtkWidget *notebook) pref_checkbox_new_int(group, _("In place renaming"), options->file_ops.enable_in_place_rename, &c_options->file_ops.enable_in_place_rename); + pref_checkbox_new_int(group, _("Copy path to clipboard instead of primary selection"), + options->copy_path_to_clipboard, &c_options->copy_path_to_clipboard); + pref_spin_new_int(group, _("Open recent list maximum size"), NULL, 1, 50, 1, options->open_recent_list_maxsize, &c_options->open_recent_list_maxsize); diff --git a/src/rcfile.c b/src/rcfile.c index b61c4db..62189c4 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -279,6 +279,7 @@ static void write_global_attributes(GString *outstr, gint indent) 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); + WRITE_NL(); WRITE_BOOL(*options, copy_path_to_clipboard); WRITE_NL(); WRITE_BOOL(*options, save_window_positions); WRITE_NL(); WRITE_BOOL(*options, tools_restore_state); @@ -598,6 +599,7 @@ static gboolean load_global_params(const gchar **attribute_names, const gchar ** if (READ_INT(*options, open_recent_list_maxsize)) continue; if (READ_INT(*options, dnd_icon_size)) continue; if (READ_BOOL(*options, place_dialogs_under_mouse)) continue; + if (READ_BOOL(*options, copy_path_to_clipboard)) continue; if (READ_BOOL(*options, save_window_positions)) continue; if (READ_BOOL(*options, tools_restore_state)) continue; diff --git a/src/utilops.c b/src/utilops.c index 125ef4a..cde8b70 100644 --- a/src/utilops.c +++ b/src/utilops.c @@ -2862,21 +2862,29 @@ void file_util_rename_dir(FileData *source_fd, const gchar *new_path, GtkWidget void file_util_copy_path_to_clipboard(FileData *fd) { GtkClipboard *clipboard; + GdkAtom selection; + selection = (options->copy_path_to_clipboard ? + GDK_SELECTION_CLIPBOARD : + GDK_SELECTION_PRIMARY); if (!fd || !*fd->path) return; - clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); + clipboard = gtk_clipboard_get(selection); gtk_clipboard_set_text(clipboard, g_shell_quote(fd->path), -1); } void file_util_copy_path_list_to_clipboard(GList *list) { GtkClipboard *clipboard; + GdkAtom selection; GList *work; GString *new; - clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); - + selection = (options->copy_path_to_clipboard ? + GDK_SELECTION_CLIPBOARD : + GDK_SELECTION_PRIMARY); + clipboard = gtk_clipboard_get(selection); + new = g_string_new(""); work = list; while (work) { ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ Geeqie-devel mailing list Geeqie-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geeqie-devel