Merge pull request 'Fixed separate installation page' (#19) from YanTheKaller/ubinstall-gtk:master into master

Reviewed-on: #19
master v1.7
Dmitry Razumov 1 year ago
commit 02fe449fca

@ -13,6 +13,7 @@ void _yon_saving_threaded(char *final_command){
file_return = yon_char_parsed_append(file_return,&file_save,final_command); file_return = yon_char_parsed_append(file_return,&file_save,final_command);
char *result = yon_char_parsed_to_string(file_return,file_save,""); char *result = yon_char_parsed_to_string(file_return,file_save,"");
yon_debug_output("%s\n",result); yon_debug_output("%s\n",result);
yon_char_parsed_free(file_return,file_save);
free(result); free(result);
} }
@ -27,7 +28,6 @@ char *yon_save_command_prepare(char *command, char *target){
char * cur = yon_config_get_by_key(parsed[i]); char * cur = yon_config_get_by_key(parsed[i]);
char *full_value = yon_char_unite(parsed[i],"='",cur,"'",NULL); char *full_value = yon_char_unite(parsed[i],"='",cur,"'",NULL);
free(parsed[i]); free(parsed[i]);
free(cur);
parsed[i]=full_value; parsed[i]=full_value;
} }
char *final = yon_char_parsed_to_string(parsed,size," "); char *final = yon_char_parsed_to_string(parsed,size," ");
@ -55,7 +55,7 @@ void yon_load_proceed(YON_CONFIG_TYPE type){
GtkWidget *dialog = gtk_file_chooser_dialog_new(TITLE_LABEL,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL); GtkWidget *dialog = gtk_file_chooser_dialog_new(TITLE_LABEL,NULL,GTK_FILE_CHOOSER_ACTION_SAVE,CANCEL_LABEL,GTK_RESPONSE_CANCEL,OPEN_LABEL,GTK_RESPONSE_ACCEPT,NULL);
yon_gtk_window_setup(GTK_WINDOW(dialog),NULL,TITLE_LABEL,icon_path,"FileChooserWindow"); yon_gtk_window_setup(GTK_WINDOW(dialog),NULL,TITLE_LABEL,icon_path,"FileChooserWindow");
textdomain(LocaleName); textdomain(LocaleName);
gtk_window_set_icon_name(GTK_WINDOW(dialog),"com.ublinux.ubl-settings-video"); gtk_window_set_icon_name(GTK_WINDOW(dialog),"com.ublinux.ubinstall");
gtk_window_set_title(GTK_WINDOW(dialog),TITLE_LABEL); gtk_window_set_title(GTK_WINDOW(dialog),TITLE_LABEL);
GtkFileFilter *filter = gtk_file_filter_new(); GtkFileFilter *filter = gtk_file_filter_new();
gtk_file_filter_add_pattern(filter,"*.ini"); gtk_file_filter_add_pattern(filter,"*.ini");
@ -74,6 +74,7 @@ void yon_load_proceed(YON_CONFIG_TYPE type){
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
} }
yon_config_load_config(type,yon_config_get_custom_command(path),NULL); yon_config_load_config(type,yon_config_get_custom_command(path),NULL);
if (path) free(path);
} }
} }
@ -354,6 +355,26 @@ void yon_interface_update(main_window *widgets){
gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),""); gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),"");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),1);
} }
if (fs_type) free(fs_type);
if (device_label) free(device_label);
if (format) free(format);
if (part_size) free(part_size);
if (user_name) free(user_name);
if (user_gecos) free(user_gecos);
if (user_password) free(user_password);
if (root_password) free(root_password);
if (autologin) free(autologin);
if (hostname) free(hostname);
if (kbmodel) free(kbmodel);
if (optinos) free(optinos);
if (layout) free(layout);
if (language) free(language);
if (zone) free(zone);
if (system_locale) free(system_locale);
if (region) free(region);
if (device) free(device);
if (part) free(part);
} }
void on_config_local_load(GtkWidget *,main_window *widgets); void on_config_local_load(GtkWidget *,main_window *widgets);
@ -431,6 +452,7 @@ void on_config_custom_save(GtkWidget *, main_window *widgets){
return; return;
} }
yon_save_proceed(path,YON_CONFIG_CUSTOM); yon_save_proceed(path,YON_CONFIG_CUSTOM);
if (path) free(path);
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED);
} }
@ -587,7 +609,10 @@ void on_language_window_accept(GtkWidget *,dictionary *dict){
if (status) if (status)
yon_char_parsed_add_or_create_if_exists(parsed,&size,current); yon_char_parsed_add_or_create_if_exists(parsed,&size,current);
} }
gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),yon_char_parsed_to_string(parsed,size,", ")); char *final = yon_char_parsed_to_string(parsed,size,", ");
gtk_entry_set_text(GTK_ENTRY(widgets->AvailableLanguagesEntry),final);
free(final);
yon_char_parsed_free(parsed,size);
} }
on_subwindow_close(window->MainWindow); on_subwindow_close(window->MainWindow);
free(window); free(window);
@ -752,10 +777,12 @@ void *on_config_save(void *data){
if (file) if (file)
fclose(file); fclose(file);
char *command = save_config_command(yon_char_parsed_to_string(parameters,size," ")); char *command = save_config_command(yon_char_parsed_to_string(parameters,size," "));
yon_char_parsed_free(parameters,size);
if (system(command)){ if (system(command)){
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALL_ERROR); gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALL_ERROR);
// yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),INSTALLATION_ERROR,5,BACKGROUND_IMAGE_FAIL_TYPE); // yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),INSTALLATION_ERROR,5,BACKGROUND_IMAGE_FAIL_TYPE);
}; };
free(command);
main_config.install_thread=NULL; main_config.install_thread=NULL;
main_config.install_complete=1; main_config.install_complete=1;
yon_debug_output("Install set to: %s\n",yon_char_from_int(main_config.install_complete)); yon_debug_output("Install set to: %s\n",yon_char_from_int(main_config.install_complete));
@ -782,6 +809,7 @@ gboolean yon_installation_progress_update(void *data){
if (!yon_char_is_empty(text[size-1])&&text[size-1][0]=='('){ if (!yon_char_is_empty(text[size-1])&&text[size-1][0]=='('){
char * current_copy = yon_char_new(text[size-1]); char * current_copy = yon_char_new(text[size-1]);
char *percentage = yon_char_divide_search(current_copy,")",-1); char *percentage = yon_char_divide_search(current_copy,")",-1);
yon_char_parsed_free(text,size);
free(yon_char_divide(current_copy,0)); free(yon_char_divide(current_copy,0));
free(yon_char_divide(percentage,0)); free(yon_char_divide(percentage,0));
if (strcmp(percentage,"#pb")){ if (strcmp(percentage,"#pb")){
@ -1028,6 +1056,9 @@ void yon_install_options_save(GtkWidget *device_tree, GtkWidget *part_tree,char
yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,cur_device); yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,cur_device);
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,mode); yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,mode);
yon_config_register(part_parameter,part_parameter_command,cur_section); yon_config_register(part_parameter,part_parameter_command,cur_section);
if(cur_section) free(cur_section);
if(cur_device) free(cur_device);
if (!main_config.configure_mode) if (!main_config.configure_mode)
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION_BEGIN); gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION_BEGIN);
else else
@ -1104,17 +1135,21 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
yon_config_remove_by_key(locale_parameter); yon_config_remove_by_key(locale_parameter);
} else { } else {
yon_config_register(locale_parameter,locale_parameter_command,languages); yon_config_register(locale_parameter,locale_parameter_command,languages);
free(languages);
} }
if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->LanguagesCombo))==-1||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck))){ if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->LanguagesCombo))==-1||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck))){
yon_config_remove_by_key(lang_parameter); yon_config_remove_by_key(lang_parameter);
} else { } else {
char *language = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->LanguagesCombo)); char *language = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->LanguagesCombo));
yon_config_register(lang_parameter,lang_parameter_command,language); yon_config_register(lang_parameter,lang_parameter_command,language);
free(language);
} }
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveCheck))){ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveCheck))){
char *region = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->RegionCombo)); char *region = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->RegionCombo));
char *zone = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->ZoneCombo)); char *zone = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->ZoneCombo));
yon_config_register(zone_parameter,zone_parameter_command,yon_char_unite(region,"/",zone,NULL)); yon_config_register(zone_parameter,zone_parameter_command,yon_char_unite(region,"/",zone,NULL));
free(zone);
free(region);
} else { } else {
yon_config_remove_by_key(zone_parameter); yon_config_remove_by_key(zone_parameter);
} }

