Updating branch refs/heads/master
         to c85faaaab4d38d7058742d7dc17e2ef8c277bc27 (commit)
       from 82e091f7fd5eb826ad90c95412791bf2f564620e (commit)

commit c85faaaab4d38d7058742d7dc17e2ef8c277bc27
Author: Christian Dywan <[email protected]>
Date:   Wed Jul 7 23:12:01 2010 +0200

    Show 'Copy Address' and 'Copy' in hyperlink context menu

 postler/postler-content.vala |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index e0111b2..f76a491 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -145,7 +145,30 @@ public class Postler.Content : WebKit.WebView {
 
     void populate_menu (Gtk.Menu menu) {
         menu.hide_all ();
-        Gtk.MenuItem menuitem = new Gtk.ImageMenuItem.from_stock 
(Gtk.STOCK_COPY, null);
+
+        var event = Gtk.get_current_event ();
+        var result = get_hit_test_result ((Gdk.EventButton?)event);
+        Gtk.MenuItem menuitem;
+
+        if (result.link_uri != null) {
+            menuitem = new Gtk.MenuItem.with_mnemonic (_("Copy _Address"));
+            menuitem.activate.connect ((menuitem) => {
+                var clipboard = get_clipboard (Gdk.SELECTION_CLIPBOARD);
+                string address = result.link_uri.split ("?")[0];
+                clipboard.set_text (address, -1);
+            });
+            menuitem.show ();
+            menu.append (menuitem);
+            menuitem = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_COPY, null);
+            menuitem.activate.connect ((menuitem) => {
+                copy_clipboard (); });
+            menuitem.show ();
+            menuitem.sensitive = can_copy_clipboard ();
+            menu.append (menuitem);
+            return;
+        }
+
+        menuitem = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_COPY, null);
         menuitem.activate.connect ((menuitem) => {
             copy_clipboard (); });
         menuitem.show ();
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to