← Back to team overview

birdie-team team mailing list archive

[Merge] lp:~vasco-m-nunes/birdie/birdie-notifications-conf into lp:birdie

 

vasco has proposed merging lp:~vasco-m-nunes/birdie/birdie-notifications-conf into lp:birdie.

Requested reviews:
  Birdie Team (birdie-team)

For more details, see:
https://code.launchpad.net/~vasco-m-nunes/birdie/birdie-notifications-conf/+merge/153120
-- 
https://code.launchpad.net/~vasco-m-nunes/birdie/birdie-notifications-conf/+merge/153120
Your team Birdie Team is requested to review the proposed merge of lp:~vasco-m-nunes/birdie/birdie-notifications-conf into lp:birdie.
=== 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 @@
         Token secret
       </description>
     </key>
+    
+    <key name="tweet-notification" type="b">
+      <default>false</default>
+      <summary>tweet-notification</summary>
+      <description>
+        Desktop notifications for new tweets
+      </description>
+    </key>
+    
+    <key name="mention-notification" type="b">
+      <default>true</default>
+      <summary>mention-notification</summary>
+      <description>
+        Desktop notifications for new mentions
+      </description>
+    </key>
+    
+    <key name="dm-notification" type="b">
+      <default>true</default>
+      <summary>dm-notification</summary>
+      <description>
+        Desktop notifications for new direct messages
+      </description>
+    </key>
 
   </schema>
 </schemalist>

=== 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 @@
         private int unread_mentions;
         private int unread_dm;
         
+        private bool tweet_notification;
+        private bool mention_notification;
+        private bool dm_notification;
+        
         private Regex urls;
         
+        Settings settings;
+        
         construct {
             program_name        = "Birdie";
             exec_name           = "birdie";
@@ -71,6 +77,13 @@
                 this.unread_mentions = 0;
                 this.unread_dm = 0;
                 
+                // notification settings
+                settings = new Settings ("org.pantheon.birdie");
+                
+                this.tweet_notification = settings.get_boolean ("tweet-notification");
+                this.mention_notification = settings.get_boolean ("mention-notification");
+                this.dm_notification = settings.get_boolean ("dm-notification");
+                
                 this.new_tweet = new Gtk.ToolButton (new Gtk.Image.from_icon_name ("mail-message-new", Gtk.IconSize.LARGE_TOOLBAR), _("New Tweet"));
                 new_tweet.set_tooltip_text (_("New Tweet"));
 		        new_tweet.clicked.connect (() => {
@@ -401,14 +414,18 @@
 	            
             this.api.home_timeline_since_id.foreach ((tweet) => {
                 this.home_list.append (tweet, this);
-                if (this.api.account.screen_name != tweet.user_screen_name) {
-                    Utils.notify ("New tweet from " + tweet.user_name, tweet.text);
+                if (this.tweet_notification == true) {
+                    if (this.api.account.screen_name != tweet.user_screen_name) {
+                        Utils.notify ("New tweet from " + tweet.user_name, tweet.text);
+                    }
+                    this.unread_tweets++;
                 }
-                this.unread_tweets++;
 	        });
-	                   
-            this.indicator.update_tweets_indicator (this.unread_tweets);
-            this.launcher.update_launcher_count (this.unread_tweets + this.unread_mentions + this.unread_dm);
+	           
+	        if (this.tweet_notification == true) {           
+                this.indicator.update_tweets_indicator (this.unread_tweets);
+                this.launcher.update_launcher_count (this.unread_tweets + this.unread_mentions + this.unread_dm);
+            }
         }
         
         public void update_mentions () {
@@ -417,14 +434,18 @@
             
             this.api.mentions_timeline_since_id.foreach ((tweet) => {
                 this.mentions_list.append (tweet, this);
-                this.unread_mentions++;
-                if (this.api.account.screen_name != tweet.user_screen_name) {
-                    Utils.notify ("New mention from " + tweet.user_name, tweet.text);
+                if (this.mention_notification == true) {
+                    if (this.api.account.screen_name != tweet.user_screen_name) {
+                        Utils.notify ("New mention from " + tweet.user_name, tweet.text);
+                    }
+                    this.unread_mentions++;
                 }
             });
 
-            this.indicator.update_mentions_indicator (this.unread_mentions);
-            this.launcher.update_launcher_count (this.unread_tweets + this.unread_mentions + this.unread_dm);
+            if (this.mention_notification == true) {
+                this.indicator.update_mentions_indicator (this.unread_mentions);
+                this.launcher.update_launcher_count (this.unread_tweets + this.unread_mentions + this.unread_dm);
+            }
         }
         
         public void tweet_callback (string text, string id = "") {


References