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
=== modified file 'src/PantheonTerminalWindow.vala'
--- src/PantheonTerminalWindow.vala 2012-07-30 20:26:02 +0000
+++ src/PantheonTerminalWindow.vala 2012-07-31 07:53:19 +0000
@@ -33,6 +33,7 @@
33 public Granite.Widgets.DynamicNotebook notebook;33 public Granite.Widgets.DynamicNotebook notebook;
34 FontDescription system_font;34 FontDescription system_font;
35 private Button add_button;35 private Button add_button;
36 private Gtk.Clipboard clipboard;
3637
37 private GLib.List <TerminalWidget> terminals = new GLib.List <TerminalWidget> ();38 private GLib.List <TerminalWidget> terminals = new GLib.List <TerminalWidget> ();
3839
@@ -88,6 +89,8 @@
88 main_actions.set_translation_domain ("pantheon-terminal");89 main_actions.set_translation_domain ("pantheon-terminal");
89 main_actions.add_actions (main_entries, this);90 main_actions.add_actions (main_entries, this);
9091
92 clipboard = Gtk.Clipboard.get (Gdk.Atom.intern ("CLIPBOARD", false));
93
91 ui = new Gtk.UIManager ();94 ui = new Gtk.UIManager ();
9295
93 try {96 try {
@@ -362,7 +365,10 @@
362 }365 }
363366
364 void action_copy () {367 void action_copy () {
365 current_terminal.copy_clipboard ();368 if (current_terminal.uri != null)
369 clipboard.set_text (current_terminal.uri, current_terminal.uri.length);
370 else
371 current_terminal.copy_clipboard ();
366 }372 }
367373
368 void action_paste () {374 void action_paste () {
369375
=== modified file 'src/TerminalWidget.vala'
--- src/TerminalWidget.vala 2012-07-30 20:26:02 +0000
+++ src/TerminalWidget.vala 2012-07-31 07:53:19 +0000
@@ -27,6 +27,7 @@
27 GLib.Pid child_pid;27 GLib.Pid child_pid;
28 private PantheonTerminalWindow window;28 private PantheonTerminalWindow window;
29 public Granite.Widgets.Tab tab;29 public Granite.Widgets.Tab tab;
30 public string? uri;
3031
31 public TerminalWidget (Gtk.ActionGroup main_actions, Gtk.UIManager ui, PantheonTerminalWindow parent_window) {32 public TerminalWidget (Gtk.ActionGroup main_actions, Gtk.UIManager ui, PantheonTerminalWindow parent_window) {
32 /* Set up the parents */33 /* Set up the parents */
@@ -43,9 +44,9 @@
43 menu.show_all ();44 menu.show_all ();
4445
45 button_press_event.connect ((event) => {46 button_press_event.connect ((event) => {
47 uri = get_link ((long)event.x, (long)event.y);
46 switch (event.button) {48 switch (event.button) {
47 case Gdk.BUTTON_PRIMARY:49 case Gdk.BUTTON_PRIMARY:
48 string? uri = get_link ((long)event.x, (long)event.y);
49 if (uri != null) {50 if (uri != null) {
50 try {51 try {
51 Gtk.show_uri (null, (!)uri, Gtk.get_current_event_time());52 Gtk.show_uri (null, (!)uri, Gtk.get_current_event_time());
@@ -56,6 +57,9 @@
56 }57 }
57 return false;58 return false;
58 case Gdk.BUTTON_SECONDARY :59 case Gdk.BUTTON_SECONDARY :
60 if (uri != null) {
61 main_actions.get_action ("Copy").set_sensitive (true);
62 }
59 menu.select_first (false);63 menu.select_first (false);
60 menu.popup (null, null, null, event.button, event.time);64 menu.popup (null, null, null, event.button, event.time);
61 return true;65 return true;

Subscribers

People subscribed via source and target branches