|
|
|
|
@ -476,7 +476,7 @@ void yon_install_init(main_window *widgets, enum YON_PAGES page){
|
|
|
|
|
}
|
|
|
|
|
if (format_switch){
|
|
|
|
|
char *format = config(part_format_parameter);
|
|
|
|
|
if (!strcmp(format,"yes")){
|
|
|
|
|
if (!yon_char_is_empty(format)&&!strcmp(format,"yes")){
|
|
|
|
|
gtk_switch_set_active(GTK_SWITCH(format_switch),1);
|
|
|
|
|
if (device_label){
|
|
|
|
|
char *parameter = config(part_label_parameter);
|
|
|
|
|
@ -545,6 +545,47 @@ void on_advanced_password_clicked(GtkWidget *, advanced_partition *part){
|
|
|
|
|
yon_password_open(GTK_ENTRY(part->EncryptionEntry));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_advanced_partition_clear(main_window *widgets){
|
|
|
|
|
GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->AdvancedPartitionAddBox));
|
|
|
|
|
GList *iter;
|
|
|
|
|
for (iter=list;iter;iter=iter->next){
|
|
|
|
|
advanced_partition *part = g_object_get_data(G_OBJECT(iter->data),"advanced_partition");
|
|
|
|
|
gtk_widget_destroy(GTK_WIDGET(iter->data));
|
|
|
|
|
free(part);
|
|
|
|
|
}
|
|
|
|
|
on_advanced_parts_removed(NULL,NULL,widgets);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int yon_advanced_get_part_size(main_window *widgets){
|
|
|
|
|
int size = 0;
|
|
|
|
|
GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->AdvancedPartitionAddBox));
|
|
|
|
|
size = g_list_length(list);
|
|
|
|
|
g_list_free(list);
|
|
|
|
|
return size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_advanced_set_part_sensitivity(main_window *widgets, gboolean state){
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widgets->PartitionsList);
|
|
|
|
|
int status;
|
|
|
|
|
for_iter(model,&iter){
|
|
|
|
|
gtk_tree_model_get(model,&iter,8,&status,-1);
|
|
|
|
|
if (!status){
|
|
|
|
|
gtk_list_store_set(widgets->PartitionsList,&iter,8,state?state:0,-1);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_list_store_set(widgets->PartitionsList,&iter,8,1,-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_advanced_set_device_sensitivity(main_window *widgets, gboolean state){
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widgets->DevicesList);
|
|
|
|
|
for_iter(model,&iter){
|
|
|
|
|
gtk_list_store_set(widgets->DevicesList,&iter,6,state,-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
advanced_partition *yon_advanced_partition_new(){
|
|
|
|
|
advanced_partition *part = new(advanced_partition);
|
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_advanced_part);
|
|
|
|
|
@ -563,6 +604,8 @@ advanced_partition *yon_advanced_partition_new(){
|
|
|
|
|
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");
|
|
|
|
|
part->order_iter = NULL;
|
|
|
|
|
part->part = NULL;
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
@ -575,12 +618,67 @@ advanced_partition *yon_advanced_partition_new(){
|
|
|
|
|
return part;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_install_advanced_add_new(GtkWidget *, main_window *){
|
|
|
|
|
|
|
|
|
|
void on_advanced_part_remove(GtkWidget *self, main_window *widgets){
|
|
|
|
|
advanced_partition *part = g_object_get_data(G_OBJECT(self),"advanced_partition");
|
|
|
|
|
|
|
|
|
|
if (part->part_type == ADVANCED_PART_EXISTING){
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widgets->PartitionsList);
|
|
|
|
|
for_iter(model,&iter){
|
|
|
|
|
int status;
|
|
|
|
|
char *target;
|
|
|
|
|
gtk_tree_model_get(model,&iter,0,&target,7,&status,-1);
|
|
|
|
|
if (status&&!strcmp(target,part->part)){
|
|
|
|
|
gtk_list_store_set(GTK_LIST_STORE(model),&iter,7,0,-1);
|
|
|
|
|
yon_advanced_set_part_sensitivity(widgets,1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
g_object_set_data(G_OBJECT(widgets->AdvancedPartitionAddBox),part->part,NULL);
|
|
|
|
|
g_sequence_remove(part->order_iter);
|
|
|
|
|
gtk_widget_destroy(part->MainBox);
|
|
|
|
|
on_advanced_parts_removed(NULL,NULL,widgets);
|
|
|
|
|
free(part);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_advanced_parts_added(GtkWidget *,GtkWidget*,main_window *widgets){
|
|
|
|
|
if (yon_advanced_get_part_size(widgets)>=2){
|
|
|
|
|
yon_advanced_set_part_sensitivity(widgets,0);
|
|
|
|
|
gtk_widget_hide(widgets->AdvancedAddButton);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_advanced_parts_removed(GtkWidget *,GtkWidget*,main_window *widgets){
|
|
|
|
|
int size = yon_advanced_get_part_size(widgets);
|
|
|
|
|
if (size<2){
|
|
|
|
|
yon_advanced_set_part_sensitivity(widgets,1);
|
|
|
|
|
gtk_widget_show(widgets->AdvancedAddButton);
|
|
|
|
|
}
|
|
|
|
|
if (!size){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_advanced_partition_setup(advanced_partition *part,main_window *widgets){
|
|
|
|
|
g_signal_connect(G_OBJECT(part->RemoveButton),"clicked",G_CALLBACK(on_advanced_part_remove),widgets);
|
|
|
|
|
g_object_set_data(G_OBJECT(widgets->AdvancedPartitionAddBox),part->part,part);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_install_advanced_add_new(GtkWidget *, main_window *widgets){
|
|
|
|
|
advanced_partition *part = yon_advanced_partition_new();
|
|
|
|
|
part->part_type = ADVANCED_PART_NEW;
|
|
|
|
|
part->order_iter = g_sequence_append(widgets->advanced_partition_order,part);
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(widgets->AdvancedPartitionAddBox),part->MainBox,0,0,0);
|
|
|
|
|
gtk_widget_show(part->MainBox);
|
|
|
|
|
yon_advanced_partition_setup(part,widgets);
|
|
|
|
|
on_advanced_parts_added(NULL,NULL,widgets);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_install_advanced_device_chosen(GtkCellRenderer *, gchar *path, main_window *widgets){
|
|
|
|
|
gtk_list_store_clear(widgets->PartitionsList);
|
|
|
|
|
yon_advanced_partition_clear(widgets);
|
|
|
|
|
|
|
|
|
|
int size;
|
|
|
|
|
config_str partitions;
|
|
|
|
|
@ -593,14 +691,7 @@ void on_install_advanced_device_chosen(GtkCellRenderer *, gchar *path, main_wind
|
|
|
|
|
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++;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
chosen = yon_advanced_get_part_size(widgets);
|
|
|
|
|
|
|
|
|
|
if (gtk_tree_model_get_iter_from_string(model,&iter,path)){
|
|
|
|
|
int status;
|
|
|
|
|
@ -689,39 +780,31 @@ void on_install_advanced_partition_chosen(GtkCellRenderer*, gchar *path, main_wi
|
|
|
|
|
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++;
|
|
|
|
|
}
|
|
|
|
|
chosen = yon_advanced_get_part_size(widgets);
|
|
|
|
|
|
|
|
|
|
gtk_tree_model_get_iter_from_string(model,&iter,path);
|
|
|
|
|
int status;
|
|
|
|
|
gtk_tree_model_get(model,&iter,7,&status,-1);
|
|
|
|
|
char *target_part;
|
|
|
|
|
gtk_tree_model_get(model,&iter,0,&target_part,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();
|
|
|
|
|
part->part_type = ADVANCED_PART_EXISTING;
|
|
|
|
|
part->order_iter = g_sequence_append(widgets->advanced_partition_order,part);
|
|
|
|
|
part->part = target_part;
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
yon_advanced_partition_setup(part,widgets);
|
|
|
|
|
on_advanced_parts_added(NULL,NULL,widgets);
|
|
|
|
|
}
|
|
|
|
|
} 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);
|
|
|
|
|
advanced_partition *part = g_object_get_data(G_OBJECT(widgets->AdvancedPartitionAddBox),target_part);
|
|
|
|
|
if (part){
|
|
|
|
|
on_advanced_part_remove(part->RemoveButton,widgets);
|
|
|
|
|
}
|
|
|
|
|
chosen--;
|
|
|
|
|
}
|
|
|
|
|
}
|