|
|
|
|
@ -89,6 +89,7 @@ void yon_advanced_update(main_window *widgets){
|
|
|
|
|
g_signal_connect(G_OBJECT(part->RemoveButton),"clicked",G_CALLBACK(on_advanced_part_remove),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(part->SystemSectionToggle),"clicked",G_CALLBACK(on_advanced_section_toggled),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(part->UserDataSectionToggle),"clicked",G_CALLBACK(on_advanced_section_toggled),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(part->SizeCombo),"changed",G_CALLBACK(on_advanced_size_changed),widgets);
|
|
|
|
|
if (i==0){
|
|
|
|
|
gtk_widget_set_sensitive(part->SystemSectionToggle,0);
|
|
|
|
|
gtk_widget_set_sensitive(part->UserDataSectionToggle,0);
|
|
|
|
|
@ -100,6 +101,7 @@ void yon_advanced_update(main_window *widgets){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(part->UserDataSectionToggle),1);
|
|
|
|
|
}
|
|
|
|
|
yon_advanced_partition_set_from_section(part,sections[i]);
|
|
|
|
|
yon_advanced_set_max_size_from_partition(part,widgets);
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(widgets->AdvancedPartitionAddBox),part->MainBox,0,0,0);
|
|
|
|
|
|
|
|
|
|
part->part_type = ADVANCED_PART_EXISTING;
|
|
|
|
|
@ -265,6 +267,39 @@ void yon_advanced_parts_update(main_window *widgets){
|
|
|
|
|
yon_char_parsed_free(partitions,size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_advanced_set_max_size_from_partition(advanced_partition *part, main_window *widgets){
|
|
|
|
|
char *cur_name = part->part;
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widgets->PartitionsList);
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
long selected_size;
|
|
|
|
|
|
|
|
|
|
for_iter(model,&iter){
|
|
|
|
|
char *target;
|
|
|
|
|
gtk_tree_model_get(model,&iter,0,&target,-1);
|
|
|
|
|
if (!strcmp(target,cur_name)){
|
|
|
|
|
gtk_tree_model_get(model,&iter,6,&selected_size,-1);
|
|
|
|
|
if (!selected_size){
|
|
|
|
|
gtk_tree_model_get(model,&iter,5,&selected_size,-1);
|
|
|
|
|
}
|
|
|
|
|
if (selected_size){
|
|
|
|
|
GtkAdjustment *adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(part->SizeSpin));
|
|
|
|
|
const char *sizemod = gtk_combo_box_get_active_id(GTK_COMBO_BOX(part->SizeCombo));
|
|
|
|
|
double new_size = yon_size_long_convert_to_mod(selected_size,sizemod[0]);
|
|
|
|
|
gtk_adjustment_set_upper(adj,new_size);
|
|
|
|
|
gdouble old_value = gtk_adjustment_get_value(adj);
|
|
|
|
|
if (old_value>new_size){
|
|
|
|
|
gtk_adjustment_set_value(adj,new_size);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_advanced_size_changed(GtkWidget *self,main_window *widgets){
|
|
|
|
|
advanced_partition *part = g_object_get_data(G_OBJECT(self),"advanced_partition");
|
|
|
|
|
yon_advanced_set_max_size_from_partition(part,widgets);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_install_advanced_device_chosen(GtkCellRenderer *, gchar *path, main_window *widgets){
|
|
|
|
|
gtk_list_store_clear(widgets->PartitionsList);
|
|
|
|
|
yon_advanced_section_remove_all();
|
|
|
|
|
@ -295,7 +330,10 @@ void on_install_advanced_device_chosen(GtkCellRenderer *, gchar *path, main_wind
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_advanced_password_clicked(GtkWidget *, advanced_partition *part){
|
|
|
|
|
yon_password_open(GTK_ENTRY(part->EncryptionEntry));
|
|
|
|
|
yon_password_window *window = yon_password_open(GTK_ENTRY(part->EncryptionEntry));
|
|
|
|
|
gtk_widget_hide(gtk_widget_get_parent(window->EncryptionCombo));
|
|
|
|
|
gtk_widget_hide(window->HashBox);
|
|
|
|
|
gtk_widget_hide(window->NoEncriptionCheck);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_advanced_partition_clear(main_window *widgets){
|
|
|
|
|
@ -338,6 +376,96 @@ void on_advanced_section_toggled(GtkWidget *self, main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int yon_advanced_save(main_window *){
|
|
|
|
|
int devices_size;
|
|
|
|
|
config_str devices = NULL;
|
|
|
|
|
int parts_size;
|
|
|
|
|
config_str parts = NULL;
|
|
|
|
|
int part_size_size;
|
|
|
|
|
config_str part_size = NULL;
|
|
|
|
|
int part_label_size;
|
|
|
|
|
config_str part_label = NULL;
|
|
|
|
|
int fs_type_size;
|
|
|
|
|
config_str fs_type = NULL;
|
|
|
|
|
int fs_label_size;
|
|
|
|
|
config_str fs_label = NULL;
|
|
|
|
|
int encryption_size;
|
|
|
|
|
config_str encryption = NULL;
|
|
|
|
|
int format_size;
|
|
|
|
|
config_str format = NULL;
|
|
|
|
|
if (!sections_size){
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
advanced_section *cur_section = sections[0]->sys_section?sections[0]:sections[1];
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(devices,&devices_size,cur_section->device);
|
|
|
|
|
if (cur_section->user_section){
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(devices,&devices_size,cur_section->device);
|
|
|
|
|
}
|
|
|
|
|
if (!yon_char_is_empty(cur_section->partition)){
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(parts,&parts_size,cur_section->partition);
|
|
|
|
|
} else {
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(parts,&parts_size,"");
|
|
|
|
|
}
|
|
|
|
|
if (cur_section->size){
|
|
|
|
|
char *size_str = yon_char_from_long(cur_section->size);
|
|
|
|
|
char *sz_str = yon_char_append_c(size_str,cur_section->size_letter);
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(part_size,&part_size_size,sz_str);
|
|
|
|
|
}
|
|
|
|
|
if (!yon_char_is_empty(cur_section->part_label)){
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(part_label,&part_label_size,cur_section->part_label);
|
|
|
|
|
}
|
|
|
|
|
if (!yon_char_is_empty(cur_section->fs_type)){
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(fs_type,&fs_type_size,cur_section->fs_type);
|
|
|
|
|
}
|
|
|
|
|
if (!yon_char_is_empty(cur_section->fs_label)){
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(fs_label,&fs_label_size,cur_section->fs_label);
|
|
|
|
|
}
|
|
|
|
|
if (cur_section->format){
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(format,&format_size,"yes");
|
|
|
|
|
} else {
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(format,&format_size,"no");
|
|
|
|
|
}
|
|
|
|
|
if (!yon_char_is_empty(cur_section->encryption)){
|
|
|
|
|
char *encrypt_str = yon_char_unite(cur_section->encryption,":",cur_section->encryption_password,NULL);
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(encryption,&encryption_size,encrypt_str);
|
|
|
|
|
}
|
|
|
|
|
if (sections_size>1){
|
|
|
|
|
cur_section = sections[0]->sys_section?sections[1]:sections[0];
|
|
|
|
|
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(devices,&devices_size,cur_section->device);
|
|
|
|
|
if (!yon_char_is_empty(cur_section->partition)){
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(parts,&parts_size,cur_section->partition);
|
|
|
|
|
} else {
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(parts,&parts_size,"");
|
|
|
|
|
}
|
|
|
|
|
if (cur_section->size){
|
|
|
|
|
char *size_str = yon_char_from_long(cur_section->size);
|
|
|
|
|
char *sz_str = yon_char_append_c(size_str,cur_section->size_letter);
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(part_size,&part_size_size,sz_str);
|
|
|
|
|
}
|
|
|
|
|
if (!yon_char_is_empty(cur_section->part_label)){
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(part_label,&part_label_size,cur_section->part_label);
|
|
|
|
|
}
|
|
|
|
|
if (!yon_char_is_empty(cur_section->fs_type)){
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(fs_type,&fs_type_size,cur_section->fs_type);
|
|
|
|
|
}
|
|
|
|
|
if (!yon_char_is_empty(cur_section->fs_label)){
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(fs_label,&fs_label_size,cur_section->fs_label);
|
|
|
|
|
}
|
|
|
|
|
if (cur_section->format){
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(format,&format_size,"yes");
|
|
|
|
|
} else {
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(format,&format_size,"no");
|
|
|
|
|
}
|
|
|
|
|
if (!yon_char_is_empty(cur_section->encryption)){
|
|
|
|
|
char *encrypt_str = yon_char_unite(cur_section->encryption,":",cur_section->encryption_password,NULL);
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(encryption,&encryption_size,encrypt_str);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
advanced_partition *yon_advanced_partition_new(){
|
|
|
|
|
advanced_partition *part = new(advanced_partition);
|
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_advanced_part);
|
|
|
|
|
@ -361,14 +489,23 @@ advanced_partition *yon_advanced_partition_new(){
|
|
|
|
|
|
|
|
|
|
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->EncryptionCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box),part->EncryptionButton);
|
|
|
|
|
g_signal_connect(G_OBJECT(part->EncryptionCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box),part->EncryptionEntry);
|
|
|
|
|
|
|
|
|
|
yon_fs_type_setup(GTK_COMBO_BOX_TEXT(part->FileSystemTypeCombo));
|
|
|
|
|
|
|
|
|
|
g_object_set_data(G_OBJECT(part->MainBox),"advanced_partition",part);
|
|
|
|
|
g_object_set_data(G_OBJECT(part->SizeCombo),"advanced_partition",part);
|
|
|
|
|
g_object_set_data(G_OBJECT(part->RemoveButton),"advanced_partition",part);
|
|
|
|
|
g_object_set_data(G_OBJECT(part->SystemSectionToggle),"advanced_partition",part);
|
|
|
|
|
g_object_set_data(G_OBJECT(part->UserDataSectionToggle),"advanced_partition",part);
|
|
|
|
|
|
|
|
|
|
int size;
|
|
|
|
|
config_str encryptions = yon_char_parsed_new(&size,encryptions_list,NULL);
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(part->EncryptionCombo),encryptions[i],encryptions[i]);
|
|
|
|
|
}
|
|
|
|
|
yon_char_parsed_free(encryptions,size);
|
|
|
|
|
return part;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|