|
|
|
|
@ -139,10 +139,10 @@ int yon_install_same_partition_save(main_window *widgets){
|
|
|
|
|
|
|
|
|
|
int yon_advanced_sections_save(dictionary *dict){
|
|
|
|
|
if (!dict) return 0;
|
|
|
|
|
advanced_section *first_section = yon_dictionary_get_data(dict->first,advanced_section*);
|
|
|
|
|
advanced_section *last_section = NULL;
|
|
|
|
|
advanced_partition *first_section = yon_dictionary_get_data(dict->first,advanced_partition*);
|
|
|
|
|
advanced_partition *last_section = NULL;
|
|
|
|
|
if (dict->first->next){
|
|
|
|
|
last_section = yon_dictionary_get_data(dict->first->next,advanced_section*);
|
|
|
|
|
last_section = yon_dictionary_get_data(dict->first->next,advanced_partition*);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *part_first = first_section->part;
|
|
|
|
|
@ -302,7 +302,7 @@ void on_device_selection_changed(GtkWidget *self, main_window *widgets){
|
|
|
|
|
long free_space_long = 0;
|
|
|
|
|
char *fs_type = NULL;
|
|
|
|
|
char *label = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (parsed_size>2){
|
|
|
|
|
char sizemod='\0';
|
|
|
|
|
capacity_long = atol(parsed[2]);
|
|
|
|
|
@ -359,7 +359,7 @@ void yon_devices_setup(main_window *widgets){
|
|
|
|
|
json_object_object_get_ex(device, "serial", &serial);
|
|
|
|
|
|
|
|
|
|
gtk_list_store_append(widgets->DevicesList,&iter);
|
|
|
|
|
gtk_list_store_set(widgets->DevicesList,&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->DevicesList,&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),6,1,-1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
@ -541,14 +541,187 @@ void yon_install_init(main_window *widgets, enum YON_PAGES page){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_advanced_password_clicked(GtkWidget *, advanced_partition *part){
|
|
|
|
|
yon_password_open(GTK_ENTRY(part->EncryptionEntry));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
advanced_partition *yon_advanced_partition_new(){
|
|
|
|
|
advanced_partition *part = new(advanced_partition);
|
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_advanced_part);
|
|
|
|
|
part->MainBox = yon_gtk_builder_get_widget(builder,"MainBox");
|
|
|
|
|
part->SectionLabel = yon_gtk_builder_get_widget(builder,"SectionLabel");
|
|
|
|
|
part->SystemSectionToggle = yon_gtk_builder_get_widget(builder,"SystemSectionToggle");
|
|
|
|
|
part->UserDataSectionToggle = yon_gtk_builder_get_widget(builder,"UserDataSectionToggle");
|
|
|
|
|
part->RemoveButton = yon_gtk_builder_get_widget(builder,"RemoveButton");
|
|
|
|
|
part->FormatSwitch = yon_gtk_builder_get_widget(builder,"FormatSwitch");
|
|
|
|
|
part->SizeSpin = yon_gtk_builder_get_widget(builder,"SizeSpin");
|
|
|
|
|
part->SizeCombo = yon_gtk_builder_get_widget(builder,"SizeCombo");
|
|
|
|
|
part->SectionMarkEntry = yon_gtk_builder_get_widget(builder,"SectionMarkEntry");
|
|
|
|
|
part->FileSystemTypeCombo = yon_gtk_builder_get_widget(builder,"FileSystemTypeCombo");
|
|
|
|
|
part->FileSystemMarkentry = yon_gtk_builder_get_widget(builder,"FileSystemMarkentry");
|
|
|
|
|
part->EncryptionCombo = yon_gtk_builder_get_widget(builder,"EncryptionCombo");
|
|
|
|
|
part->EncryptionEntry = yon_gtk_builder_get_widget(builder,"EncryptionEntry");
|
|
|
|
|
part->EncryptionButton = yon_gtk_builder_get_widget(builder,"EncryptionButton");
|
|
|
|
|
part->FormatRevealer = yon_gtk_builder_get_widget(builder,"FormatRevealer");
|
|
|
|
|
|
|
|
|
|
yon_gtk_revealer_set_from_switch(GTK_REVEALER(part->FormatRevealer),GTK_SWITCH(part->FormatSwitch));
|
|
|
|
|
g_signal_connect(G_OBJECT(part->EncryptionButton),"clicked",G_CALLBACK(on_advanced_password_clicked),part);
|
|
|
|
|
// g_signal_connect(G_OBJECT(part->SystemSectionToggle),"clicked",G_CALLBACK(on_advanced_system_toggled),part);
|
|
|
|
|
// g_signal_connect(G_OBJECT(part->UserDataSectionToggle),"clicked",G_CALLBACK(on_advanced_user_toggled),part);
|
|
|
|
|
|
|
|
|
|
g_object_set_data(G_OBJECT(part->MainBox),"advanced_partition",part);
|
|
|
|
|
g_object_set_data(G_OBJECT(part->RemoveButton),"advanced_partition",part);
|
|
|
|
|
|
|
|
|
|
return part;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_install_advanced_add_new(GtkWidget *, main_window *){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_install_advanced_device_chosen(GtkCellRenderer, gchar *, main_window *){
|
|
|
|
|
void on_install_advanced_device_chosen(GtkCellRenderer *, gchar *path, main_window *widgets){
|
|
|
|
|
gtk_list_store_clear(widgets->PartitionsList);
|
|
|
|
|
|
|
|
|
|
int size;
|
|
|
|
|
config_str partitions;
|
|
|
|
|
partitions = yon_config_load(yon_debug_output("%s\n",get_parts_and_devices_command),&size);
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
yon_char_remove_last_symbol(partitions[i],'\n');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widgets->DevicesList);
|
|
|
|
|
|
|
|
|
|
int chosen = 0;
|
|
|
|
|
for_iter (model,&iter){
|
|
|
|
|
char *disk_path;
|
|
|
|
|
int status;
|
|
|
|
|
gtk_tree_model_get(model,&iter,0,&disk_path,5,&status,-1);
|
|
|
|
|
if (status) chosen++;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (gtk_tree_model_get_iter_from_string(model,&iter,path)){
|
|
|
|
|
int status;
|
|
|
|
|
gtk_tree_model_get(model,&iter,5,&status,-1);
|
|
|
|
|
if (!status){
|
|
|
|
|
if (chosen <2){
|
|
|
|
|
gtk_list_store_set(widgets->DevicesList,&iter,5,!status,-1);
|
|
|
|
|
chosen++;
|
|
|
|
|
} else {
|
|
|
|
|
for_iter (model,&iter){
|
|
|
|
|
gtk_tree_model_get(model,&iter,5,&status,-1);
|
|
|
|
|
if (!status){
|
|
|
|
|
gtk_list_store_set(widgets->DevicesList,&iter,6,0,-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
gtk_list_store_set(widgets->DevicesList,&iter,5,!status,-1);
|
|
|
|
|
if (chosen == 2){
|
|
|
|
|
for_iter (model,&iter){
|
|
|
|
|
gtk_list_store_set(widgets->DevicesList,&iter,6,1,-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
chosen--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (chosen) gtk_widget_set_sensitive(widgets->AdvancedAddButton,1);
|
|
|
|
|
else gtk_widget_set_sensitive(widgets->AdvancedAddButton,0);
|
|
|
|
|
|
|
|
|
|
for_iter (model,&iter){
|
|
|
|
|
char *disk_path;
|
|
|
|
|
int status;
|
|
|
|
|
gtk_tree_model_get(model,&iter,0,&disk_path,5,&status,-1);
|
|
|
|
|
if (!status) continue;
|
|
|
|
|
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
int parsed_size;
|
|
|
|
|
config_str parsed = yon_char_parse(partitions[i],&parsed_size,";");
|
|
|
|
|
if (!strcmp(parsed[0],"part")){
|
|
|
|
|
char *name = parsed[1];
|
|
|
|
|
if (strstr(name,disk_path)){
|
|
|
|
|
char *capacity = NULL;
|
|
|
|
|
long capacity_long = 0;
|
|
|
|
|
char *free_space = NULL;
|
|
|
|
|
long free_space_long = 0;
|
|
|
|
|
char *fs_type = NULL;
|
|
|
|
|
char *label = NULL;
|
|
|
|
|
|
|
|
|
|
if (parsed_size>2){
|
|
|
|
|
char sizemod='\0';
|
|
|
|
|
capacity_long = atol(parsed[2]);
|
|
|
|
|
|
|
|
|
|
char *temp = yon_char_from_double(yon_size_long_convert_automatic(capacity_long,&sizemod));
|
|
|
|
|
capacity = yon_char_append_c(temp,sizemod);
|
|
|
|
|
free(temp);
|
|
|
|
|
}
|
|
|
|
|
if (parsed_size>7&&!yon_char_is_empty(parsed[7])){
|
|
|
|
|
char sizemod='\0';
|
|
|
|
|
free_space_long = capacity_long-atol(parsed[7]);
|
|
|
|
|
char *temp = yon_char_from_double(yon_size_long_convert_automatic(free_space_long,&sizemod));
|
|
|
|
|
free_space = yon_char_append_c(temp,sizemod);
|
|
|
|
|
free(temp);
|
|
|
|
|
}
|
|
|
|
|
if (parsed_size>3){
|
|
|
|
|
fs_type = parsed[3];
|
|
|
|
|
}
|
|
|
|
|
if (parsed_size>4){
|
|
|
|
|
label = parsed[4];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GtkTreeIter itar;
|
|
|
|
|
gtk_list_store_append(widgets->PartitionsList,&itar);
|
|
|
|
|
gtk_list_store_set(widgets->PartitionsList,&itar,0,name,1,capacity,2,free_space,3,fs_type,4,label,5,capacity_long,6,free_space_long,8,1,-1);
|
|
|
|
|
}
|
|
|
|
|
yon_char_parsed_free(parsed,parsed_size);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_install_advanced_partition_chosen(GtkCellRenderer, gchar *, main_window *){
|
|
|
|
|
void on_install_advanced_partition_chosen(GtkCellRenderer*, gchar *path, main_window *widgets){
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widgets->PartitionsList);
|
|
|
|
|
|
|
|
|
|
int chosen = 0;
|
|
|
|
|
|
|
|
|
|
for_iter(model,&iter){
|
|
|
|
|
int status;
|
|
|
|
|
gtk_tree_model_get(model,&iter,7,&status,-1);
|
|
|
|
|
if (status) chosen++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gtk_tree_model_get_iter_from_string(model,&iter,path);
|
|
|
|
|
int status;
|
|
|
|
|
gtk_tree_model_get(model,&iter,7,&status,-1);
|
|
|
|
|
|
|
|
|
|
if (!status){
|
|
|
|
|
if (chosen<2){
|
|
|
|
|
gtk_list_store_set(widgets->PartitionsList,&iter,7,!status,-1);
|
|
|
|
|
chosen++;
|
|
|
|
|
advanced_partition *part = yon_advanced_partition_new();
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(widgets->AdvancedPartitionAddBox),part->MainBox,0,0,0);
|
|
|
|
|
gtk_widget_show(part->MainBox);
|
|
|
|
|
}
|
|
|
|
|
if (chosen>=2){
|
|
|
|
|
for_iter(model,&iter){
|
|
|
|
|
gtk_tree_model_get(model,&iter,7,&status,-1);
|
|
|
|
|
if (!status){
|
|
|
|
|
gtk_list_store_set(widgets->PartitionsList,&iter,8,0,-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
gtk_list_store_set(widgets->PartitionsList,&iter,7,!status,-1);
|
|
|
|
|
if (chosen==2)
|
|
|
|
|
for_iter (model,&iter){
|
|
|
|
|
gtk_list_store_set(widgets->PartitionsList,&iter,8,1,-1);
|
|
|
|
|
}
|
|
|
|
|
chosen--;
|
|
|
|
|
}
|
|
|
|
|
}
|