Merge pull request 'Languages loading rework' (#102) from YanTheKaller/ubinstall-gtk:master into master
Reviewed-on: #102master
commit
9187d7de0e
|
@ -1,515 +0,0 @@
|
||||
#: ./locales.csv:1
|
||||
msgid "Afrikaans, South Africa"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:2
|
||||
msgid "Arabic, United Arab Emirates"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:3
|
||||
msgid "Arabic, Bahrain"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:4
|
||||
msgid "Arabic, Algeria"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:5
|
||||
msgid "Arabic, Egypt"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:6
|
||||
msgid "Arabic, Iraq"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:7
|
||||
msgid "Arabic, Jordan"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:8
|
||||
msgid "Arabic, Kuwait"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:9
|
||||
msgid "Arabic, Libya"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:10
|
||||
msgid "Arabic, Morocco"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:11
|
||||
msgid "Arabic, Oman"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:12
|
||||
msgid "Arabic, Qatar"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:13
|
||||
msgid "Arabic, Saudi Arabia"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:14
|
||||
msgid "Arabic, Tunisia"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:15
|
||||
msgid "Arabic, Yemen"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:16
|
||||
msgid "Assamese, India"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:17
|
||||
msgid "Azerbaijani, Azerbaijan"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:18
|
||||
msgid "Belarusian, Belarus"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:19
|
||||
msgid "Bulgarian, Bulgaria"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:20
|
||||
msgid "Bengali, India"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:21
|
||||
msgid "Bosnian, Bosnia and Herzegovina"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:22
|
||||
msgid "Catalan, Spain"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:23
|
||||
msgid "Czech, Czech Republic"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:24
|
||||
msgid "Danish, Denmark"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:25
|
||||
msgid "German, Austria"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:26
|
||||
msgid "German, Belgium"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:27
|
||||
msgid "German, Switzerland"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:28
|
||||
msgid "German, Germany"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:29
|
||||
msgid "German, Liechtenstein"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:30
|
||||
msgid "German, Luxembourg"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:31
|
||||
msgid "Greek, Cyprus"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:32
|
||||
msgid "Greek, Greece"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:33
|
||||
msgid "English, Australia"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:34
|
||||
msgid "English, Botswana"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:35
|
||||
msgid "English, Canada"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:36
|
||||
msgid "English, United Kingdom"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:37
|
||||
msgid "English, Hong Kong SAR China"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:38
|
||||
msgid "English, Ireland"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:39
|
||||
msgid "English, India"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:40
|
||||
msgid "English, Malta"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:41
|
||||
msgid "English, New Zealand"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:42
|
||||
msgid "English, Philippines"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:43
|
||||
msgid "English, Singapore"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:44
|
||||
msgid "English, U.S.A."
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:45
|
||||
msgid "English, Zimbabwe"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:46
|
||||
msgid "Spanish, Argentina"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:47
|
||||
msgid "Spanish, Bolivia"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:48
|
||||
msgid "Spanish, Chile"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:49
|
||||
msgid "Spanish, Colombia"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:50
|
||||
msgid "Spanish, Costa Rica"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:51
|
||||
msgid "Spanish, Dominican Republic"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:52
|
||||
msgid "Spanish, Ecuador"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:53
|
||||
msgid "Spanish, Spain"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:54
|
||||
msgid "Spanish, Guatemala"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:55
|
||||
msgid "Spanish, Honduras"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:56
|
||||
msgid "Spanish, Mexico"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:57
|
||||
msgid "Spanish, Nicaragua"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:58
|
||||
msgid "Spanish, Panama"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:59
|
||||
msgid "Spanish, Peru"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:60
|
||||
msgid "Spanish, Puerto Rico"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:61
|
||||
msgid "Spanish, Paraguay"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:62
|
||||
msgid "Spanish, El Salvador"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:63
|
||||
msgid "Spanish, U.S.A."
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:64
|
||||
msgid "Spanish, Uruguay"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:65
|
||||
msgid "Spanish, Venezuela"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:66
|
||||
msgid "Estonian, Estonia"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:67
|
||||
msgid "Finnish, Finland"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:68
|
||||
msgid "French, Belgium"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:69
|
||||
msgid "French, Canada"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:70
|
||||
msgid "French, Switzerland"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:71
|
||||
msgid "French, France"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:72
|
||||
msgid "French, Luxembourg"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:73
|
||||
msgid "Gujarati, India"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:74
|
||||
msgid "Hebrew, Israel"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:75
|
||||
msgid "Hindi, India"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:76
|
||||
msgid "Croatian, Croatia"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:77
|
||||
msgid "Hungarian, Hungary"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:78
|
||||
msgid "Armenian, Armenia"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:79
|
||||
msgid "Indonesian, Indonesia"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:80
|
||||
msgid "Icelandic, Iceland"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:81
|
||||
msgid "Italian, Switzerla"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:82
|
||||
msgid "Italian, Italy"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:83
|
||||
msgid "Japanese, Japan"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:84
|
||||
msgid "Georgian, Georgia"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:85
|
||||
msgid "Kazakh, Kazakhstan"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:86
|
||||
msgid "Kannada, India"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:87
|
||||
msgid "Korean, Korea"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:88
|
||||
msgid "Kashmiri, India"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:89
|
||||
msgid "Kurdish, Turkey"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:90
|
||||
msgid "Kurdish (Sorani), Turkey"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:91
|
||||
msgid "Kirghiz, Kyrgyzstan"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:92
|
||||
msgid "Lithuanian, Lithuania"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:93
|
||||
msgid "Latvian, Latvia"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:94
|
||||
msgid "Macedonian, Macedonia"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:95
|
||||
msgid "Malayalam, India"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:96
|
||||
msgid "Marathi, India"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:97
|
||||
msgid "Malay, Malaysia"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:98
|
||||
msgid "Maltese, Malta"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:99
|
||||
msgid "Bokmal, Norway"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:100
|
||||
msgid "Dutch, Belgium"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:101
|
||||
msgid "Dutch, Netherlands"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:102
|
||||
msgid "Nynorsk, Norway"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:103
|
||||
msgid "Oriya, India"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:104
|
||||
msgid "Punjabi, India"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:105
|
||||
msgid "Polish, Poland"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:106
|
||||
msgid "Portuguese, Brazil"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:107
|
||||
msgid "Portuguese, Portugal"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:108
|
||||
msgid "Romanian, Romania"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:109
|
||||
msgid "Russian, Russia"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:110
|
||||
msgid "Russian, Ukraine"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:111
|
||||
msgid "Sanskrit, India"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:112
|
||||
msgid "Slovak, Slovakia"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:113
|
||||
msgid "Slovenian, Slovenia"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:114
|
||||
msgid "Albanian, Albania"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:115
|
||||
msgid "Serbian, Montenegro"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:116
|
||||
msgid "Serbian, Montenegro (Latin)"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:117
|
||||
msgid "Serbian, Serbia"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:118
|
||||
msgid "Serbian, Serbia (Latin)"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:119
|
||||
msgid "Swedish, Sweden"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:120
|
||||
msgid "Tamil, India"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:121
|
||||
msgid "Telugu, India"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:122
|
||||
msgid "Thai, Thailand"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:123
|
||||
msgid "Turkish, Turkey"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:124
|
||||
msgid "Ukrainian, Ukraine"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:125
|
||||
msgid "Vietnamese, Vietnam"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:126
|
||||
msgid "Simplified Chinese, China"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:127
|
||||
msgid "Traditional Chinese, Hong Kong SAR China"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:128
|
||||
msgid "Chinese, Singapore"
|
||||
msgstr ""
|
||||
|
||||
#: ./locales.csv:129
|
||||
msgid "Traditional Chinese, Taiwan"
|
||||
msgstr ""
|
||||
|
@ -0,0 +1,634 @@
|
||||
#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();
|
||||
void yon_advanced_section_remove();
|
||||
|
||||
int sections_size=0;
|
||||
advanced_section *sections[2] = {NULL};
|
||||
|
||||
advanced_section *yon_advanced_section_new(){
|
||||
if (sections_size>=2) return NULL;
|
||||
advanced_section *section = malloc(sizeof(advanced_section));
|
||||
memset(section,0,sizeof(advanced_section));
|
||||
return section;
|
||||
}
|
||||
|
||||
void yon_advanced_section_remove_all(){
|
||||
if (sections[0]){
|
||||
free(sections[0]);
|
||||
sections[0]=NULL;
|
||||
}
|
||||
if (sections[1]){
|
||||
free(sections[1]);
|
||||
sections[1]=NULL;
|
||||
}
|
||||
sections_size=0;
|
||||
}
|
||||
|
||||
void yon_advanced_section_remove(char *part){
|
||||
int pos = yon_advanced_section_get(part);
|
||||
switch(pos){
|
||||
case 0:
|
||||
if (sections[0]){
|
||||
free(sections[0]);
|
||||
if (sections[1]){
|
||||
sections[0]=sections[1];
|
||||
sections[1]=NULL;
|
||||
} else {
|
||||
sections[0]=NULL;
|
||||
}
|
||||
sections_size--;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (sections[1]){
|
||||
free(sections[1]);
|
||||
sections[1]=NULL;
|
||||
sections_size--;
|
||||
}
|
||||
break;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
||||
int yon_advanced_section_get(char *partition){
|
||||
if (yon_char_is_empty(partition)) return -1;
|
||||
if (sections_size>0&&!strcmp(sections[0]->partition,partition)){
|
||||
return 0;
|
||||
} else if (sections_size>1&&!strcmp(sections[1]->partition,partition)){
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void yon_advanced_partition_set_from_section(advanced_partition *part, advanced_section *section){
|
||||
if (part&§ion){
|
||||
gtk_label_set_text(GTK_LABEL(part->SectionLabel),section->partition);
|
||||
part->part = yon_char_new(section->partition);
|
||||
if (section->format){
|
||||
gtk_switch_set_active(GTK_SWITCH(part->FormatSwitch),1);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(part->SizeSpin),section->size);
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(part->SizeCombo),yon_get_size_get_from_letter(section->size_letter));
|
||||
gtk_entry_set_text(GTK_ENTRY(part->PartLabelEntry),section->part_label);
|
||||
gtk_entry_set_text(GTK_ENTRY(part->FileSystemLabelEntry),section->fs_label);
|
||||
gtk_combo_box_set_active_id(GTK_COMBO_BOX(part->FileSystemTypeCombo),section->fs_type);
|
||||
gtk_combo_box_set_active_id(GTK_COMBO_BOX(part->EncryptionCombo),section->encryption);
|
||||
gtk_entry_set_text(GTK_ENTRY(part->EncryptionEntry),section->encryption_password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void yon_advanced_update(main_window *widgets){
|
||||
yon_advanced_partition_clear(widgets);
|
||||
|
||||
for (int i=0;i<sections_size;i++){
|
||||
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->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);
|
||||
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_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;
|
||||
}
|
||||
if (sections_size==2){
|
||||
gtk_widget_hide(widgets->AdvancedAddButton);
|
||||
} else {
|
||||
gtk_widget_show(widgets->AdvancedAddButton);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void on_advanced_partition_create(GtkWidget *, main_window *widgets){
|
||||
GtkTreeIter iter, *last_unvalid = NULL;
|
||||
int found = 0;
|
||||
for_iter(GTK_TREE_MODEL(widgets->DevicesList),&iter){
|
||||
char *target;
|
||||
int active;
|
||||
gtk_tree_model_get(GTK_TREE_MODEL(widgets->DevicesList),&iter,0,&target,5,&active,-1);
|
||||
if (active){
|
||||
if (!yon_advanced_section_get(target)){
|
||||
last_unvalid = gtk_tree_iter_copy(&iter);
|
||||
} else {
|
||||
found=1;
|
||||
if (sections_size==2) break;
|
||||
advanced_section *section = yon_advanced_section_new();
|
||||
section->part_source = PART_SOURCE_DEVICE;
|
||||
section->device = target;
|
||||
section->partition = target;
|
||||
sections[sections_size]=section;
|
||||
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->device = target;
|
||||
section->partition = target;
|
||||
sections[sections_size]=section;
|
||||
sections_size++;
|
||||
}
|
||||
yon_advanced_update(widgets);
|
||||
}
|
||||
|
||||
void on_advanced_partition_add(GtkWidget *, char *path, main_window *widgets){
|
||||
GtkTreeIter iter;
|
||||
if (gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(widgets->PartitionsList),&iter,path)){
|
||||
char *target, *device;
|
||||
int status;
|
||||
gtk_tree_model_get(GTK_TREE_MODEL(widgets->PartitionsList),&iter,0,&target,7,&status,9,&device,-1);
|
||||
gtk_list_store_set(widgets->DevicesList,&iter,7,!status,-1);
|
||||
if (!status){
|
||||
if (sections_size==2) return;
|
||||
advanced_section *section = yon_advanced_section_new();
|
||||
section->part_source = PART_SOURCE_PART;
|
||||
section->device = device;
|
||||
section->partition = target = device;
|
||||
sections[sections_size]=section;
|
||||
sections_size++;
|
||||
} else {
|
||||
yon_advanced_section_remove(target);
|
||||
}
|
||||
}
|
||||
yon_advanced_update(widgets);
|
||||
|
||||
}
|
||||
|
||||
void yon_install_advanced_init(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;
|
||||
chosen = yon_advanced_get_part_size(widgets);
|
||||
|
||||
gtk_tree_model_get_iter_from_string(model,&iter,path);
|
||||
int status;
|
||||
char *target_part, *device;
|
||||
gtk_tree_model_get(model,&iter,0,&target_part,7,&status,9,&device,-1);
|
||||
|
||||
if (!status){
|
||||
if (chosen<2){
|
||||
gtk_list_store_set(widgets->PartitionsList,&iter,7,!status,-1);
|
||||
chosen++;
|
||||
advanced_section *section = yon_advanced_section_new();
|
||||
section->part_source = PART_SOURCE_PART;
|
||||
section->partition = target_part;
|
||||
section->device = device;
|
||||
section->device = device;
|
||||
sections[sections_size]=section;
|
||||
sections_size++;
|
||||
}
|
||||
} else {
|
||||
gtk_list_store_set(widgets->PartitionsList,&iter,7,!status,-1);
|
||||
yon_advanced_section_remove(target_part);
|
||||
}
|
||||
yon_advanced_update(widgets);
|
||||
}
|
||||
|
||||
void yon_advanced_parts_update(main_window *widgets){
|
||||
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');
|
||||
}
|
||||
|
||||
GtkTreeModel *model = GTK_TREE_MODEL(widgets->DevicesList);
|
||||
GtkTreeIter iter;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
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();
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model = GTK_TREE_MODEL(widgets->DevicesList);
|
||||
// int chosen = 0;
|
||||
// chosen = yon_advanced_get_part_size(widgets);
|
||||
|
||||
if (gtk_tree_model_get_iter_from_string(model,&iter,path)){
|
||||
int status;
|
||||
char *target;
|
||||
gtk_tree_model_get(model,&iter,0,&target,5,&status,-1);
|
||||
if (!status){ // checks
|
||||
gtk_list_store_set(widgets->DevicesList,&iter,5,!status,-1);
|
||||
|
||||
} else { // unchecks
|
||||
gtk_list_store_set(widgets->DevicesList,&iter,5,!status,-1);
|
||||
for_iter (model,&iter){
|
||||
gtk_list_store_set(widgets->DevicesList,&iter,6,1,-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (chosen) gtk_widget_set_sensitive(widgets->AdvancedAddButton,1);
|
||||
// else gtk_widget_set_sensitive(widgets->AdvancedAddButton,0);
|
||||
yon_advanced_parts_update(widgets);
|
||||
yon_advanced_update(widgets);
|
||||
}
|
||||
|
||||
void on_advanced_password_clicked(GtkWidget *, advanced_partition *part){
|
||||
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){
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int yon_advanced_save(main_window *widgets){
|
||||
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"custom");
|
||||
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->device){
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (devices_size){
|
||||
char *devices_str = yon_char_parsed_to_string(devices,devices_size,",");
|
||||
yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,devices_str);
|
||||
}
|
||||
if (parts_size){
|
||||
char *parts_str = yon_char_parsed_to_string(parts,parts_size,",");
|
||||
yon_config_register(part_parameter,part_parameter_command,parts_str);
|
||||
|
||||
}
|
||||
if (part_size_size){
|
||||
char *part_size_str = yon_char_parsed_to_string(part_size,part_size_size,",");
|
||||
yon_config_register(part_size_parameter,part_size_parameter_command,part_size_str);
|
||||
|
||||
}
|
||||
if (part_label_size){
|
||||
char *part_label_str = yon_char_parsed_to_string(part_label,part_label_size,",");
|
||||
yon_config_register(part_label_parameter,part_label_parameter_command,part_label_str);
|
||||
|
||||
}
|
||||
if (fs_type_size){
|
||||
char *fs_type_str = yon_char_parsed_to_string(fs_type,fs_type_size,",");
|
||||
yon_config_register(part_fs_type_parameter,part_fs_type_parameter_command,fs_type_str);
|
||||
|
||||
}
|
||||
if (fs_label_size){
|
||||
char *fs_label_str = yon_char_parsed_to_string(fs_label,fs_label_size,",");
|
||||
yon_config_register(part_fs_label_parameter,part_fs_label_parameter_command,fs_label_str);
|
||||
|
||||
}
|
||||
if (encryption_size){
|
||||
char *encryption_str = yon_char_parsed_to_string(encryption,encryption_size,",");
|
||||
yon_config_register(part_crypt_parameter,part_crypt_parameter_command,encryption_str);
|
||||
|
||||
}
|
||||
if (format_size){
|
||||
char *format_str = yon_char_parsed_to_string(format,format_size,",");
|
||||
yon_config_register(part_format_parameter,part_format_parameter_command,format_str);
|
||||
|
||||
}
|
||||
if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedLoadTypeSwitch))){
|
||||
char *boot = NULL;
|
||||
if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedBiosSectorSwitch))){
|
||||
yon_char_append_element(boot,"bios","+");
|
||||
}
|
||||
if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedEFISwitch))){
|
||||
yon_char_append_element(boot,"efi","+");
|
||||
|
||||
}
|
||||
if (!yon_char_is_empty(boot)){
|
||||
yon_config_register(boot_parameter,boot_parameter_command,boot);
|
||||
} else {
|
||||
yon_config_remove_by_key(boot_parameter);
|
||||
}
|
||||
} else {
|
||||
yon_config_remove_by_key(boot_parameter);
|
||||
}
|
||||
if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapSwitch))){
|
||||
if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapAutoSwitch))){
|
||||
yon_config_register(swap_parameter,swap_parameter_command,"auto");
|
||||
|
||||
} else if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapRamSwitch))){
|
||||
yon_config_register(swap_parameter,swap_parameter_command,"yes");
|
||||
yon_config_register(swap_size_parameter,swap_parameter_command,"ram");
|
||||
|
||||
} else if (gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapFixedSwitch))){
|
||||
yon_config_register(swap_parameter,swap_parameter_command,"yes");
|
||||
long swap_size = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->AdvancedSwapFixedSpin));
|
||||
int size_letter = gtk_switch_get_active(GTK_SWITCH(widgets->AdvancedSwapFixedSizeSwitch));
|
||||
char *swap_str = yon_char_from_long(swap_size);
|
||||
char *size_final = yon_char_unite(swap_str,size_letter?"G":"M",NULL);
|
||||
yon_config_register(swap_size_parameter,swap_parameter_command,size_final);
|
||||
} else {
|
||||
yon_config_remove_by_key(swap_parameter);
|
||||
yon_config_remove_by_key(swap_size_parameter);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void yon_advanced_part_parameter_changed(GtkWidget *self, advanced_partition *part){
|
||||
advanced_section *section = sections[yon_advanced_section_get(part->part)];
|
||||
if (self == part->SizeCombo||self == part->SizeSpin){
|
||||
section->size = gtk_spin_button_get_value(GTK_SPIN_BUTTON(part->SizeSpin));
|
||||
section->size_letter = *yon_size_get_mod(gtk_combo_box_get_active(GTK_COMBO_BOX(part->SizeCombo)));
|
||||
} else if (self == part->PartLabelEntry){
|
||||
section->part_label = yon_char_new(gtk_entry_get_text(GTK_ENTRY(part->PartLabelEntry)));
|
||||
} else if (self == part->FileSystemTypeCombo){
|
||||
section->fs_type = yon_char_new(gtk_combo_box_get_active_id(GTK_COMBO_BOX(part->FileSystemTypeCombo)));
|
||||
} else if (self == part->FileSystemLabelEntry){
|
||||
section->fs_label = yon_char_new(gtk_entry_get_text(GTK_ENTRY(part->FileSystemLabelEntry)));
|
||||
} else if (self == part->EncryptionCombo||self == part->EncryptionEntry){
|
||||
section->encryption = yon_char_new(gtk_combo_box_get_active_id(GTK_COMBO_BOX(part->EncryptionCombo)));
|
||||
section->encryption_password = yon_char_new(gtk_entry_get_text(GTK_ENTRY(part->EncryptionEntry)));
|
||||
} else if (self == part->FormatSwitch){
|
||||
if (gtk_switch_get_active(GTK_SWITCH(part->FormatSwitch))){
|
||||
section->format=1;
|
||||
} else {
|
||||
section->format=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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->PartLabelEntry = yon_gtk_builder_get_widget(builder,"PartLabelEntry");
|
||||
part->FileSystemTypeCombo = yon_gtk_builder_get_widget(builder,"FileSystemTypeCombo");
|
||||
part->FileSystemLabelEntry = yon_gtk_builder_get_widget(builder,"FileSystemLabelEntry");
|
||||
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");
|
||||
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);
|
||||
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);
|
||||
g_signal_connect(G_OBJECT(part->EncryptionEntry),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part);
|
||||
g_signal_connect(G_OBJECT(part->FormatSwitch),"activate",G_CALLBACK(yon_advanced_part_parameter_changed),part);
|
||||
g_signal_connect(G_OBJECT(part->SizeCombo),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part);
|
||||
g_signal_connect(G_OBJECT(part->SizeSpin),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part);
|
||||
g_signal_connect(G_OBJECT(part->PartLabelEntry),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part);
|
||||
g_signal_connect(G_OBJECT(part->FileSystemTypeCombo),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part);
|
||||
g_signal_connect(G_OBJECT(part->FileSystemLabelEntry),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),part);
|
||||
g_signal_connect(G_OBJECT(part->EncryptionCombo),"changed",G_CALLBACK(yon_advanced_part_parameter_changed),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->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;
|
||||
}
|
||||
|
||||
void on_advanced_part_remove(GtkWidget *self, main_window *widgets){
|
||||
advanced_partition *part = g_object_get_data(G_OBJECT(self),"advanced_partition");
|
||||
|
||||
yon_advanced_section_remove(part->part);
|
||||
yon_advanced_update(widgets);
|
||||
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
#include "ubinstall-gtk.h"
|
||||
|
||||
typedef struct {
|
||||
char *section;
|
||||
int sys_section;
|
||||
int user_section;
|
||||
int format;
|
||||
int size;
|
||||
char size_letter;
|
||||
char *part_label;
|
||||
char *fs_type;
|
||||
char *fs_label;
|
||||
char *encryption;
|
||||
char *encryption_password;
|
||||
|
||||
} advanced_section;
|
||||
|
||||
int sections_size=0;
|
||||
advanced_section *sections[2] = {NULL};
|
||||
|
||||
advanced_section *yon_advanced_section_new(){
|
||||
if (sections_size>=2) return NULL;
|
||||
|
||||
advanced_section *section = malloc(sizeof(advanced_section));
|
||||
memset(section,0,sizeof(advanced_section));
|
||||
sections[sections_size] = section;
|
||||
sections_size++;
|
||||
return section;
|
||||
}
|
||||
|
||||
void yon_advanced_section_remove(int pos){
|
||||
switch(pos){
|
||||
case 0:
|
||||
free(sections[0]);
|
||||
if (sections[1]){
|
||||
sections[0]=sections[1];
|
||||
sections[1]=NULL;
|
||||
} else {
|
||||
sections[0]=NULL;
|
||||
}
|
||||
sections_size--;
|
||||
break;
|
||||
case 1:
|
||||
if (sections[1]){
|
||||
free(sections[1]);
|
||||
sections[1]=NULL;
|
||||
sections_size--;
|
||||
}
|
||||
break;
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// add section from tree view
|
||||
void yon_advanced_add(main_window *widgets){
|
||||
|
||||
}
|
||||
|
||||
//new section from button
|
||||
void yon_advanced_new(main_window *widgets){
|
||||
|
||||
}
|
||||
Loading…
Reference in new issue