Fixes, functionality addtions

pull/1/head
parent 34a7634cdd
commit 34e0b34d91

@ -155,6 +155,9 @@ void config_init(){
main_config.lock_save_local=0;
main_config.debug_mode=0;
main_config.slider_thread=0;
main_config.config_save_thread=NULL;
main_config.install_thread=NULL;
main_config.progress_thread=NULL;
}
int yon_image_resize_from_container(GtkImage *target, GdkPixbuf *pixbuf_unscaled);
@ -240,6 +243,42 @@ gboolean on_image_slide(void *data){
return 1;
}
void *on_config_save(char *command);
void *on_config_save(char *command){
if (system(command)){};
main_config.config_save_thread=NULL;
return NULL;
}
void *yon_installation_start();
void *yon_installation_start(){
if (system(start_fast_install_command)){};
main_config.install_thread=NULL;
g_thread_exit(NULL);
return NULL;
}
void *yon_installation_progress_update(void *data);
void *yon_installation_progress_update(void *data){
main_window *widgets = (main_window*)data;
FILE *file = fopen(progress_path,"r");
char *current = g_malloc0(4096);
if (file){
while (main_config.install_thread){
current = fgets(current,4096,file);
if (current[0]!='#'){
int size;
config_str parsed = yon_char_parse(current,&size,"|");
gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel),parsed[1]);
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress),atof(parsed[0]));
}
}
}
return NULL;
}
void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets);
void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){
yon_switch_page_render(widgets,page>3?page-2:page);
@ -247,6 +286,7 @@ void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){
case YON_PAGE_WELCOME: {
gtk_widget_hide(widgets->CancelInstallButton);
gtk_widget_set_sensitive(widgets->BackButton,0);
gtk_widget_set_sensitive(widgets->NextButton,1);
} break;
case YON_PAGE_LICENCE:{
gtk_widget_show(widgets->CancelInstallButton);
@ -260,10 +300,28 @@ void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){
yon_image_resize_from_container(GTK_IMAGE(widgets->KeyboardImage), widgets->keyboard_original);
} break;
case YON_PAGE_INSTALLATION:{
gtk_widget_set_sensitive(widgets->BackButton,0);
g_thread_join(main_config.config_save_thread);
if (!main_config.install_thread)
main_config.install_thread = g_thread_new("InstallThread",(GThreadFunc)on_config_save,NULL);
if (!main_config.install_thread)
main_config.progress_thread = g_thread_new("ProgressThread",(GThreadFunc)yon_installation_progress_update,widgets);
if (!main_config.slider_thread)
main_config.slider_thread = g_timeout_add(5000,(GSourceFunc)on_image_slide,widgets);
gtk_widget_show(gtk_widget_get_parent(widgets->InstallationProgress));
} break;
case YON_PAGE_OS_COMPONENTS:
case YON_PAGE_SOFTWARE:
yon_switch_page_render(widgets,3);
break;
case YON_PAGE_USERS:
gtk_widget_set_sensitive(widgets->NextButton,1);
break;
case YON_PAGE_COMPLETION:
gtk_widget_set_sensitive(widgets->NextButton,0);
break;
case YON_PAGE_INSTALL_COMMON:
case YON_PAGE_INSTALL_SEPARATE:
case YON_PAGE_INSTALL_SAME_PARTITION: {
@ -340,12 +398,6 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
gtk_widget_set_sensitive(widgets->BackButton,1);
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),page+1);
}break;
case YON_PAGE_SOFTWARE:
gtk_widget_set_sensitive(widgets->BackButton,0);
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),page+1);
yon_config_save_simple(YON_CONFIG_BOTH,"");
yon_launch_app_with_arguments(start_fast_install_command,"");
break;
case YON_PAGE_INSTALL_COMMON: {
GtkTreeModel *model;
GtkTreeIter iter;
@ -359,9 +411,10 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"fast");
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_DEVICE_command,device);
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),3);
if (!main_config.slider_thread)
main_config.slider_thread = g_timeout_add(5000,(GSourceFunc)on_image_slide,widgets);
int size=0;
config_str parameters = yon_config_get_all(&size);
main_config.config_save_thread = g_thread_new("savethread",(GThreadFunc)on_config_save,save_config_command(yon_char_parsed_to_string(parameters,size," ")));
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION);
}break;
case YON_PAGE_INSTALL_SEPARATE:
{
@ -385,9 +438,10 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_DEVICE_command,device);
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOSTART_PARTS_command,part);
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),3);
if (!main_config.slider_thread)
main_config.slider_thread = g_timeout_add(5000,(GSourceFunc)on_image_slide,widgets);
int size=0;
config_str parameters = yon_config_get_all(&size);
main_config.config_save_thread = g_thread_new("savethread",(GThreadFunc)on_config_save,save_config_command(yon_char_parsed_to_string(parameters,size," ")));
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION);
}
break;
case YON_PAGE_INSTALL_SAME_PARTITION:
@ -412,9 +466,10 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_DEVICE_command,device);
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOSTART_PARTS_command,part);
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),3);
if (!main_config.slider_thread)
main_config.slider_thread = g_timeout_add(5000,(GSourceFunc)on_image_slide,widgets);
int size=0;
config_str parameters = yon_config_get_all(&size);
main_config.config_save_thread = g_thread_new("savethread",(GThreadFunc)on_config_save,save_config_command(yon_char_parsed_to_string(parameters,size," ")));
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION);
}
}
} break;

