Merge lp:~voldyman/pantheon-terminal/copy-uri-mouse into lp:~elementary-apps/pantheon-terminal/trunk

Proposed by Akshay Shekher
Status: Merged
Merged at revision: 278
Proposed branch: lp:~voldyman/pantheon-terminal/copy-uri-mouse
Merge into: lp:~elementary-apps/pantheon-terminal/trunk
Diff against target: 65 lines (+12/-2)
2 files modified
src/PantheonTerminalWindow.vala (+7/-1)
src/TerminalWidget.vala (+5/-1)
To merge this branch: bzr merge lp:~voldyman/pantheon-terminal/copy-uri-mouse
Reviewer Review Type Date Requested Status
David Gomes (community) Approve
Review via email: mp+117388@code.launchpad.net

Description of the change

according to Pim's comment user should be able to copy link by right clicking on the link.

functionality added.

To post a comment you must log in.
Revision history for this message
David Gomes (davidgomes) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/PantheonTerminalWindow.vala'
2--- src/PantheonTerminalWindow.vala 2012-07-30 20:26:02 +0000
3+++ src/PantheonTerminalWindow.vala 2012-07-31 07:53:19 +0000
4@@ -33,6 +33,7 @@
5 public Granite.Widgets.DynamicNotebook notebook;
6 FontDescription system_font;
7 private Button add_button;
8+ private Gtk.Clipboard clipboard;
9
10 private GLib.List <TerminalWidget> terminals = new GLib.List <TerminalWidget> ();
11
12@@ -88,6 +89,8 @@
13 main_actions.set_translation_domain ("pantheon-terminal");
14 main_actions.add_actions (main_entries, this);
15
16+ clipboard = Gtk.Clipboard.get (Gdk.Atom.intern ("CLIPBOARD", false));
17+
18 ui = new Gtk.UIManager ();
19
20 try {
21@@ -362,7 +365,10 @@
22 }
23
24 void action_copy () {
25- current_terminal.copy_clipboard ();
26+ if (current_terminal.uri != null)
27+ clipboard.set_text (current_terminal.uri, current_terminal.uri.length);
28+ else
29+ current_terminal.copy_clipboard ();
30 }
31
32 void action_paste () {
33
34=== modified file 'src/TerminalWidget.vala'
35--- src/TerminalWidget.vala 2012-07-30 20:26:02 +0000
36+++ src/TerminalWidget.vala 2012-07-31 07:53:19 +0000
37@@ -27,6 +27,7 @@
38 GLib.Pid child_pid;
39 private PantheonTerminalWindow window;
40 public Granite.Widgets.Tab tab;
41+ public string? uri;
42
43 public TerminalWidget (Gtk.ActionGroup main_actions, Gtk.UIManager ui, PantheonTerminalWindow parent_window) {
44 /* Set up the parents */
45@@ -43,9 +44,9 @@
46 menu.show_all ();
47
48 button_press_event.connect ((event) => {
49+ uri = get_link ((long)event.x, (long)event.y);
50 switch (event.button) {
51 case Gdk.BUTTON_PRIMARY:
52- string? uri = get_link ((long)event.x, (long)event.y);
53 if (uri != null) {
54 try {
55 Gtk.show_uri (null, (!)uri, Gtk.get_current_event_time());
56@@ -56,6 +57,9 @@
57 }
58 return false;
59 case Gdk.BUTTON_SECONDARY :
60+ if (uri != null) {
61+ main_actions.get_action ("Copy").set_sensitive (true);
62+ }
63 menu.select_first (false);
64 menu.popup (null, null, null, event.button, event.time);
65 return true;

Subscribers

People subscribed via source and target branches