[baobab] Add "Copy path to clipboard"
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab] Add "Copy path to clipboard"
- Date: Tue, 31 Jul 2012 11:26:10 +0000 (UTC)
commit 20192f61bd1e892a8618adae70d385fc50086804
Author: Paolo Borelli <pborelli gnome org>
Date: Tue Jul 31 13:22:49 2012 +0200
Add "Copy path to clipboard"
Fixes bug #646014
src/baobab-main-window.ui | 9 +++++++++
src/baobab-window.vala | 13 +++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/baobab-main-window.ui b/src/baobab-main-window.ui
index f8e2fbf..cb2007f 100644
--- a/src/baobab-main-window.ui
+++ b/src/baobab-main-window.ui
@@ -449,6 +449,15 @@
</object>
</child>
<child>
+ <object class="GtkMenuItem" id="treeview-popup-copy">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_Copy Path to Clipboard</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
<object class="GtkMenuItem" id="treeview-popup-trash">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index 7e1ba70..bd168aa 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -350,6 +350,7 @@ namespace Baobab {
void setup_treeview (Gtk.Builder builder) {
var popup = builder.get_object ("treeview-popup-menu") as Gtk.Menu;
var open_item = builder.get_object ("treeview-popup-open") as Gtk.MenuItem;
+ var copy_item = builder.get_object ("treeview-popup-copy") as Gtk.MenuItem;
var trash_item = builder.get_object ("treeview-popup-trash") as Gtk.MenuItem;
treeview.button_press_event.connect ((event) => {
@@ -384,6 +385,18 @@ namespace Baobab {
}
});
+ copy_item.activate.connect (() => {
+ var selection = treeview.get_selection ();
+ Gtk.TreeIter iter;
+ if (selection.get_selected (null, out iter)) {
+ string parse_name;
+ active_location.scanner.get (iter, Scanner.Columns.PARSE_NAME, out parse_name);
+ var clipboard = Gtk.Clipboard.get (Gdk.SELECTION_CLIPBOARD);
+ clipboard.set_text (parse_name, -1);
+ clipboard.store ();
+ }
+ });
+
trash_item.activate.connect (() => {
var selection = treeview.get_selection ();
Gtk.TreeIter iter;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]