Merge lp:~vasco-m-nunes/birdie/birdie-notifications-conf into lp:~birdie-team/birdie/trunk-old

Proposed by vasco
Status: Merged
Merged at revision: 19
Proposed branch: lp:~vasco-m-nunes/birdie/birdie-notifications-conf
Merge into: lp:~birdie-team/birdie/trunk-old
Diff against target: 116 lines (+56/-11)
2 files modified
schemas/org.pantheon.birdie.gschema.xml (+24/-0)
src/Birdie.vala (+32/-11)
To merge this branch: bzr merge lp:~vasco-m-nunes/birdie/birdie-notifications-conf
Reviewer Review Type Date Requested Status
Birdie Developers Pending
Review via email: mp+153120@code.launchpad.net
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
=== modified file 'schemas/org.pantheon.birdie.gschema.xml'
--- schemas/org.pantheon.birdie.gschema.xml 2013-03-10 11:36:46 +0000
+++ schemas/org.pantheon.birdie.gschema.xml 2013-03-13 12:15:28 +0000
@@ -16,6 +16,30 @@
16 Token secret16 Token secret
17 </description>17 </description>
18 </key>18 </key>
19
20 <key name="tweet-notification" type="b">
21 <default>false</default>
22 <summary>tweet-notification</summary>
23 <description>
24 Desktop notifications for new tweets
25 </description>
26 </key>
27
28 <key name="mention-notification" type="b">
29 <default>true</default>
30 <summary>mention-notification</summary>
31 <description>
32 Desktop notifications for new mentions
33 </description>
34 </key>
35
36 <key name="dm-notification" type="b">
37 <default>true</default>
38 <summary>dm-notification</summary>
39 <description>
40 Desktop notifications for new direct messages
41 </description>
42 </key>
1943
20 </schema>44 </schema>
21</schemalist>45</schemalist>
2246
=== modified file 'src/Birdie.vala'
--- src/Birdie.vala 2013-03-13 00:02:46 +0000
+++ src/Birdie.vala 2013-03-13 12:15:28 +0000
@@ -36,8 +36,14 @@
36 private int unread_mentions;36 private int unread_mentions;
37 private int unread_dm;37 private int unread_dm;
38 38
39 private bool tweet_notification;
40 private bool mention_notification;
41 private bool dm_notification;
42
39 private Regex urls;43 private Regex urls;
40 44
45 Settings settings;
46
41 construct {47 construct {
42 program_name = "Birdie";48 program_name = "Birdie";
43 exec_name = "birdie";49 exec_name = "birdie";
@@ -71,6 +77,13 @@
71 this.unread_mentions = 0;77 this.unread_mentions = 0;
72 this.unread_dm = 0;78 this.unread_dm = 0;
73 79
80 // notification settings
81 settings = new Settings ("org.pantheon.birdie");
82
83 this.tweet_notification = settings.get_boolean ("tweet-notification");
84 this.mention_notification = settings.get_boolean ("mention-notification");
85 this.dm_notification = settings.get_boolean ("dm-notification");
86
74 this.new_tweet = new Gtk.ToolButton (new Gtk.Image.from_icon_name ("mail-message-new", Gtk.IconSize.LARGE_TOOLBAR), _("New Tweet"));87 this.new_tweet = new Gtk.ToolButton (new Gtk.Image.from_icon_name ("mail-message-new", Gtk.IconSize.LARGE_TOOLBAR), _("New Tweet"));
75 new_tweet.set_tooltip_text (_("New Tweet"));88 new_tweet.set_tooltip_text (_("New Tweet"));
76 new_tweet.clicked.connect (() => {89 new_tweet.clicked.connect (() => {
@@ -401,14 +414,18 @@
401 414
402 this.api.home_timeline_since_id.foreach ((tweet) => {415 this.api.home_timeline_since_id.foreach ((tweet) => {
403 this.home_list.append (tweet, this);416 this.home_list.append (tweet, this);
404 if (this.api.account.screen_name != tweet.user_screen_name) {417 if (this.tweet_notification == true) {
405 Utils.notify ("New tweet from " + tweet.user_name, tweet.text);418 if (this.api.account.screen_name != tweet.user_screen_name) {
419 Utils.notify ("New tweet from " + tweet.user_name, tweet.text);
420 }
421 this.unread_tweets++;
406 }422 }
407 this.unread_tweets++;
408 });423 });
409 424
410 this.indicator.update_tweets_indicator (this.unread_tweets);425 if (this.tweet_notification == true) {
411 this.launcher.update_launcher_count (this.unread_tweets + this.unread_mentions + this.unread_dm);426 this.indicator.update_tweets_indicator (this.unread_tweets);
427 this.launcher.update_launcher_count (this.unread_tweets + this.unread_mentions + this.unread_dm);
428 }
412 }429 }
413 430
414 public void update_mentions () {431 public void update_mentions () {
@@ -417,14 +434,18 @@
417 434
418 this.api.mentions_timeline_since_id.foreach ((tweet) => {435 this.api.mentions_timeline_since_id.foreach ((tweet) => {
419 this.mentions_list.append (tweet, this);436 this.mentions_list.append (tweet, this);
420 this.unread_mentions++;437 if (this.mention_notification == true) {
421 if (this.api.account.screen_name != tweet.user_screen_name) {438 if (this.api.account.screen_name != tweet.user_screen_name) {
422 Utils.notify ("New mention from " + tweet.user_name, tweet.text);439 Utils.notify ("New mention from " + tweet.user_name, tweet.text);
440 }
441 this.unread_mentions++;
423 }442 }
424 });443 });
425444
426 this.indicator.update_mentions_indicator (this.unread_mentions);445 if (this.mention_notification == true) {
427 this.launcher.update_launcher_count (this.unread_tweets + this.unread_mentions + this.unread_dm);446 this.indicator.update_mentions_indicator (this.unread_mentions);
447 this.launcher.update_launcher_count (this.unread_tweets + this.unread_mentions + this.unread_dm);
448 }
428 }449 }
429 450
430 public void tweet_callback (string text, string id = "") {451 public void tweet_callback (string text, string id = "") {

Subscribers

People subscribed via source and target branches

to all changes: