~santi698/gazette/gazette

« back to all changes in this revision

Viewing changes to src/Gazette.vala

  • Committer: Santiago Ocamica
  • Date: 2013-04-20 15:41:05 UTC
  • Revision ID: santi6982@gmail.com-20130420154105-k1mjehjt5xubz7ae
Implemented auto-reload

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
                        });
55
55
                });
56
56
                window.stage.add_child (welcome);
57
 
 
58
 
                var files = new Files ();
59
 
                var weather = new Weather ();
60
 
                var news = new News ();
61
 
                //var calendar = new Calendar();
62
 
 
63
 
                Timeout.add (2000, () => {
64
 
                        var list = GlobalSettings.get_default ().services_enabled;
65
 
                        for (var i = 0; i < list.length; i++) {
66
 
                                string id;
67
 
                                int x, y;
68
 
 
69
 
                                parse_coords (list[i], out id, out x, out y);
70
 
 
71
 
                                switch (id) {
72
 
                                        case  "files":
73
 
                                                files.create ();
74
 
                                                files.x = x > 0 ? x : size[0] - MARGIN - 340;
75
 
                                                files.y = y > 0 ? y : MARGIN + 260;
76
 
                                                files.display ();
77
 
                                                window.stage.add_child (files);
78
 
                                                break;
79
 
                                        case "weather":
80
 
                                                weather.create ();
81
 
                                                weather.x = x > 0 ? x : size[0] - MARGIN - 340;
82
 
                                                weather.y = y > 0 ? y : MARGIN;
83
 
                                                weather.display ();
84
 
                                                window.stage.add_child (weather);
85
 
                                                break;
86
 
                                        case "news":
87
 
                                                news.create ();
88
 
                                                news.x = x > 0 ? x : size[0] - MARGIN - 340;
89
 
                                                news.y = y > 0 ? y : MARGIN + 560;
90
 
                                                news.display ();
91
 
                                                window.stage.add_child (news);
92
 
                                                break;
93
 
                                        default:
94
 
                                                warning ("Unrecognized service requested!");
95
 
                                                break;
96
 
                                }
97
 
                        }
98
 
 
99
 
                        //calendar.create ();
100
 
                        //calendar.x = size[0] - MARGIN - 340;
101
 
                        //calendar.y = MARGIN + 750;
102
 
                        //calendar.display ();
103
 
                        //window.stage.add_child (calendar);
104
 
 
 
57
        
 
58
        Timeout.add(2000, () => {
 
59
                    var list = GlobalSettings.get_default ().services_enabled;
 
60
                    for (var i = 0; i < list.length; i++) {
 
61
                            string id;
 
62
                            int x, y;
 
63
 
 
64
                            parse_coords (list[i], out id, out x, out y);
 
65
 
 
66
                            switch (id) {
 
67
                                    case "files":
 
68
                                        var files = new Files ();
 
69
                                            files.load ();
 
70
                                            files.x = x > 0 ? x : size[0] - MARGIN - 340;
 
71
                                            files.y = y > 0 ? y : MARGIN + 260;
 
72
                                            window.stage.add_child (files);
 
73
                                            break;
 
74
                                    case "weather":
 
75
                                        stdout.printf("detected weather");
 
76
                                        var weather = new Weather ();
 
77
                        weather.load ();
 
78
                                            weather.x = x > 0 ? x : size[0] - MARGIN - 340;
 
79
                                            weather.y = y > 0 ? y : MARGIN;
 
80
                                            window.stage.add_child (weather);
 
81
                                            break;
 
82
                                    case "news":
 
83
                                        stdout.printf("detected news");
 
84
                                        var news = new News ();
 
85
                        news.load ();
 
86
                                            news.x = x > 0 ? x : size[0] - MARGIN - 340;
 
87
                                        news.y = y > 0 ? y : MARGIN + 560;
 
88
                                        window.stage.add_child (news);
 
89
                                            break;
 
90
                                    default:
 
91
                                            warning ("Unrecognized service requested!");
 
92
                                            break;
 
93
                            }
 
94
                    }
 
95
                            //calendar.create ();
 
96
                            //calendar.x = size[0] - MARGIN - 340;
 
97
                            //calendar.y = MARGIN + 750;
 
98
                            //calendar.display ();
 
99
                            //window.stage.add_child (calendar);
105
100
                        return false;
106
 
                });
 
101
        });
107
102
        }
108
 
 
 
103
        
109
104
        void parse_coords (string service, out string id, out int x, out int y)
110
105
        {
111
106
                var parts = service.split (":");