@ -71,12 +71,16 @@ NULL
#define AUTOINSTALL_DEVICE "AUTOINSTALL[device]"
#define AUTOSTART_PARTS "AUTOINSTALL[part]"
#define save_config_command(parameters) yon_char_append("pkexec ubconfig set [autoinstall] ",parameters)
#define AUTOINSTALL_TYPE_INSTALL_command "ubconfig --source global get autoinstall AUTOINSTALL[type_install]"
#define AUTOINSTALL_DEVICE_command "ubconfig --source global get autoinstall AUTOINSTALL[device]"
#define AUTOSTART_PARTS_command "ubconfig --source global get autoinstall AUTOINSTALL[part]"
#define start_fast_install_command "ubinstall2 --autoinstall"
#define progress_path "/tmp/ubinstall/ubinstall_progress.log"
typedef char* string;
string version_application;
@ -114,6 +118,9 @@ typedef struct {
int debug_mode;
guint slider_thread;
int install_mode;
GThread *config_save_thread;
GThread *install_thread;
GThread *progress_thread;
} config;
typedef struct {

@ -1865,7 +1865,6 @@ and help you install UBLinux on your computer</property>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-missing-image</property>
</object>
<packing>
<property name="expand">True</property>
@ -2216,7 +2215,6 @@ and help you install UBLinux on your computer</property>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-missing-image</property>
</object>
<packing>
<property name="expand">True</property>
@ -5404,30 +5402,19 @@ separately into the selected partition.</property>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkProgressBar" id="InstallationProgress">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel" id="InstallationLabel">
<object class="GtkProgressBar" id="InstallationProgress">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="expand">False</property>
@ -5436,15 +5423,39 @@ separately into the selected partition.</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">button</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel" id="InstallationLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">button</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</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>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
@ -5452,30 +5463,18 @@ separately into the selected partition.</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkProgressBar" id="PackageInstallationProgress">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel" id="PackageInstallationLabel">
<object class="GtkProgressBar" id="PackageInstallationProgress">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="expand">False</property>
@ -5484,15 +5483,39 @@ separately into the selected partition.</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">button</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel" id="PackageInstallationLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">button</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</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>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
@ -5500,7 +5523,7 @@ separately into the selected partition.</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="position">2</property>
</packing>
</child>
</object>

Loading…
Cancel
Save