diff options
author | Jonas Danielsson <jonas@threetimestwo.org> | 2015-01-14 01:59:18 -0500 |
---|---|---|
committer | Jonas Danielsson <jonas@threetimestwo.org> | 2015-02-01 00:32:33 +0100 |
commit | 05343f94fcea0334b1a46c58ad315eb490796b66 (patch) | |
tree | b7208d98222a820c03967148353d930f556b8a3c | |
parent | fa4f2c798bdf6d7de95ef5f1239b5951edfff60b (diff) | |
download | gnome-contacts-05343f94fcea0334b1a46c58ad315eb490796b66.tar.gz |
contacts-address-map: Go to Maps on button press
https://bugzilla.gnome.org/show_bug.cgi?id=658553
-rw-r--r-- | src/contacts-address-map.vala | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/contacts-address-map.vala b/src/contacts-address-map.vala index 2915c8b..c8a8167 100644 --- a/src/contacts-address-map.vala +++ b/src/contacts-address-map.vala @@ -46,6 +46,8 @@ public class Contacts.AddressMap : Frame { public AddressMap (Contact c, Set<PostalAddressFieldDetails> postal_addresses) { var map = new Embed (); + var maps_id = "org.gnome.Maps"; + var maps_info = new DesktopAppInfo (maps_id + ".desktop"); var map_factory = MapSourceFactory.dup_default (); map_grid.add (map); @@ -60,6 +62,24 @@ public class Contacts.AddressMap : Frame { /* Disable all events for the map */ map.get_stage ().captured_event.connect (() => { return true; }); + if (maps_info != null) { + /* Set cursor as HAND1 to indicate the map is clickable */ + map.realize.connect (() => { + map.get_window ().set_cursor (new Cursor (CursorType.HAND1)); + }); + + map.button_press_event.connect(() => { + activate_action (maps_id, + "show-contact", + new Variant ("s", c.individual.id), + Gtk.get_current_event_time ()); + return true; + }); + + } else { + map.set_tooltip_text (_("Install GNOME Maps to open location.")); + } + addresses = postal_addresses; found_places = new GLib.List<Place> (); mutex = Mutex (); |