11/*
22* SPDX-License-Identifier: GPL-3.0-or-later
3- * SPDX-FileCopyrightText: 2021 Your Name <you@email .com>
3+ * SPDX-FileCopyrightText: 2024 Alain <alainmh23@gmail .com>
44*/
55
66public class Views.Form : Adw .Bin {
@@ -10,8 +10,12 @@ public class Views.Form : Adw.Bin {
1010 private Gtk . Entry location_entry;
1111 private Granite . Toast toast;
1212
13+ public signal void back ();
1314 public signal void created (string project_name , string location );
1415
16+ public string developer_name { get ; set ; }
17+ public string developer_email { get ; set ; }
18+
1519 construct {
1620 Regex ? project_name_regex = null ;
1721 Regex ? identifier_regex = null ;
@@ -73,35 +77,41 @@ public class Views.Form : Adw.Bin {
7377 button_stack.add_named (new Gtk .Label (_ ("Create Project ")), "button");
7478 button_stack.add_named (spinner , "spinner ");
7579
80+ var back_button = new Gtk .Button () {
81+ child = new Gtk .Image .from_icon_name (" go-previous-symbolic" )
82+ };
83+
7684 var create_button = new Gtk .Button () {
7785 child = button_stack,
78- margin_bottom = 32 ,
79- sensitive = false ,
80- vexpand = true ,
81- valign = END
86+ hexpand = true ,
87+ sensitive = false
8288 };
8389 create_button.add_css_class (Granite .STYLE_CLASS_SUGGESTED_ACTION );
8490
91+ var buttons_box = new Gtk .Box (Gtk . Orientation . HORIZONTAL , 6 ) {
92+ vexpand = true ,
93+ valign = END ,
94+ margin_bottom = 32 ,
95+ };
96+ buttons_box.append (back_button );
97+ buttons_box.append (create_button );
98+
8599 var form_box = new Gtk .Box (Gtk . Orientation . VERTICAL , 0 );
86- form_box.append (new Gtk .Label (_ ("Step 1 /3 ")) {
87- halign = START ,
88- css_classes = { Granite . STYLE_CLASS_DIM_LABEL }
89- });
90- form_box.append (new Gtk .Label (_ ("Sign Up ")) {
100+ form_box.append (new Gtk .Label (_ ("Aplication ")) {
91101 halign = START ,
92102 css_classes = { Granite . STYLE_CLASS_H1_LABEL }
93103 });
94104 form_box.append (new Granite .HeaderLabel (_ ("Project Name :")));
95105 form_box.append (project_name_entry );
96- form_box.append (project_name_description );
106+ // form_box.append (project_name_description);
97107 form_box.append (new Granite .HeaderLabel (_ ("Organization Identifier :")));
98108 form_box.append (identifier_entry );
99- form_box.append (identifier_description );
109+ // form_box.append (identifier_description);
100110 form_box.append (new Granite .HeaderLabel (_ ("Aplication ID :")));
101111 form_box.append (aplication_id_entry );
102112 form_box.append (new Granite .HeaderLabel (_ ("Location :")));
103113 form_box.append (location_entry );
104- form_box.append (create_button );
114+ form_box.append (buttons_box );
105115
106116 var content_box = new Gtk .Box (Gtk . Orientation . VERTICAL , 0 ) {
107117 margin_start = 24 ,
@@ -153,6 +163,10 @@ public class Views.Form : Adw.Bin {
153163 }
154164 });
155165
166+ back_button.clicked.connect (() => {
167+ back ();
168+ });
169+
156170 create_button.clicked.connect (() => {
157171 clone_repo_async (location_entry. text, project_name_entry. text, aplication_id_entry. text, button_stack);
158172 });
@@ -204,6 +218,8 @@ public class Views.Form : Adw.Bin {
204218 rename_file (appdata_file, new_appdata_file);
205219 set_file_content (new_appdata_file, " {{APPLICATION_ID}}" , aplication_id);
206220 set_file_content (new_appdata_file, " {{PROJECT_NAME}}" , project_name);
221+ set_file_content (new_appdata_file, " {{DEVELOPER_NAME}}" , developer_name);
222+ set_file_content (new_appdata_file, " {{DEVELOPER_EMAIL}}" , developer_email);
207223
208224 // Desltop Files
209225 string desktop_file = GLib . Path . build_filename (project_folder, " data" , " {{PROJECT_NAME}}.desktop.in" );
@@ -233,11 +249,15 @@ public class Views.Form : Adw.Bin {
233249 string src_application_file = GLib . Path . build_filename (project_folder, " src" , " Application.vala" );
234250 set_file_content (src_application_file, " {{APPLICATION_ID_GSCHEMA}}" , aplication_id_schema);
235251 set_file_content (src_application_file, " {{APPLICATION_ID}}" , aplication_id);
252+ set_file_content (new_appdata_file, " {{DEVELOPER_NAME}}" , developer_name);
253+ set_file_content (new_appdata_file, " {{DEVELOPER_EMAIL}}" , developer_email);
236254
237255 // src window
238256 string src_window_file = GLib . Path . build_filename (project_folder, " src" , " MainWindow.vala" );
239257 set_file_content (src_window_file, " {{APPLICATION_ID_GSCHEMA}}" , aplication_id_schema);
240258 set_file_content (src_window_file, " {{APPLICATION_ID}}" , aplication_id);
259+ set_file_content (new_appdata_file, " {{DEVELOPER_NAME}}" , developer_name);
260+ set_file_content (new_appdata_file, " {{DEVELOPER_EMAIL}}" , developer_email);
241261
242262 created (project_name_entry. text, location_entry. text);
243263 }
@@ -246,7 +266,6 @@ public class Views.Form : Adw.Bin {
246266 project_name_entry. text = " " ;
247267 identifier_entry. text = " " ;
248268 aplication_id_entry. text = " " ;
249- location_entry. text = " " ;
250269 }
251270
252271 private void set_file_content (string filename, string key, string value ) {
0 commit comments