Skip to content

Commit 86b5d2f

Browse files
committed
fix tabs
1 parent c52c008 commit 86b5d2f

File tree

8 files changed

+206
-206
lines changed

8 files changed

+206
-206
lines changed

src/Application.vala

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
*/
55

66
public class AppGenerator : Gtk.Application {
7-
public MainWindow main_window;
7+
public MainWindow main_window;
88

9-
public static AppGenerator _instance = null;
9+
public static AppGenerator _instance = null;
1010
public static AppGenerator instance {
1111
get {
1212
if (_instance == null) {
@@ -17,68 +17,68 @@ public class AppGenerator : Gtk.Application {
1717
}
1818

1919

20-
public AppGenerator () {
21-
Object (
22-
application_id: "io.github.ellie_commons.app-generator",
23-
flags: ApplicationFlags.FLAGS_NONE
24-
);
25-
}
20+
public AppGenerator () {
21+
Object (
22+
application_id: "io.github.ellie_commons.app-generator",
23+
flags: ApplicationFlags.FLAGS_NONE
24+
);
25+
}
2626

27-
protected override void startup () {
28-
base.startup ();
27+
protected override void startup () {
28+
base.startup ();
2929

30-
Granite.init ();
30+
Granite.init ();
3131

32-
Intl.setlocale (LocaleCategory.ALL, "");
33-
Intl.bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
34-
Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
35-
Intl.textdomain (GETTEXT_PACKAGE);
32+
Intl.setlocale (LocaleCategory.ALL, "");
33+
Intl.bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
34+
Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
35+
Intl.textdomain (GETTEXT_PACKAGE);
3636

37-
var quit_action = new SimpleAction ("quit", null);
37+
var quit_action = new SimpleAction ("quit", null);
3838

39-
add_action (quit_action);
40-
set_accels_for_action ("app.quit", {"<Control>q"});
39+
add_action (quit_action);
40+
set_accels_for_action ("app.quit", {"<Control>q"});
4141

42-
quit_action.activate.connect (quit);
43-
}
42+
quit_action.activate.connect (quit);
43+
}
4444

45-
protected override void activate () {
46-
if (main_window != null) {
45+
protected override void activate () {
46+
if (main_window != null) {
4747
main_window.present ();
4848
return;
4949
}
5050

51-
var main_window = new MainWindow (this);
51+
var main_window = new MainWindow (this);
5252

53-
/*
54-
* This is very finicky. Bind size after present else set_titlebar gives us bad sizes
55-
* Set maximize after height/width else window is min size on unmaximize
56-
* Bind maximize as SET else get get bad sizes
57-
*/
58-
var settings = new Settings ("io.github.ellie_commons.app-generator");
59-
settings.bind ("window-height", main_window, "default-height", SettingsBindFlags.DEFAULT);
60-
settings.bind ("window-width", main_window, "default-width", SettingsBindFlags.DEFAULT);
53+
/*
54+
* This is very finicky. Bind size after present else set_titlebar gives us bad sizes
55+
* Set maximize after height/width else window is min size on unmaximize
56+
* Bind maximize as SET else get get bad sizes
57+
*/
58+
var settings = new Settings ("io.github.ellie_commons.app-generator");
59+
settings.bind ("window-height", main_window, "default-height", SettingsBindFlags.DEFAULT);
60+
settings.bind ("window-width", main_window, "default-width", SettingsBindFlags.DEFAULT);
6161

62-
if (settings.get_boolean ("window-maximized")) {
63-
main_window.maximize ();
64-
}
62+
if (settings.get_boolean ("window-maximized")) {
63+
main_window.maximize ();
64+
}
6565

66-
settings.bind ("window-maximized", main_window, "maximized", SettingsBindFlags.SET);
66+
settings.bind ("window-maximized", main_window, "maximized", SettingsBindFlags.SET);
6767

68-
// Use Css
69-
var provider = new Gtk.CssProvider ();
70-
provider.load_from_resource ("/io/github/ellie_commons/app-generator/Application.css");
68+
// Use Css
69+
var provider = new Gtk.CssProvider ();
70+
provider.load_from_resource ("/io/github/ellie_commons/app-generator/Application.css");
7171

72-
Gtk.StyleContext.add_provider_for_display (
73-
Gdk.Display.get_default (),
74-
provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
75-
);
72+
Gtk.StyleContext.add_provider_for_display (
73+
Gdk.Display.get_default (),
74+
provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
75+
);
7676

77-
main_window.present ();
78-
}
77+
main_window.present ();
78+
}
7979

80-
public static int main (string[] args) {
81-
AppGenerator app = AppGenerator.instance;
80+
public static int main (string[] args) {
81+
AppGenerator app = AppGenerator.instance;
8282
return app.run (args);
83-
}
83+
}
8484
}

src/MainWindow.vala

Lines changed: 121 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -4,136 +4,136 @@
44
*/
55

66
public class MainWindow : Gtk.ApplicationWindow {
7-
private Gtk.Stack main_stack;
8-
9-
public MainWindow (Gtk.Application application) {
10-
Object (
11-
application: application,
12-
default_height: 300,
13-
default_width: 300,
14-
icon_name: "applications-development",
15-
title: _("App Generator")
16-
);
17-
}
18-
19-
static construct {
7+
private Gtk.Stack main_stack;
8+
9+
public MainWindow (Gtk.Application application) {
10+
Object (
11+
application: application,
12+
default_height: 300,
13+
default_width: 300,
14+
icon_name: "applications-development",
15+
title: _("App Generator")
16+
);
17+
}
18+
19+
static construct {
2020
weak Gtk.IconTheme default_theme = Gtk.IconTheme.get_for_display (Gdk.Display.get_default ());
2121
default_theme.add_resource_path ("/io/github/ellie_commons/app-generator/");
2222
}
2323

24-
construct {
25-
var headerbar = new Gtk.HeaderBar () {
24+
construct {
25+
var headerbar = new Gtk.HeaderBar () {
2626
title_widget = new Gtk.Label (null),
2727
hexpand = true
2828
};
2929

30-
var project_icon = new Gtk.Image.from_icon_name ("applications-development") {
31-
pixel_size = 96
32-
};
33-
34-
var title_label = new Gtk.Label (_("App Generator"));
35-
title_label.add_css_class (Granite.STYLE_CLASS_H1_LABEL);
36-
37-
var description_label = new Gtk.Label (_("Create an elementary OS app using one of the pre-made app templates")) {
38-
wrap = true,
39-
justify = CENTER
40-
};
41-
description_label.add_css_class (Granite.STYLE_CLASS_DIM_LABEL);
42-
43-
var left_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 6) {
44-
valign = CENTER,
45-
margin_start = 64,
46-
margin_end = 64,
47-
margin_bottom = 32
48-
};
49-
left_box.append (project_icon);
50-
left_box.append (title_label);
51-
left_box.append (description_label);
52-
53-
var stepper = new Widgets.Stepper () {
54-
margin_start = 24,
55-
margin_end = 24,
56-
margin_bottom = 24
57-
};
58-
stepper.add_step (_("Developer"));
59-
stepper.add_step (_("Application"));
60-
stepper.add_step (_("Finalized"));
61-
62-
var developer_view = new Views.Developer ();
63-
var form_view = new Views.Form ();
64-
var success_view = new Views.Success ();
65-
66-
main_stack = new Gtk.Stack () {
67-
transition_type = Gtk.StackTransitionType.SLIDE_LEFT_RIGHT
68-
};
69-
main_stack.add_named (developer_view, "developer");
70-
main_stack.add_named (form_view, "form");
71-
main_stack.add_named (success_view, "success");
72-
73-
var form_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
74-
form_box.append (stepper);
75-
form_box.append (main_stack);
76-
77-
var main_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0) {
78-
hexpand = true,
79-
vexpand = true
80-
};
81-
82-
main_box.append (left_box);
83-
main_box.append (new Gtk.Separator (Gtk.Orientation.VERTICAL) {
84-
margin_bottom = 32
85-
});
86-
main_box.append (form_box);
87-
88-
var toolbar_view = new Adw.ToolbarView ();
30+
var project_icon = new Gtk.Image.from_icon_name ("applications-development") {
31+
pixel_size = 96
32+
};
33+
34+
var title_label = new Gtk.Label (_("App Generator"));
35+
title_label.add_css_class (Granite.STYLE_CLASS_H1_LABEL);
36+
37+
var description_label = new Gtk.Label (_("Create an elementary OS app using one of the pre-made app templates")) {
38+
wrap = true,
39+
justify = CENTER
40+
};
41+
description_label.add_css_class (Granite.STYLE_CLASS_DIM_LABEL);
42+
43+
var left_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 6) {
44+
valign = CENTER,
45+
margin_start = 64,
46+
margin_end = 64,
47+
margin_bottom = 32
48+
};
49+
left_box.append (project_icon);
50+
left_box.append (title_label);
51+
left_box.append (description_label);
52+
53+
var stepper = new Widgets.Stepper () {
54+
margin_start = 24,
55+
margin_end = 24,
56+
margin_bottom = 24
57+
};
58+
stepper.add_step (_("Developer"));
59+
stepper.add_step (_("Application"));
60+
stepper.add_step (_("Finalized"));
61+
62+
var developer_view = new Views.Developer ();
63+
var form_view = new Views.Form ();
64+
var success_view = new Views.Success ();
65+
66+
main_stack = new Gtk.Stack () {
67+
transition_type = Gtk.StackTransitionType.SLIDE_LEFT_RIGHT
68+
};
69+
main_stack.add_named (developer_view, "developer");
70+
main_stack.add_named (form_view, "form");
71+
main_stack.add_named (success_view, "success");
72+
73+
var form_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
74+
form_box.append (stepper);
75+
form_box.append (main_stack);
76+
77+
var main_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0) {
78+
hexpand = true,
79+
vexpand = true
80+
};
81+
82+
main_box.append (left_box);
83+
main_box.append (new Gtk.Separator (Gtk.Orientation.VERTICAL) {
84+
margin_bottom = 32
85+
});
86+
main_box.append (form_box);
87+
88+
var toolbar_view = new Adw.ToolbarView ();
8989
toolbar_view.add_top_bar (headerbar);
9090
toolbar_view.content = main_box;
9191

92-
child = toolbar_view;
93-
94-
// We need to hide the title area for the split headerbar
95-
var null_title = new Gtk.Grid () {
96-
visible = false
97-
};
98-
set_titlebar (null_title);
99-
100-
// Set default elementary thme
101-
var gtk_settings = Gtk.Settings.get_default ();
102-
gtk_settings.gtk_icon_theme_name = "elementary";
103-
if (!(gtk_settings.gtk_theme_name.has_prefix ("io.elementary.stylesheet"))) {
104-
gtk_settings.gtk_theme_name = "io.elementary.stylesheet.blueberry";
105-
}
106-
107-
form_view.created.connect ((project_naame, location) => {
108-
success_view.project_location = location + "/" + project_naame;
109-
110-
stepper.active_index = 2;
111-
main_stack.visible_child_name = "success";
112-
success_view.animation = true;
113-
114-
Timeout.add_once (1000, () => {
115-
success_view.animation = false;
116-
});
117-
});
118-
119-
form_view.back.connect (() => {
120-
main_stack.visible_child_name = "developer";
121-
});
122-
123-
developer_view.next.connect ((name, email) => {
124-
stepper.active_index = 1;
125-
main_stack.visible_child_name = "form";
126-
127-
form_view.developer_name = name;
128-
form_view.developer_email = email;
129-
});
130-
131-
success_view.back.connect (() => {
132-
stepper.active_index = 0;
133-
main_stack.visible_child_name = "developer";
134-
135-
developer_view.reset_form ();
136-
form_view.reset_form ();
137-
});
138-
}
92+
child = toolbar_view;
93+
94+
// We need to hide the title area for the split headerbar
95+
var null_title = new Gtk.Grid () {
96+
visible = false
97+
};
98+
set_titlebar (null_title);
99+
100+
// Set default elementary thme
101+
var gtk_settings = Gtk.Settings.get_default ();
102+
gtk_settings.gtk_icon_theme_name = "elementary";
103+
if (!(gtk_settings.gtk_theme_name.has_prefix ("io.elementary.stylesheet"))) {
104+
gtk_settings.gtk_theme_name = "io.elementary.stylesheet.blueberry";
105+
}
106+
107+
form_view.created.connect ((project_naame, location) => {
108+
success_view.project_location = location + "/" + project_naame;
109+
110+
stepper.active_index = 2;
111+
main_stack.visible_child_name = "success";
112+
success_view.animation = true;
113+
114+
Timeout.add_once (1000, () => {
115+
success_view.animation = false;
116+
});
117+
});
118+
119+
form_view.back.connect (() => {
120+
main_stack.visible_child_name = "developer";
121+
});
122+
123+
developer_view.next.connect ((name, email) => {
124+
stepper.active_index = 1;
125+
main_stack.visible_child_name = "form";
126+
127+
form_view.developer_name = name;
128+
form_view.developer_email = email;
129+
});
130+
131+
success_view.back.connect (() => {
132+
stepper.active_index = 0;
133+
main_stack.visible_child_name = "developer";
134+
135+
developer_view.reset_form ();
136+
form_view.reset_form ();
137+
});
138+
}
139139
}

0 commit comments

Comments
 (0)