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

« back to all changes in this revision

Viewing changes to src/Widgets/MainView.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 MainView : Gtk.Stack {
21
 
                public signal void on_show_connect_dialog_request (bool save_as_bookmark);
22
 
                public signal void on_open_bookmarks_request ();
23
 
 
24
 
                private SettingsManager options;
25
 
 
26
 
                private Granite.Widgets.Welcome welcome;
27
 
 
28
 
                public Widgets.Notebook notebook;
29
 
 
30
 
                public MainView () {
31
 
                        options = new SettingsManager ();
32
 
 
33
 
                        welcome = new Granite.Widgets.Welcome (_("Connect to a VNC-Server"), _("Create a new connection or choose one of your bookmarks."));
34
 
                        welcome.append ("add", _("New Connection"), _("Enter hostname, port and your credentials."));
35
 
                        welcome.append ("help-about", _("Open Bookmarks"), _("Choose a server from your bookmarks."));
36
 
                        welcome.activated.connect ((index) => {
37
 
                                if (index == 0) {
38
 
                                        on_show_connect_dialog_request (options.save_new_servers);
39
 
                                } else if (index == 1) {
40
 
                                        on_open_bookmarks_request ();
41
 
                                }
42
 
                        });
43
 
 
44
 
                        this.add_named (welcome, "welcome");
45
 
 
46
 
                        notebook = new Widgets.Notebook ();
47
 
                        notebook.tab_added.connect (() => {
48
 
                                this.transition_duration = 1200;
49
 
                                this.transition_type = Gtk.StackTransitionType.OVER_LEFT;
50
 
                                this.set_visible_child_name ("notebook");
51
 
                        });
52
 
                        notebook.tab_removed.connect (() => {
53
 
                                if (notebook.n_tabs == 0) {
54
 
                                        this.transition_duration = 400;
55
 
                                        this.transition_type = Gtk.StackTransitionType.CROSSFADE;
56
 
                                        this.set_visible_child_name ("welcome");
57
 
                                }
58
 
                        });
59
 
                        notebook.new_tab_requested.connect (() => {
60
 
                                on_show_connect_dialog_request (options.save_new_servers);
61
 
                        });
62
 
 
63
 
                        this.add_named (notebook, "notebook");
64
 
                        this.show_all ();
65
 
                        this.set_visible_child_name ("welcome");
66
 
                }
67
 
        }
 
20
    public class MainView : Gtk.Stack {
 
21
        public signal void on_show_connect_dialog_request (bool save_as_bookmark);
 
22
        public signal void on_open_bookmarks_request ();
 
23
 
 
24
        private SettingsManager options;
 
25
 
 
26
        private Granite.Widgets.Welcome welcome;
 
27
 
 
28
        public Widgets.Notebook notebook;
 
29
 
 
30
        public MainView () {
 
31
            options = new SettingsManager ();
 
32
 
 
33
            welcome = new Granite.Widgets.Welcome (_ ("Connect to a VNC-Server"),
 
34
            _ ("Create a new connection or choose one of your bookmarks."));
 
35
            welcome.append ("add", _ ("New Connection"), _ ("Enter hostname, port and your credentials."));
 
36
            welcome.append ("help-about", _ ("Open Bookmarks"), _ ("Choose a server from your bookmarks."));
 
37
            welcome.activated.connect ((index) => {
 
38
                if (index == 0) {
 
39
                    on_show_connect_dialog_request (options.save_new_servers);
 
40
                } else if (index == 1) {
 
41
                    on_open_bookmarks_request ();
 
42
                }
 
43
            });
 
44
 
 
45
            this.add_named (welcome, "welcome");
 
46
 
 
47
            notebook = new Widgets.Notebook ();
 
48
            notebook.tab_added.connect (() => {
 
49
                this.transition_duration = 1200;
 
50
                this.transition_type = Gtk.StackTransitionType.OVER_LEFT;
 
51
                this.set_visible_child_name ("notebook");
 
52
            });
 
53
            notebook.tab_removed.connect (() => {
 
54
                if (notebook.n_tabs == 0) {
 
55
                    this.transition_duration = 400;
 
56
                    this.transition_type = Gtk.StackTransitionType.CROSSFADE;
 
57
                    this.set_visible_child_name ("welcome");
 
58
                }
 
59
            });
 
60
            notebook.new_tab_requested.connect (() => {
 
61
                on_show_connect_dialog_request (options.save_new_servers);
 
62
            });
 
63
 
 
64
            this.add_named (notebook, "notebook");
 
65
            this.show_all ();
 
66
            this.set_visible_child_name ("welcome");
 
67
        }
 
68
    }
68
69
}
 
 
b'\\ No newline at end of file'