diff --git a/gresource.xml b/gresource.xml
index 319ad25..0d5be4f 100644
--- a/gresource.xml
+++ b/gresource.xml
@@ -18,6 +18,8 @@
ubinstall-gtk-network-box.glade
ubinstall-gtk-advanced-box.glade
ubinstall-gtk-configuration-mode.glade
+ ubinstall-gtk-source.glade
+ ubinstall-gtk-source-element.glade
ubinstall-gtk.css
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 4256ed5..5273271 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -75,6 +75,8 @@ set(DEPENDFILES
../ubinstall-gtk-network-box.glade
../ubinstall-gtk-advanced-box.glade
../ubinstall-gtk-configuration-mode.glade
+ ../ubinstall-gtk-source.glade
+ ../ubinstall-gtk-source-element.glade
../gresource.xml
../ubinstall-gtk.css
../modules.csv
diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c
index 905de73..d133411 100644
--- a/source/ubinstall-gtk.c
+++ b/source/ubinstall-gtk.c
@@ -91,6 +91,143 @@ double yon_size_long_convert_to_mod(double size, char mod){
return final_size;
}
+source_element *yon_source_element_new(){
+ source_element *element = new(source_element);
+ GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_source_element);
+
+ element->MainBox = yon_gtk_builder_get_widget(builder,"MainBox");
+ element->TypeCombo = yon_gtk_builder_get_widget(builder,"TypeCombo");
+ element->PathEntry = yon_gtk_builder_get_widget(builder,"PathEntry");
+ element->PathButton = yon_gtk_builder_get_widget(builder,"PathButton");
+ element->RemoveButton = yon_gtk_builder_get_widget(builder,"RemoveButton");
+
+ g_signal_connect(G_OBJECT(element->RemoveButton),"clicked",G_CALLBACK(on_source_remove),element);
+ g_signal_connect(G_OBJECT(element->PathButton),"clicked",G_CALLBACK(on_source_choose),element);
+ g_object_set_data(G_OBJECT(element->PathButton),"combo",element->TypeCombo);
+
+ return element;
+}
+
+void yon_source_element_add(char *key,void*,source_window *window){
+ source_element *element = yon_source_element_new();
+ gtk_entry_set_text(GTK_ENTRY(element->PathEntry),key);
+ gtk_box_pack_start(GTK_BOX(window->AddBox),element->MainBox,0,0,0);
+ g_object_set_data(G_OBJECT(element->MainBox),"window",window);
+ g_object_set_data(G_OBJECT(element->PathButton),"target",window->PathEntry);
+}
+
+void yon_source_update(source_window *window){
+ GList *list = gtk_container_get_children(GTK_CONTAINER(window->AddBox));
+ GList *iter;
+ for (iter=list;iter;iter=iter->next){
+ gtk_widget_destroy(GTK_WIDGET(iter->data));
+ }
+ g_hash_table_foreach(window->sources,(GHFunc)yon_source_element_add,window);
+}
+
+void on_source_add(GtkWidget *,source_window *window){
+ const char *path = gtk_entry_get_text(GTK_ENTRY(window->PathEntry));
+ if (!g_hash_table_contains(window->sources,path)){
+ g_hash_table_add(window->sources,yon_char_new(path));
+ yon_source_update(window);
+ }
+}
+
+void on_source_remove(GtkWidget *,source_element *element){
+ source_window *window = g_object_get_data(G_OBJECT(element->MainBox),"window");
+ const char *path = gtk_entry_get_text(GTK_ENTRY(window->PathEntry));
+ if (g_hash_table_contains(window->sources,path)){
+ g_hash_table_remove(window->sources,path);
+ yon_source_update(window);
+ }
+}
+
+void on_source_choose(GtkWidget *self){
+ GtkWidget *target_entry = g_object_get_data(G_OBJECT(self),"target");
+ GtkWidget *target_mode = g_object_get_data(G_OBJECT(self),"combo");
+ switch (gtk_combo_box_get_active(GTK_COMBO_BOX(target_mode))){
+ case 0: {
+
+ } break;
+ case 1:{
+ filechooser_window *dialog = yon_file_chooser_window_new(GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
+ yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(dialog->Window),OPEN_LABEL,icon_path,"filechooser_window");
+ if (yon_file_chooser_start(dialog)==GTK_RESPONSE_ACCEPT){
+ gtk_entry_set_text(GTK_ENTRY(target_entry),dialog->last_success_selection);
+ free(dialog);
+ }
+
+ } break;
+ case 2: {
+ filechooser_window *dialog = yon_file_chooser_window_new(GTK_FILE_CHOOSER_ACTION_OPEN);
+ yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(dialog->Window),OPEN_LABEL,icon_path,"filechooser_window");
+ GtkFileFilter *filter = gtk_file_filter_new();
+ gtk_file_filter_add_pattern(filter,"*.iso");
+ gtk_file_filter_set_name(filter,".iso");
+ gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog->MainFileChooser),filter);
+
+ if (yon_file_chooser_start(dialog)==GTK_RESPONSE_ACCEPT){
+ gtk_entry_set_text(GTK_ENTRY(target_entry),dialog->last_success_selection);
+ free(dialog);
+ }
+
+ } break;
+ }
+}
+
+void on_source_accept(GtkWidget *,source_window *window){
+ if (gtk_switch_get_active(GTK_SWITCH(window->AutoSwitch))){
+ yon_config_register(source_parameter,source_parameter_command,"auto");
+ }
+ guint size;
+ config_str paths = (config_str)g_hash_table_get_keys_as_array(window->sources,&size);
+ if (!size){
+ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
+ yon_ubl_status_highlight_incorrect(window->PathEntry);
+ return;
+ }
+ char *parameter_string = yon_char_parsed_to_string(paths,(int)size,",");
+ yon_config_register(source_parameter,source_parameter_command,parameter_string);
+ free(parameter_string);
+ on_subwindow_close(window->Window);
+
+}
+
+source_window *yon_source_window_new(){
+ source_window *window = new(source_window);
+ GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_source);
+
+ window->Window = yon_gtk_builder_get_widget(builder,"MainWindow");
+ window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox");
+ window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
+ window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton");
+ window->AutoSwitch = yon_gtk_builder_get_widget(builder,"AutoSwitch");
+ window->TypeCombo = yon_gtk_builder_get_widget(builder,"TypeCombo");
+ window->PathEntry = yon_gtk_builder_get_widget(builder,"PathEntry");
+ window->PathButton = yon_gtk_builder_get_widget(builder,"PathButton");
+ window->AddButton = yon_gtk_builder_get_widget(builder,"AddButton");
+ window->AddBox = yon_gtk_builder_get_widget(builder,"AddBox");
+ window->sources = g_hash_table_new(g_str_hash,g_str_equal);
+
+ g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
+ g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_source_accept),window);
+ g_signal_connect(G_OBJECT(window->AddButton),"clicked",G_CALLBACK(on_source_add),window);
+ g_signal_connect(G_OBJECT(window->PathButton),"clicked",G_CALLBACK(on_source_choose),window);
+ g_signal_connect(G_OBJECT(window->AutoSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),window->AddBox);
+ g_signal_connect(G_OBJECT(window->AutoSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),window->AddButton);
+ g_signal_connect(G_OBJECT(window->AutoSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),window->PathButton);
+ g_signal_connect(G_OBJECT(window->AutoSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),window->PathEntry);
+ g_object_set_data(G_OBJECT(window->PathButton),"combo",window->TypeCombo);
+ g_object_set_data(G_OBJECT(window->PathButton),"target",window->PathEntry);
+ return window;
+}
+
+void on_source_clicked(GtkWidget *,main_window *widgets){
+ source_window *window = yon_source_window_new();
+ g_object_set_data(G_OBJECT(window->Window),"widgets",widgets);
+ gtk_widget_show(window->Window);
+}
+
double yon_size_long_convert_automatic(unsigned long bytes, char *size){
int repeats;
double byte_float=bytes;
@@ -628,6 +765,7 @@ main_window *yon_main_window_complete(){
// g_signal_connect(G_OBJECT(widgets->AdvancedPartitionAddBox),"add",G_CALLBACK(on_advanced_parts_added),widgets);
// g_signal_connect(G_OBJECT(widgets->AdvancedPartitionAddBox),"remove",G_CALLBACK(on_advanced_parts_removed),widgets);
g_signal_connect(G_OBJECT(widgets->StartScenarioButton),"clicked",G_CALLBACK(yon_quick_install),widgets);
+ g_signal_connect(G_OBJECT(widgets->SourceButton),"clicked",G_CALLBACK(on_source_clicked),widgets);
{
diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h
index cb3b6f0..dd1ad1c 100755
--- a/source/ubinstall-gtk.h
+++ b/source/ubinstall-gtk.h
@@ -35,6 +35,8 @@
#define glade_path_bootloader_user "/com/ublinux/ui/ubinstall-gtk-bootloader-user.glade"
#define glade_path_advanced_part "/com/ublinux/ui/ubinstall-gtk-advanced-box.glade"
#define glade_path_configuration_mode "/com/ublinux/ui/ubinstall-gtk-configuration-mode.glade"
+#define glade_path_source "/com/ublinux/ui/ubinstall-gtk-source.glade"
+#define glade_path_source_element "/com/ublinux/ui/ubinstall-gtk-source-element.glade"
#define CssPath "/com/ublinux/css/ubinstall-gtk.css"
#define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL)
@@ -220,6 +222,8 @@ layout && /description:/ {\
#define NETWORK_parameter_command(target) yon_char_unite("ubconfig get autoinstall AUTOINSTALL['ubconfig set [network] NETWORK[",target,"@connmod]']",NULL)
#define NETWORK_devdown_parameter_command(target) yon_char_unite("ubconfig get autoinstall AUTOINSTALL['ubconfig set [network] NETWORK[",target,"@devdown]']",NULL)
#define NETWORK(target) yon_char_unite("NETWORK[",target,"@connmod]",NULL)
+#define source_parameter "AUTOINSTALL[source]"
+#define source_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[source]"
#define save_config_command(parameters) yon_char_unite("ubconfig --target system set [autoinstall] AUTOINSTALL[log]=yes ",parameters, "; nice ubinstall2 --debug autoinstall", NULL)
@@ -880,6 +884,29 @@ typedef struct {
GtkWidget *ChooseButton;
} configuration_window;
+typedef struct {
+ GtkWidget *Window;
+ GtkWidget *StatusBox;
+ GtkWidget *CancelButton;
+ GtkWidget *AcceptButton;
+ GtkWidget *AutoSwitch;
+ GtkWidget *TypeCombo;
+ GtkWidget *PathEntry;
+ GtkWidget *PathButton;
+ GtkWidget *AddButton;
+ GtkWidget *AddBox;
+ GHashTable *sources;
+} source_window;
+
+typedef struct {
+ GtkWidget *MainBox;
+ GtkWidget *TypeCombo;
+ GtkWidget *PathEntry;
+ GtkWidget *PathButton;
+ GtkWidget *RemoveButton;
+
+} source_element;
+
void config_init();
main_window *yon_main_window_complete();
ubinstall_language_window *yon_ubinstall_language_new();
@@ -1068,4 +1095,13 @@ void configuration_mode_accept(GtkWidget *,configuration_window *window);
void on_path_choose(GtkWidget *,configuration_window *window);
void on_configuration_exit(GtkWidget *,configuration_window *window);
int yon_config_save(main_window *widgets);
-void yon_config_restore(main_window *widgets);
\ No newline at end of file
+void yon_config_restore(main_window *widgets);
+void on_source_clicked(GtkWidget *,main_window *widgets);
+source_window *yon_source_window_new();
+void on_source_accept(GtkWidget *,source_window *window);
+void on_source_choose(GtkWidget *self);
+void on_source_remove(GtkWidget *,source_element *element);
+void on_source_add(GtkWidget *,source_window *window);
+void yon_source_update(source_window *window);
+void yon_source_element_add(char *key,void*,source_window *window);
+source_element *yon_source_element_new();
\ No newline at end of file
diff --git a/ubinstall-gtk-source-element.glade b/ubinstall-gtk-source-element.glade
new file mode 100644
index 0000000..8f1447b
--- /dev/null
+++ b/ubinstall-gtk-source-element.glade
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+ True
+ False
+ com.ublinux.libublsettingsui-gtk3.zoom-symbolic
+
+
+ True
+ False
+ com.ublinux.libublsettingsui-gtk3.trash-symbolic
+
+
diff --git a/ubinstall-gtk-source.glade b/ubinstall-gtk-source.glade
index 4d82003..fe32aa9 100644
--- a/ubinstall-gtk-source.glade
+++ b/ubinstall-gtk-source.glade
@@ -1,12 +1,24 @@
-
+
+
+
+ True
+ False
+ com.ublinux.libublsettingsui-gtk3.zoom-symbolic
+
+
+ True
+ False
+ com.ublinux.libublsettingsui-gtk3.increase-symbolic
+
400
250
False
True
+ com.ublinux.ubinstall-gtk
True
@@ -77,7 +89,7 @@
False
5
-
+
True
True
@@ -107,72 +119,114 @@
-
+
True
- False
- 5
+ True
-
+
True
False
-
- - Device
- - Folder
- - ISO-image
-
+
+
+ True
+ False
+ vertical
+ 5
+
+
+ True
+ False
+ 5
+
+
+ True
+ False
+ 0
+
+ - Device
+ - Folder
+ - ISO-image
+
+
+
+ False
+ True
+ 0
+
+
+
+
+ True
+ True
+
+
+ True
+ True
+ 1
+
+
+
+
+ True
+ True
+ True
+ image1
+
+
+
+ False
+ True
+ 2
+
+
+
+
+ True
+ True
+ True
+ image2
+
+
+
+ False
+ True
+ 3
+
+
+
+
+ False
+ True
+ 0
+
+
+
+
+ True
+ False
+ vertical
+ 5
+
+
+
+
+
+ False
+ True
+ 1
+
+
+
+
-
- False
- True
- 0
-
-
-
-
- True
- True
-
-
- True
- True
- 1
-
-
-
-
- True
- True
- True
- image1
-
-
-
- False
- True
- 2
-
-
-
-
- True
- True
- True
- image2
-
-
-
- False
- True
- 3
-
- False
+ True
True
2
@@ -186,7 +240,7 @@
- False
+ True
True
2
@@ -217,7 +271,7 @@
-
+
Choose
True
True
@@ -231,14 +285,4 @@
-
- True
- False
- com.ublinux.libublsettingsui-gtk3.zoom-symbolic
-
-
- True
- False
- com.ublinux.libublsettingsui-gtk3.increase-symbolic
-