Merge lp:~axlrose112/midori/webmedia-now-playing into lp:midori

Proposed by axlrose112
Status: Merged
Approved by: Cris Dywan
Approved revision: no longer in the source branch.
Merged at revision: 6773
Proposed branch: lp:~axlrose112/midori/webmedia-now-playing
Merge into: lp:midori
Diff against target: 49 lines (+11/-10)
1 file modified
extensions/webmedia-now-playing.vala (+11/-10)
To merge this branch: bzr merge lp:~axlrose112/midori/webmedia-now-playing
Reviewer Review Type Date Requested Status
Cris Dywan Approve
Review via email: mp+228891@code.launchpad.net

Commit message

Disable Notify when extension is deactivated

Description of the change

Disable Notify when extension is deactivated

To post a comment you must log in.
Revision history for this message
Cris Dywan (kalikiana) wrote :

8 + Midori.Browser page { get; set; }

This isn't a good use of a global property. You should avoid storing "the" browser whenever you can as there can be many of them.

Rather use the "object" in youtube_validation which is in fact the browser you want.

review: Needs Fixing
6765. By Launchpad Translations on behalf of midori

Launchpad automatic translations update.

Revision history for this message
axlrose112 (axlrose112) wrote :

i fixed it

6766. By Launchpad Translations on behalf of midori

Launchpad automatic translations update.

6767. By gue5t <email address hidden>

Fix crash when saving with associated resources

6768. By Launchpad Translations on behalf of midori

Launchpad automatic translations update.

6769. By Launchpad Translations on behalf of midori

Launchpad automatic translations update.

6770. By Launchpad Translations on behalf of midori

Launchpad automatic translations update.

6771. By Launchpad Translations on behalf of midori

Launchpad automatic translations update.

6772. By Launchpad Translations on behalf of midori

Launchpad automatic translations update.

Revision history for this message
Cris Dywan (kalikiana) wrote :

Nice, thanks!

review: Approve
6773. By axlrose112

Disable Notify when extension is deactivated

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'extensions/webmedia-now-playing.vala'
2--- extensions/webmedia-now-playing.vala 2014-06-01 18:59:01 +0000
3+++ extensions/webmedia-now-playing.vala 2014-07-31 13:25:28 +0000
4@@ -25,18 +25,19 @@
5 deactivate.connect (this.deactivated);
6 }
7
8- void youtube_validation (string title, string uri) {
9- if(uri == title || uri.contains(title)) return;
10- if (web_media_uri == uri) return;
11- if (web_media_title == title) return;
12- web_media_uri = uri;
13- web_media_title = title;
14+ void youtube_validation (Object object, ParamSpec pspec) {
15+ var browser = object as Midori.Browser;
16+ if(browser.uri == browser.title || browser.uri.contains(browser.title)) return;
17+ if (web_media_uri == browser.uri) return;
18+ if (web_media_title == browser.title) return;
19+ web_media_uri = browser.uri;
20+ web_media_title = browser.title;
21 try {
22 var youtube = new Regex("""(http|https)://www.youtube.com/watch\?v=[&=_\-A-Za-z0-9.]+""");
23 var vimeo = new Regex("""(http|https)://vimeo.com/[0-9]+""");
24 var dailymotion = new Regex("""(http|https)://www.dailymotion.com/video/[_\-A-Za-z0-9]+""");
25 string website = null;
26- if (web_media_uri.contains("youtube") || uri.contains("vimeo") || uri.contains ("dailymotion")) {
27+ if (web_media_uri.contains("youtube") || web_media_uri.contains("vimeo") || web_media_uri.contains ("dailymotion")) {
28 if (youtube.match(web_media_uri))
29 website = "Youtube";
30 else if (vimeo.match(web_media_uri))
31@@ -58,9 +59,7 @@
32 }
33
34 void browser_added (Midori.Browser browser) {
35- browser.notify["title"].connect (() => {
36- youtube_validation(browser.title, browser.uri);
37- });
38+ browser.notify["title"].connect (youtube_validation);
39 }
40
41 void activated (Midori.App app) {
42@@ -76,6 +75,8 @@
43 var app = get_app ();
44 app.add_browser.disconnect (browser_added);
45 dbus_service.unregister_service();
46+ foreach (var browser in app.get_browsers ())
47+ browser.notify["title"].disconnect (youtube_validation);
48 }
49 }
50

Subscribers

People subscribed via source and target branches

to all changes: