Imported Upstream version 0.2.10
[debian/pino.git] / src / timeline_list.vala
index 36edb4a..805f362 100644 (file)
@@ -65,7 +65,6 @@ public class TimelineList : TimelineListAbstract {
        
        public signal void fresh();
        public signal void no_fresh();
-       public signal void deleted(string message);
        
        public TimelineList(Window _parent, Accounts _accounts, TimelineType timeline_type,
                Template _template, int __items_count = 20, Icon? _icon = null,
@@ -113,12 +112,23 @@ public class TimelineList : TimelineListAbstract {
                } catch(RestError e) {
                        updating_error(e.message);
                        return result;
+               } catch(ParseError e) {
+                       updating_error(e.message);
+                       return result;
                }
                
+               debug("SIZE: %d", result.size);
+               
                if(result.size > 0) { //if we got some statuses
                        if((!_parent_focus || !act.active) && lst.size > 0) { //if this list is not visible and we have updates
+                               int self_count = 0;
+                               foreach(Status status in result) {
+                                       if(status.user_screen_name == api.account.login)
+                                               self_count++;
+                               }
                                
-                               have_fresh = true;
+                               if(self_count < result.size) //if we got not only our tweets
+                                       have_fresh = true;
                        }
                        
                        if(lst.size == 0) {
@@ -135,9 +145,7 @@ public class TimelineList : TimelineListAbstract {
                if(!parent_focus) //delete only if main window out of focus
                        delete_extra();
                
-               warning("SIZE: %d", lst.size);
-               
-               refresh();
+               refresh(true);
                
                if((act.active && _parent_focus) || last_focused == 0) {
                        if(lst.size > 0)
@@ -160,7 +168,7 @@ public class TimelineList : TimelineListAbstract {
                
                //last_focused = (int)lst.get(0).created_at.mktime();
                
-               refresh();
+               refresh(true);
        }
        
        /* delete status with some id */
@@ -168,7 +176,7 @@ public class TimelineList : TimelineListAbstract {
                try {
                        api.destroy_status(id);
                } catch(RestError e) {
-                       warning(e.message);
+                       debug(e.message);
                        updating_error(e.message);
                        return;
                }
@@ -183,19 +191,20 @@ public class TimelineList : TimelineListAbstract {
                
                last_focused = (int)lst.get(0).created_at.mktime();
                
-               refresh();
+               refresh(true);
                
                deleted(_("Your status has been deleted successfully")); //signal
        }
        
        /* get older statuses */
        protected override void get_older() {
+               debug("more");
                if(lst.size < 1)
                        return;
                
                more.set_enabled(false);
                
-               ArrayList<RestAPI.Status> result;
+               ArrayList<RestAPI.Status>? result = null;
                string max_id = lst.get(lst.size - 1).id;
                
                try {
@@ -204,6 +213,9 @@ public class TimelineList : TimelineListAbstract {
                        more.set_enabled(true);
                        updating_error(e.message);
                        return;
+               } catch(ParseError e) {
+                       updating_error(e.message);
+                       return;
                }
                
                if(result.size < 2) {
@@ -217,6 +229,6 @@ public class TimelineList : TimelineListAbstract {
                
                more.set_enabled(true);
                
-               refresh();
+               refresh(true);
        }
 }