@ -3446,12 +3446,42 @@ installed.</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">5</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Choose a section:</property> <property name="spacing">5</property>
<property name="xalign">0</property> <child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Select device:</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="GpartedNearButton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image36</property>
<style>
<class name="thin"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -3466,17 +3496,17 @@ installed.</property>
<property name="shadow-type">in</property> <property name="shadow-type">in</property>
<property name="min-content-height">128</property> <property name="min-content-height">128</property>
<child> <child>
<object class="GtkTreeView" id="InstallationNearSysSectionTree"> <object class="GtkTreeView" id="InstallationNearSysDevicesTree">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="model">PartitionsList</property> <property name="model">DevicesList</property>
<property name="search-column">0</property> <property name="search-column">0</property>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
<child> <child>
<object class="GtkTreeViewColumn"> <object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Section</property> <property name="title" translatable="yes">Device</property>
<child> <child>
<object class="GtkCellRendererText"/> <object class="GtkCellRendererText"/>
<attributes> <attributes>
@ -3487,7 +3517,7 @@ installed.</property>
</child> </child>
<child> <child>
<object class="GtkTreeViewColumn"> <object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Capacity</property> <property name="title" translatable="yes">Description</property>
<child> <child>
<object class="GtkCellRendererText"/> <object class="GtkCellRendererText"/>
<attributes> <attributes>
@ -3498,7 +3528,7 @@ installed.</property>
</child> </child>
<child> <child>
<object class="GtkTreeViewColumn"> <object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Free space</property> <property name="title" translatable="yes">Mark</property>
<child> <child>
<object class="GtkCellRendererText"/> <object class="GtkCellRendererText"/>
<attributes> <attributes>
@ -3509,7 +3539,7 @@ installed.</property>
</child> </child>
<child> <child>
<object class="GtkTreeViewColumn"> <object class="GtkTreeViewColumn">
<property name="title" translatable="yes">File system</property> <property name="title" translatable="yes">Size</property>
<child> <child>
<object class="GtkCellRendererText"/> <object class="GtkCellRendererText"/>
<attributes> <attributes>
@ -3520,7 +3550,7 @@ installed.</property>
</child> </child>
<child> <child>
<object class="GtkTreeViewColumn"> <object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Mark</property> <property name="title" translatable="yes">Serial</property>
<child> <child>
<object class="GtkCellRendererText"/> <object class="GtkCellRendererText"/>
<attributes> <attributes>
@ -3542,7 +3572,7 @@ installed.</property>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">1</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -3550,42 +3580,12 @@ installed.</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">5</property>
<child> <child>
<object class="GtkBox"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="spacing">5</property> <property name="label" translatable="yes">Choose a section:</property>
<child> <property name="xalign">0</property>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Select device:</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="GpartedNearButton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image36</property>
<style>
<class name="thin"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -3600,17 +3600,17 @@ installed.</property>
<property name="shadow-type">in</property> <property name="shadow-type">in</property>
<property name="min-content-height">128</property> <property name="min-content-height">128</property>
<child> <child>
<object class="GtkTreeView" id="InstallationNearSysDevicesTree"> <object class="GtkTreeView" id="InstallationNearSysSectionTree">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="model">DevicesList</property> <property name="model">PartitionsList</property>
<property name="search-column">0</property> <property name="search-column">0</property>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>
<child> <child>
<object class="GtkTreeViewColumn"> <object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Device</property> <property name="title" translatable="yes">Section</property>
<child> <child>
<object class="GtkCellRendererText"/> <object class="GtkCellRendererText"/>
<attributes> <attributes>
@ -3621,7 +3621,7 @@ installed.</property>
</child> </child>
<child> <child>
<object class="GtkTreeViewColumn"> <object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Description</property> <property name="title" translatable="yes">Capacity</property>
<child> <child>
<object class="GtkCellRendererText"/> <object class="GtkCellRendererText"/>
<attributes> <attributes>
@ -3632,7 +3632,7 @@ installed.</property>
</child> </child>
<child> <child>
<object class="GtkTreeViewColumn"> <object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Mark</property> <property name="title" translatable="yes">Free space</property>
<child> <child>
<object class="GtkCellRendererText"/> <object class="GtkCellRendererText"/>
<attributes> <attributes>
@ -3643,7 +3643,7 @@ installed.</property>
</child> </child>
<child> <child>
<object class="GtkTreeViewColumn"> <object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Size</property> <property name="title" translatable="yes">File system</property>
<child> <child>
<object class="GtkCellRendererText"/> <object class="GtkCellRendererText"/>
<attributes> <attributes>
@ -3654,7 +3654,7 @@ installed.</property>
</child> </child>
<child> <child>
<object class="GtkTreeViewColumn"> <object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Serial</property> <property name="title" translatable="yes">Mark</property>
<child> <child>
<object class="GtkCellRendererText"/> <object class="GtkCellRendererText"/>
<attributes> <attributes>
@ -3676,7 +3676,7 @@ installed.</property>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">2</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child> <child>

Loading…
Cancel
Save