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
1=== modified file 'schemas/org.pantheon.birdie.gschema.xml'
2--- schemas/org.pantheon.birdie.gschema.xml 2013-03-10 11:36:46 +0000
3+++ schemas/org.pantheon.birdie.gschema.xml 2013-03-13 12:15:28 +0000
4@@ -16,6 +16,30 @@
5 Token secret
6 </description>
7 </key>
8+
9+ <key name="tweet-notification" type="b">
10+ <default>false</default>
11+ <summary>tweet-notification</summary>
12+ <description>
13+ Desktop notifications for new tweets
14+ </description>
15+ </key>
16+
17+ <key name="mention-notification" type="b">
18+ <default>true</default>
19+ <summary>mention-notification</summary>
20+ <description>
21+ Desktop notifications for new mentions
22+ </description>
23+ </key>
24+
25+ <key name="dm-notification" type="b">
26+ <default>true</default>
27+ <summary>dm-notification</summary>
28+ <description>
29+ Desktop notifications for new direct messages
30+ </description>
31+ </key>
32
33 </schema>
34 </schemalist>
35
36=== modified file 'src/Birdie.vala'
37--- src/Birdie.vala 2013-03-13 00:02:46 +0000
38+++ src/Birdie.vala 2013-03-13 12:15:28 +0000
39@@ -36,8 +36,14 @@
40 private int unread_mentions;
41 private int unread_dm;
42
43+ private bool tweet_notification;
44+ private bool mention_notification;
45+ private bool dm_notification;
46+
47 private Regex urls;
48
49+ Settings settings;
50+
51 construct {
52 program_name = "Birdie";
53 exec_name = "birdie";
54@@ -71,6 +77,13 @@
55 this.unread_mentions = 0;
56 this.unread_dm = 0;
57
58+ // notification settings
59+ settings = new Settings ("org.pantheon.birdie");
60+
61+ this.tweet_notification = settings.get_boolean ("tweet-notification");
62+ this.mention_notification = settings.get_boolean ("mention-notification");
63+ this.dm_notification = settings.get_boolean ("dm-notification");
64+
65 this.new_tweet = new Gtk.ToolButton (new Gtk.Image.from_icon_name ("mail-message-new", Gtk.IconSize.LARGE_TOOLBAR), _("New Tweet"));
66 new_tweet.set_tooltip_text (_("New Tweet"));
67 new_tweet.clicked.connect (() => {
68@@ -401,14 +414,18 @@
69
70 this.api.home_timeline_since_id.foreach ((tweet) => {
71 this.home_list.append (tweet, this);
72- if (this.api.account.screen_name != tweet.user_screen_name) {
73- Utils.notify ("New tweet from " + tweet.user_name, tweet.text);
74+ if (this.tweet_notification == true) {
75+ if (this.api.account.screen_name != tweet.user_screen_name) {
76+ Utils.notify ("New tweet from " + tweet.user_name, tweet.text);
77+ }
78+ this.unread_tweets++;
79 }
80- this.unread_tweets++;
81 });
82-
83- this.indicator.update_tweets_indicator (this.unread_tweets);
84- this.launcher.update_launcher_count (this.unread_tweets + this.unread_mentions + this.unread_dm);
85+
86+ if (this.tweet_notification == true) {
87+ this.indicator.update_tweets_indicator (this.unread_tweets);
88+ this.launcher.update_launcher_count (this.unread_tweets + this.unread_mentions + this.unread_dm);
89+ }
90 }
91
92 public void update_mentions () {
93@@ -417,14 +434,18 @@
94
95 this.api.mentions_timeline_since_id.foreach ((tweet) => {
96 this.mentions_list.append (tweet, this);
97- this.unread_mentions++;
98- if (this.api.account.screen_name != tweet.user_screen_name) {
99- Utils.notify ("New mention from " + tweet.user_name, tweet.text);
100+ if (this.mention_notification == true) {
101+ if (this.api.account.screen_name != tweet.user_screen_name) {
102+ Utils.notify ("New mention from " + tweet.user_name, tweet.text);
103+ }
104+ this.unread_mentions++;
105 }
106 });
107
108- this.indicator.update_mentions_indicator (this.unread_mentions);
109- this.launcher.update_launcher_count (this.unread_tweets + this.unread_mentions + this.unread_dm);
110+ if (this.mention_notification == true) {
111+ this.indicator.update_mentions_indicator (this.unread_mentions);
112+ this.launcher.update_launcher_count (this.unread_tweets + this.unread_mentions + this.unread_dm);
113+ }
114 }
115
116 public void tweet_callback (string text, string id = "") {

Subscribers

People subscribed via source and target branches

to all changes: