|
|
|
|
@ -168,6 +168,7 @@ void config_init(){
|
|
|
|
|
main_config.config_save_thread=NULL;
|
|
|
|
|
main_config.install_thread=NULL;
|
|
|
|
|
main_config.progress_thread=NULL;
|
|
|
|
|
main_config.install_complete=0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int yon_image_resize_from_container(GtkImage *target, GdkPixbuf *pixbuf_unscaled);
|
|
|
|
|
@ -264,6 +265,7 @@ void *yon_installation_start(main_window *widgets);
|
|
|
|
|
void *yon_installation_start(main_window *widgets){
|
|
|
|
|
int code = system(start_fast_install_command);
|
|
|
|
|
main_config.install_thread=NULL;
|
|
|
|
|
main_config.install_complete=1;
|
|
|
|
|
if (!code)
|
|
|
|
|
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETION);
|
|
|
|
|
g_thread_exit(NULL);
|
|
|
|
|
@ -320,11 +322,12 @@ void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){
|
|
|
|
|
} break;
|
|
|
|
|
case YON_PAGE_INSTALLATION:{
|
|
|
|
|
gtk_widget_set_sensitive(widgets->BackButton,0);
|
|
|
|
|
g_thread_join(main_config.config_save_thread);
|
|
|
|
|
if (!main_config.install_thread)
|
|
|
|
|
main_config.install_thread = g_thread_new("InstallThread",(GThreadFunc)yon_installation_start,widgets);
|
|
|
|
|
if (!main_config.install_thread)
|
|
|
|
|
main_config.progress_thread = g_thread_new("ProgressThread",(GThreadFunc)yon_installation_progress_update,widgets);
|
|
|
|
|
if (main_config.config_save_thread)
|
|
|
|
|
g_thread_join(main_config.config_save_thread);
|
|
|
|
|
if (!main_config.install_thread&&!main_config.install_complete)
|
|
|
|
|
main_config.install_thread = g_thread_new("InstallThread",(GThreadFunc)yon_installation_start,widgets);
|
|
|
|
|
if (!main_config.progress_thread)
|
|
|
|
|
main_config.progress_thread = g_thread_new("ProgressThread",(GThreadFunc)yon_installation_progress_update,widgets);
|
|
|
|
|
|
|
|
|
|
if (!main_config.slider_thread)
|
|
|
|
|
main_config.slider_thread = g_timeout_add(5000,(GSourceFunc)on_image_slide,widgets);
|
|
|
|
|
@ -435,21 +438,29 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
char *layouts_list="";
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->DefaultLayoutRadio))){
|
|
|
|
|
GtkTreeModel *layouts_model=NULL;
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->ManualLayoutRadio))){
|
|
|
|
|
GtkTreeModel *layouts_model=GTK_TREE_MODEL(widgets->LayoutList);
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
char *cur_layout=NULL;
|
|
|
|
|
for_iter(layouts_model,&iter){
|
|
|
|
|
gtk_tree_model_get(layouts_model,&iter,0,&cur_layout,-1);
|
|
|
|
|
layouts_list = yon_char_unite(layouts_list,",",cur_layout,NULL);
|
|
|
|
|
int chosen=0;
|
|
|
|
|
gtk_tree_model_get(layouts_model,&iter,0,&cur_layout,3,&chosen,-1);
|
|
|
|
|
if (chosen)
|
|
|
|
|
layouts_list = yon_char_unite(layouts_list,yon_char_is_empty(layouts_list)?"":",",cur_layout,NULL);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
yon_config_remove_by_key(xkblayout_parameter);
|
|
|
|
|
}
|
|
|
|
|
char *model = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->KeyboardModelCombo))?(char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->KeyboardModelCombo)):"";
|
|
|
|
|
// char *layout_switch;
|
|
|
|
|
yon_config_register(xkbmodel_parameter,xkbmodel_parameter_command,model);
|
|
|
|
|
yon_config_register(locale_parameter,locale_parameter_command,layouts_list);
|
|
|
|
|
if (!yon_char_is_empty(model))
|
|
|
|
|
yon_config_register(xkbmodel_parameter,xkbmodel_parameter_command,model);
|
|
|
|
|
else
|
|
|
|
|
yon_config_remove_by_key(xkbmodel_parameter);
|
|
|
|
|
if (!yon_char_is_empty(layouts_list))
|
|
|
|
|
yon_config_register(locale_parameter,locale_parameter_command,layouts_list);
|
|
|
|
|
else
|
|
|
|
|
yon_config_remove_by_key(locale_parameter);
|
|
|
|
|
|
|
|
|
|
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),page+1);
|
|
|
|
|
} break;
|
|
|
|
|
@ -502,7 +513,7 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
|
char *device_name = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->NextInstallationSectionNameEntry));
|
|
|
|
|
char *part;
|
|
|
|
|
gtk_tree_model_get(model,&iter,0,&part,-1);
|
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"near");
|
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"next");
|
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_DEVICE_command,device);
|
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOSTART_PARTS_command,part);
|
|
|
|
|
yon_config_register(device_label_parameter,device_label_parameter_command,device_name);
|
|
|
|
|
@ -539,7 +550,7 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
|
char *device_name = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->SameInstallationSectionNameEntry));
|
|
|
|
|
char *part;
|
|
|
|
|
gtk_tree_model_get(model,&iter,0,&part,-1);
|
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"near");
|
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"part");
|
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_DEVICE_command,device);
|
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOSTART_PARTS_command,part);
|
|
|
|
|
yon_config_register(device_label_parameter,device_label_parameter_command,device_name);
|
|
|
|
|
@ -658,6 +669,53 @@ void on_additional_software_toggled(){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_set_max_size_from_partition(GtkTreeView *table, GtkSpinButton *spin_size, GtkComboBox *size_type);
|
|
|
|
|
void yon_set_max_size_from_partition(GtkTreeView *table, GtkSpinButton *spin_size, GtkComboBox *size_type){
|
|
|
|
|
GtkTreeModel *model;
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
char *selected_size=NULL;
|
|
|
|
|
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(table),&model,&iter)){
|
|
|
|
|
gtk_tree_model_get(model,&iter,1,&selected_size,-1);
|
|
|
|
|
if (!yon_char_is_empty(selected_size)){
|
|
|
|
|
int size = gtk_combo_box_get_active(size_type);
|
|
|
|
|
double cur_size = atof(selected_size);
|
|
|
|
|
char cur_size_letter = selected_size[strlen(selected_size)-1];
|
|
|
|
|
int cur_size_type=0;
|
|
|
|
|
switch (cur_size_letter){
|
|
|
|
|
case 'M':
|
|
|
|
|
cur_size_type=0;
|
|
|
|
|
break;
|
|
|
|
|
case 'G':
|
|
|
|
|
cur_size_type=1;
|
|
|
|
|
break;
|
|
|
|
|
case 'T':
|
|
|
|
|
cur_size_type=2;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (size-cur_size_type>0){
|
|
|
|
|
for (int i=0;i<size-cur_size_type;i++){
|
|
|
|
|
cur_size/=1024;
|
|
|
|
|
}
|
|
|
|
|
} else if (size-cur_size_type<0){
|
|
|
|
|
for (int i=0;i<cur_size_type-size;i++){
|
|
|
|
|
cur_size*=1024;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(spin_size),cur_size);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_partition_changed(GtkWidget *self, main_window *widgets);
|
|
|
|
|
void on_partition_changed(GtkWidget *self, main_window *widgets){
|
|
|
|
|
if (self==widgets->InstallationNearSysSectionTree)
|
|
|
|
|
yon_set_max_size_from_partition(GTK_TREE_VIEW(widgets->InstallationNearSysSectionTree),GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin),GTK_COMBO_BOX(widgets->InstallationNearSizeTypeSpin));
|
|
|
|
|
else if (self == widgets->SamePlacePartTree){
|
|
|
|
|
yon_set_max_size_from_partition(GTK_TREE_VIEW(widgets->SamePlacePartTree),GTK_SPIN_BUTTON(widgets->SamePlaceSizeSpin),GTK_COMBO_BOX(widgets->SamePlaceSizeTypeSpin));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_near_installation_device_changed(GtkWidget *self, main_window *widgets);
|
|
|
|
|
void on_near_installation_device_changed(GtkWidget *self, main_window *widgets){
|
|
|
|
|
gtk_list_store_clear(widgets->PartitionsList);
|
|
|
|
|
@ -676,7 +734,7 @@ void on_near_installation_device_changed(GtkWidget *self, main_window *widgets){
|
|
|
|
|
json_object_object_get_ex(root, "blockdevices", &blockdevices);
|
|
|
|
|
for (long unsigned int i = 0; i < json_object_array_length(blockdevices); i++) {
|
|
|
|
|
struct json_object *device = json_object_array_get_idx(blockdevices, i);
|
|
|
|
|
struct json_object *type, *path, *size, *model, *vendor, *serial;
|
|
|
|
|
struct json_object *type, *path, *size, *model, *fstype, *fsused;
|
|
|
|
|
|
|
|
|
|
json_object_object_get_ex(device, "type", &type);
|
|
|
|
|
if (strcmp("part",json_object_get_string(type)))
|
|
|
|
|
@ -687,11 +745,20 @@ void on_near_installation_device_changed(GtkWidget *self, main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
json_object_object_get_ex(device, "size", &size);
|
|
|
|
|
json_object_object_get_ex(device, "model", &model);
|
|
|
|
|
json_object_object_get_ex(device, "vendor", &vendor);
|
|
|
|
|
json_object_object_get_ex(device, "serial", &serial);
|
|
|
|
|
|
|
|
|
|
json_object_object_get_ex(device, "fstype", &fstype);
|
|
|
|
|
json_object_object_get_ex(device, "fsused", &fsused);
|
|
|
|
|
|
|
|
|
|
float free_space=0;
|
|
|
|
|
char *free_space_string="";
|
|
|
|
|
if (size&&fsused){
|
|
|
|
|
free_space = atof(json_object_get_string(size))-atof(json_object_get_string(fsused));
|
|
|
|
|
free_space_string = yon_char_append(yon_char_from_float(free_space)," ");
|
|
|
|
|
free_space_string[strlen(free_space_string)-1]=json_object_get_string(size)[strlen(json_object_get_string(size))-1];
|
|
|
|
|
}
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin),0.0);
|
|
|
|
|
gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->InstallationNearSizeSpin)),0.0);
|
|
|
|
|
gtk_list_store_append(widgets->PartitionsList,&iter);
|
|
|
|
|
gtk_list_store_set(widgets->PartitionsList,&iter,0,json_object_get_string(path),1,json_object_get_string(model),2,json_object_get_string(serial),3,json_object_get_string(size),4,json_object_get_string(vendor),-1);
|
|
|
|
|
gtk_list_store_set(widgets->PartitionsList,&iter,0,json_object_get_string(path),1,json_object_get_string(size),2,free_space_string,3,json_object_get_string(fstype),-1);
|
|
|
|
|
}
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
}
|
|
|
|
|
@ -729,9 +796,11 @@ void on_same_installation_device_changed(GtkWidget *, main_window *widgets){
|
|
|
|
|
json_object_object_get_ex(device, "vendor", &vendor);
|
|
|
|
|
json_object_object_get_ex(device, "serial", &serial);
|
|
|
|
|
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->SamePlaceSizeSpin),0.0);
|
|
|
|
|
gtk_adjustment_set_upper(gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->SamePlaceSizeSpin)),0.0);
|
|
|
|
|
gtk_list_store_append(widgets->PartitionsList,&iter);
|
|
|
|
|
gtk_list_store_set(widgets->PartitionsList,&iter,0,json_object_get_string(path),1,json_object_get_string(model),2,json_object_get_string(serial),3,json_object_get_string(size),4,json_object_get_string(vendor),-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -857,6 +926,9 @@ main_window *yon_main_window_complete(){
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->InstallationToggle),"toggled",G_CALLBACK(on_toggle_block),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->InstallationNearSysDevicesTree),"cursor-changed",G_CALLBACK(on_near_installation_device_changed),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SamePlaceDeviceTree),"cursor-changed",G_CALLBACK(on_near_installation_device_changed),widgets);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SamePlacePartTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->InstallationNearSysSectionTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets);
|
|
|
|
|
gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),3);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LanguageCombo),"changed",G_CALLBACK(on_locale_changed),widgets);
|
|
|
|
|
|