summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gsearchtool/src/gsearchtool-callbacks.c43
-rw-r--r--gsearchtool/src/gsearchtool-callbacks.h3
2 files changed, 46 insertions, 0 deletions
diff --git a/gsearchtool/src/gsearchtool-callbacks.c b/gsearchtool/src/gsearchtool-callbacks.c
index 11512b56..c716e5ca 100644
--- a/gsearchtool/src/gsearchtool-callbacks.c
+++ b/gsearchtool/src/gsearchtool-callbacks.c
@@ -664,6 +664,33 @@ open_folder_cb (GtkAction * action,
}
void
+copy_path_cb (GtkAction * action,
+ gpointer data)
+{
+ GSearchWindow * gsearch = data;
+ GtkTreeModel * model;
+ GtkTreeIter iter;
+ GList * list;
+ gchar * locale_path;
+ GtkClipboard* clipboard;
+
+ list = gtk_tree_selection_get_selected_rows (GTK_TREE_SELECTION (gsearch->search_results_selection),
+ &model);
+
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (gsearch->search_results_list_store), &iter,
+ g_list_nth_data (list, 0));
+
+ gtk_tree_model_get (GTK_TREE_MODEL (gsearch->search_results_list_store), &iter,
+ COLUMN_LOCALE_FILE, &locale_path,
+ -1);
+ clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
+ gtk_clipboard_set_text(clipboard, locale_path, -1);
+
+ g_free (locale_path);
+ g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
+}
+
+void
file_changed_cb (GFileMonitor * handle,
const gchar * monitor_uri,
const gchar * info_uri,
@@ -1208,6 +1235,22 @@ build_popup_menu_for_file (GSearchWindow * gsearch,
G_CALLBACK (open_folder_cb),
(gpointer) gsearch);
+ /* Popup menu item: Copy Path */
+ if (gtk_tree_selection_count_selected_rows (GTK_TREE_SELECTION (gsearch->search_results_selection)) == 1) {
+ new1 = gtk_image_menu_item_new_with_mnemonic (_("Copy _Path"));
+ gtk_container_add (GTK_CONTAINER (gsearch->search_results_popup_menu), new1);
+ gtk_widget_show (new1);
+
+ image1 = gtk_image_new_from_icon_name ("edit-copy", GTK_ICON_SIZE_MENU);
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (new1), image1);
+ gtk_widget_show (image1);
+
+ g_signal_connect (G_OBJECT (new1),
+ "activate",
+ G_CALLBACK (copy_path_cb),
+ (gpointer) gsearch);
+ }
+
/* Popup menu item: Move to Trash */
separatormenuitem1 = gtk_separator_menu_item_new ();
gtk_container_add (GTK_CONTAINER (gsearch->search_results_popup_menu), separatormenuitem1);
diff --git a/gsearchtool/src/gsearchtool-callbacks.h b/gsearchtool/src/gsearchtool-callbacks.h
index b9db03a2..4ee01113 100644
--- a/gsearchtool/src/gsearchtool-callbacks.h
+++ b/gsearchtool/src/gsearchtool-callbacks.h
@@ -96,6 +96,9 @@ void
open_folder_cb (GtkAction * action,
gpointer data);
void
+copy_path_cb (GtkAction * action,
+ gpointer data);
+void
file_changed_cb (GFileMonitor * handle,
const gchar * monitor_uri,
const gchar * info_uri,