|
|
|
@ -1,5 +1,8 @@
|
|
|
|
#include "ubinstall-gtk.h"
|
|
|
|
#include "ubinstall-gtk.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define toggled_icon_name "com.ublinux.libublsettingsui-gtk3.toggled-symbolic"
|
|
|
|
|
|
|
|
#define untoggled_icon_name "com.ublinux.libublsettingsui-gtk3.untoggled-symbolic"
|
|
|
|
|
|
|
|
|
|
|
|
advanced_section *yon_advanced_section_new();
|
|
|
|
advanced_section *yon_advanced_section_new();
|
|
|
|
void yon_advanced_section_remove();
|
|
|
|
void yon_advanced_section_remove();
|
|
|
|
|
|
|
|
|
|
|
|
@ -84,6 +87,18 @@ void yon_advanced_update(main_window *widgets){
|
|
|
|
for (int i=0;i<sections_size;i++){
|
|
|
|
for (int i=0;i<sections_size;i++){
|
|
|
|
advanced_partition *part = yon_advanced_partition_new();
|
|
|
|
advanced_partition *part = yon_advanced_partition_new();
|
|
|
|
g_signal_connect(G_OBJECT(part->RemoveButton),"clicked",G_CALLBACK(on_advanced_part_remove),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);
|
|
|
|
|
|
|
|
if (i==0){
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive(part->SystemSectionToggle,0);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive(part->UserDataSectionToggle,0);
|
|
|
|
|
|
|
|
GtkWidget *SystemImage = gtk_button_get_image(GTK_BUTTON(part->SystemSectionToggle));
|
|
|
|
|
|
|
|
GtkWidget *UserImage = gtk_button_get_image(GTK_BUTTON(part->UserDataSectionToggle));
|
|
|
|
|
|
|
|
gtk_image_set_from_icon_name(GTK_IMAGE(SystemImage),toggled_icon_name,GTK_ICON_SIZE_BUTTON);
|
|
|
|
|
|
|
|
gtk_image_set_from_icon_name(GTK_IMAGE(UserImage),toggled_icon_name,GTK_ICON_SIZE_BUTTON);
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(part->SystemSectionToggle),1);
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(part->UserDataSectionToggle),1);
|
|
|
|
|
|
|
|
}
|
|
|
|
yon_advanced_partition_set_from_section(part,sections[i]);
|
|
|
|
yon_advanced_partition_set_from_section(part,sections[i]);
|
|
|
|
gtk_box_pack_start(GTK_BOX(widgets->AdvancedPartitionAddBox),part->MainBox,0,0,0);
|
|
|
|
gtk_box_pack_start(GTK_BOX(widgets->AdvancedPartitionAddBox),part->MainBox,0,0,0);
|
|
|
|
|
|
|
|
|
|
|
|
@ -98,19 +113,39 @@ void yon_advanced_update(main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_advanced_partition_create(GtkWidget *, main_window *widgets){
|
|
|
|
void on_advanced_partition_create(GtkWidget *, main_window *widgets){
|
|
|
|
GtkTreeIter iter, *last_found;
|
|
|
|
GtkTreeIter iter, *last_unvalid = NULL;
|
|
|
|
|
|
|
|
int found = 0;
|
|
|
|
for_iter(GTK_TREE_MODEL(widgets->DevicesList),&iter){
|
|
|
|
for_iter(GTK_TREE_MODEL(widgets->DevicesList),&iter){
|
|
|
|
char *target;
|
|
|
|
char *target;
|
|
|
|
int active;
|
|
|
|
int active;
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->DevicesList),&iter,0,&target,5,&active,-1);
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->DevicesList),&iter,0,&target,5,&active,-1);
|
|
|
|
if (active){
|
|
|
|
if (active){
|
|
|
|
|
|
|
|
if (!yon_advanced_section_get(target)){
|
|
|
|
|
|
|
|
last_unvalid = gtk_tree_iter_copy(&iter);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
found=1;
|
|
|
|
if (sections_size==2) break;
|
|
|
|
if (sections_size==2) break;
|
|
|
|
advanced_section *section = yon_advanced_section_new();
|
|
|
|
advanced_section *section = yon_advanced_section_new();
|
|
|
|
|
|
|
|
section->part_source = PART_SOURCE_DEVICE;
|
|
|
|
section->partition = target;
|
|
|
|
section->partition = target;
|
|
|
|
sections[sections_size]=section;
|
|
|
|
sections[sections_size]=section;
|
|
|
|
sections_size++;
|
|
|
|
sections_size++;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!found&&last_unvalid){
|
|
|
|
|
|
|
|
char *target;
|
|
|
|
|
|
|
|
int active;
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(widgets->DevicesList),last_unvalid,0,&target,5,&active,-1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sections_size==2) return;
|
|
|
|
|
|
|
|
advanced_section *section = yon_advanced_section_new();
|
|
|
|
|
|
|
|
section->part_source = PART_SOURCE_DEVICE;
|
|
|
|
|
|
|
|
section->partition = target;
|
|
|
|
|
|
|
|
sections[sections_size]=section;
|
|
|
|
|
|
|
|
sections_size++;
|
|
|
|
|
|
|
|
}
|
|
|
|
yon_advanced_update(widgets);
|
|
|
|
yon_advanced_update(widgets);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -124,6 +159,7 @@ void on_advanced_partition_add(GtkWidget *, char *path, main_window *widgets){
|
|
|
|
if (!status){
|
|
|
|
if (!status){
|
|
|
|
if (sections_size==2) return;
|
|
|
|
if (sections_size==2) return;
|
|
|
|
advanced_section *section = yon_advanced_section_new();
|
|
|
|
advanced_section *section = yon_advanced_section_new();
|
|
|
|
|
|
|
|
section->part_source = PART_SOURCE_PART;
|
|
|
|
sections[sections_size]=section;
|
|
|
|
sections[sections_size]=section;
|
|
|
|
sections_size++;
|
|
|
|
sections_size++;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -135,6 +171,7 @@ void on_advanced_partition_add(GtkWidget *, char *path, main_window *widgets){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void yon_install_advanced_init(main_window *){
|
|
|
|
void yon_install_advanced_init(main_window *){
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void on_install_advanced_partition_chosen(GtkCellRenderer*, gchar *path, main_window *widgets){
|
|
|
|
void on_install_advanced_partition_chosen(GtkCellRenderer*, gchar *path, main_window *widgets){
|
|
|
|
@ -153,8 +190,8 @@ void on_install_advanced_partition_chosen(GtkCellRenderer*, gchar *path, main_wi
|
|
|
|
if (chosen<2){
|
|
|
|
if (chosen<2){
|
|
|
|
gtk_list_store_set(widgets->PartitionsList,&iter,7,!status,-1);
|
|
|
|
gtk_list_store_set(widgets->PartitionsList,&iter,7,!status,-1);
|
|
|
|
chosen++;
|
|
|
|
chosen++;
|
|
|
|
|
|
|
|
|
|
|
|
advanced_section *section = yon_advanced_section_new();
|
|
|
|
advanced_section *section = yon_advanced_section_new();
|
|
|
|
|
|
|
|
section->part_source = PART_SOURCE_PART;
|
|
|
|
section->partition = target_part;
|
|
|
|
section->partition = target_part;
|
|
|
|
sections[sections_size]=section;
|
|
|
|
sections[sections_size]=section;
|
|
|
|
sections_size++;
|
|
|
|
sections_size++;
|
|
|
|
@ -279,6 +316,28 @@ int yon_advanced_get_part_size(main_window *widgets){
|
|
|
|
return size;
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_advanced_section_toggled(GtkWidget *self, main_window *widgets){
|
|
|
|
|
|
|
|
advanced_partition *part = g_object_get_data(G_OBJECT(self),"advanced_partition");
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive(self,0);
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(self),1);
|
|
|
|
|
|
|
|
GtkWidget *image = gtk_button_get_image(GTK_BUTTON(self));
|
|
|
|
|
|
|
|
gtk_image_set_from_icon_name(GTK_IMAGE(image),toggled_icon_name,GTK_ICON_SIZE_BUTTON);
|
|
|
|
|
|
|
|
GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->AdvancedPartitionAddBox));
|
|
|
|
|
|
|
|
GList *iter;
|
|
|
|
|
|
|
|
for (iter=list;iter;iter=iter->next){
|
|
|
|
|
|
|
|
advanced_partition *compare_part = g_object_get_data(G_OBJECT(iter->data),"advanced_partition");
|
|
|
|
|
|
|
|
if (part != compare_part) {
|
|
|
|
|
|
|
|
GtkWidget *cur_toggle = self == part->SystemSectionToggle?compare_part->SystemSectionToggle:compare_part->UserDataSectionToggle;
|
|
|
|
|
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(cur_toggle),G_CALLBACK(on_advanced_section_toggled),widgets);
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive(cur_toggle,1);
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cur_toggle),0);
|
|
|
|
|
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(cur_toggle),G_CALLBACK(on_advanced_section_toggled),widgets);
|
|
|
|
|
|
|
|
GtkWidget *compare_image = gtk_button_get_image(GTK_BUTTON(cur_toggle));
|
|
|
|
|
|
|
|
gtk_image_set_from_icon_name(GTK_IMAGE(compare_image),untoggled_icon_name,GTK_ICON_SIZE_BUTTON);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
advanced_partition *yon_advanced_partition_new(){
|
|
|
|
advanced_partition *yon_advanced_partition_new(){
|
|
|
|
advanced_partition *part = new(advanced_partition);
|
|
|
|
advanced_partition *part = new(advanced_partition);
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_advanced_part);
|
|
|
|
GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_advanced_part);
|
|
|
|
@ -302,11 +361,13 @@ advanced_partition *yon_advanced_partition_new(){
|
|
|
|
|
|
|
|
|
|
|
|
yon_gtk_revealer_set_from_switch(GTK_REVEALER(part->FormatRevealer),GTK_SWITCH(part->FormatSwitch));
|
|
|
|
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->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);
|
|
|
|
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->MainBox),"advanced_partition",part);
|
|
|
|
g_object_set_data(G_OBJECT(part->RemoveButton),"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);
|
|
|
|
|
|
|
|
|
|
|
|
return part;
|
|
|
|
return part;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|