~l-admin-3/evnc/automatic-cleanup-branch

« back to all changes in this revision

Viewing changes to src/Widgets/Information.vala

  • Committer: Marcus Wichelmann
  • Date: 2015-07-09 18:17:05 UTC
  • Revision ID: marcus.wichelmann@hotmail.de-20150709181705-aliu5vv3gvha1p0a
Automatic code cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
*/
18
18
 
19
19
namespace evnc.Widgets {
20
 
        public class Information : Gtk.InfoBar {
21
 
                public Information () {
22
 
                        // Hide the bar
23
 
                        this.set_no_show_all (true);
24
 
                        this.set_visible (false);
25
 
                }
26
 
 
27
 
                public void show_text (Gtk.MessageType info_type, string info_message) {
28
 
                        this.set_no_show_all (false);
29
 
                        this.set_visible (true);
30
 
 
31
 
                        // Remove old objects
32
 
                        ((Gtk.Box)this.get_content_area ()).get_children ().foreach ((widg) => {
33
 
                                if (widg != null)
34
 
                                        widg.destroy ();
35
 
                        });
36
 
 
37
 
                        this.set_message_type (info_type);
38
 
 
39
 
                        var info_label = new Gtk.Label (info_message);
40
 
                        info_label.ellipsize = Pango.EllipsizeMode.END;
41
 
                        info_label.use_markup = true;
42
 
                        info_label.set_markup (info_message);
43
 
 
44
 
                        var info_container = this.get_content_area () as Gtk.Box;
45
 
                        info_container.orientation = Gtk.Orientation.HORIZONTAL;
46
 
                        info_container.pack_start (info_label, false, false, 0);
47
 
 
48
 
                        this.set_show_close_button (true);
49
 
 
50
 
                        // Close Event
51
 
                        this.response.connect (() => {
52
 
                                this.set_no_show_all (true);
53
 
                                this.set_visible (false);
54
 
                        });
55
 
 
56
 
                        this.show_all ();
57
 
 
58
 
                        Timeout.add (5000, () => {
59
 
                                this.set_no_show_all (true);
60
 
                                this.set_visible (false);
61
 
                                return false;
62
 
                        }, Priority.DEFAULT);
63
 
                }
64
 
        }
 
20
    public class Information : Gtk.InfoBar {
 
21
        public Information () {
 
22
            // Hide the bar
 
23
            this.set_no_show_all (true);
 
24
            this.set_visible (false);
 
25
        }
 
26
 
 
27
        public void show_text (Gtk.MessageType info_type, string info_message) {
 
28
            this.set_no_show_all (false);
 
29
            this.set_visible (true);
 
30
 
 
31
            // Remove old objects
 
32
            ((Gtk.Box)this.get_content_area ()).get_children ().foreach ((widg) => {
 
33
                if (widg != null) {
 
34
                    widg.destroy ();
 
35
                }
 
36
            });
 
37
 
 
38
            this.set_message_type (info_type);
 
39
 
 
40
            var info_label = new Gtk.Label (info_message);
 
41
            info_label.ellipsize = Pango.EllipsizeMode.END;
 
42
            info_label.use_markup = true;
 
43
            info_label.set_markup (info_message);
 
44
 
 
45
            var info_container = this.get_content_area () as Gtk.Box;
 
46
            info_container.orientation = Gtk.Orientation.HORIZONTAL;
 
47
            info_container.pack_start (info_label, false, false, 0);
 
48
 
 
49
            this.set_show_close_button (true);
 
50
 
 
51
            // Close Event
 
52
            this.response.connect (() => {
 
53
                this.set_no_show_all (true);
 
54
                this.set_visible (false);
 
55
            });
 
56
 
 
57
            this.show_all ();
 
58
 
 
59
            Timeout.add (5000, () => {
 
60
                this.set_no_show_all (true);
 
61
                this.set_visible (false);
 
62
                return false;
 
63
            }, Priority.DEFAULT);
 
64
        }
 
65
    }
65
66
}
 
 
b'\\ No newline at end of file'