Merge lp:~mefrio-g/cable/url-topic into lp:cable

Proposed by Mario Guerriero
Status: Merged
Merged at revision: 100
Proposed branch: lp:~mefrio-g/cable/url-topic
Merge into: lp:cable
Diff against target: 23 lines (+3/-1)
2 files modified
src/Widgets/Room.vala (+1/-0)
src/Widgets/Server.vala (+2/-1)
To merge this branch: bzr merge lp:~mefrio-g/cable/url-topic
Reviewer Review Type Date Requested Status
Cable Developers Pending
Review via email: mp+176064@code.launchpad.net

Description of the change

clickable URL support for topic label too.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Widgets/Room.vala'
2--- src/Widgets/Room.vala 2013-07-15 21:07:55 +0000
3+++ src/Widgets/Room.vala 2013-07-21 15:32:26 +0000
4@@ -135,6 +135,7 @@
5 /* Create the Topic InfoBar */
6 var topic = new Gtk.InfoBar ();
7 topic_name = new Gtk.Label (_("Loading Topic…"));
8+ topic_name.use_markup = true;
9 topic_name.wrap = true;
10 topic_name.halign = Gtk.Align.FILL;
11 topic_name.valign = Gtk.Align.FILL;
12
13=== modified file 'src/Widgets/Server.vala'
14--- src/Widgets/Server.vala 2013-07-17 19:56:12 +0000
15+++ src/Widgets/Server.vala 2013-07-21 15:32:26 +0000
16@@ -203,7 +203,8 @@
17 var channel = get_channel_if_valid (server, chan);
18 if (channel == null)
19 return;
20- channel.room.topic_name.label = topic;
21+ var regex = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[.!\/\\w]*))?)/;
22+ channel.room.topic_name.label = regex.replace (topic, -1, 0, "<a href=\"\\1\">\\1</a>");;
23 });
24
25

Subscribers

People subscribed via source and target branches

to all changes: