Adde new status messages, changes to progress bar updating function

pull/9/head
parent a98782f0b1
commit 5313404058

@ -227,6 +227,12 @@ int yon_tag_add(GtkBox *target,char *tag_label, char *tag_style, char *icon_name
}
gboolean on_command_execute_success(GtkWidget *,gint status,main_window *widgets){
g_mutex_lock(&main_config.pulse_mutex);
main_config.pulse_active=0;
g_mutex_unlock(&main_config.pulse_mutex);
g_mutex_lock(&main_config.progress_mutex);
main_config.progress_active=0;
g_mutex_unlock(&main_config.progress_mutex);
if (!status){
gtk_revealer_set_transition_type(GTK_REVEALER(widgets->MainRevealer),GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN);
yon_ubl_status_box_render(OPERATION_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
@ -253,9 +259,13 @@ gboolean yon_terminal_get_progress(main_window *widgets){
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress),percentage/100);
}
if (!gtk_revealer_get_child_revealed(GTK_REVEALER(widgets->MainRevealer))){
g_mutex_lock(&main_config.progress_mutex);
if (!main_config.progress_active){
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress),0);
g_mutex_unlock(&main_config.progress_mutex);
return G_SOURCE_REMOVE;
}
g_mutex_unlock(&main_config.progress_mutex);
return G_SOURCE_CONTINUE;
}
@ -267,6 +277,11 @@ void *yon_command_execute_async(char *command,main_window *widgets){
yon_terminal_integrated_start(widgets->InstallTerminal,yon_debug_output("%s\n",command));
glong columns = vte_terminal_get_column_count(VTE_TERMINAL(widgets->InstallTerminal));
vte_terminal_set_size(VTE_TERMINAL(widgets->InstallTerminal),columns,20);
yon_ubl_status_box_render(OPERATION_IN_PROGRESS_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
g_mutex_lock(&main_config.progress_mutex);
main_config.progress_active=1;
g_mutex_unlock(&main_config.progress_mutex);
gdk_threads_add_timeout(500,(GSourceFunc)yon_terminal_get_progress,widgets);
return NULL;
}
@ -754,7 +769,8 @@ void config_init(){
main_config.load_mode=1;
main_config.save_config=1;
main_config.kernel_tabs=NULL;
main_config.addition_tabs=NULL;
main_config.pulse_active=0;
main_config.progress_active=0;
}
void on_update_clicked(GtkWidget *, main_window *widgets){
@ -823,6 +839,17 @@ void on_changelog_clicked(GtkWidget *, kernels_tab *tab){
gtk_widget_show(window->window);
}
gboolean yon_pulse_run(main_window *widgets){
gtk_progress_bar_pulse(GTK_PROGRESS_BAR(widgets->InstallationProgress));
g_mutex_lock(&main_config.pulse_mutex);
gboolean ret;
if (main_config.pulse_active) ret = 0;
else ret = 1;
g_mutex_unlock(&main_config.pulse_mutex);
return ret;
}
void on_build_execute(GtkWidget *, dictionary *dict){
main_window *widgets = yon_dictionary_get_data(dict->first,main_window*);
install_window *window = yon_dictionary_get_data(dict->first->next,install_window*);
@ -833,6 +860,10 @@ void on_build_execute(GtkWidget *, dictionary *dict){
char *command = build_command(target,filename,debug,drivers);
yon_command_execute_async(command,widgets);
gtk_widget_destroy(window->window);
g_mutex_lock(&main_config.pulse_mutex);
main_config.pulse_active=1;
g_mutex_unlock(&main_config.pulse_mutex);
g_timeout_add(1000,(GSourceFunc)yon_pulse_run,widgets);
}
void on_building_clicked(GtkWidget *, main_window *widgets){
@ -932,6 +963,7 @@ void yon_main_window_complete(main_window *widgets){
g_signal_connect(G_OBJECT(widgets->LoadLocalMenuItem),"activate",G_CALLBACK(on_config_local_load),widgets);
g_signal_connect(G_OBJECT(widgets->LoadCustomMenuItem),"activate",G_CALLBACK(on_config_custom_load),widgets);
gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(widgets->InstallationProgress),1);
GdkRGBA rgba;
vte_terminal_get_color_background_for_draw(VTE_TERMINAL(widgets->InstallTerminal),&rgba);
vte_terminal_set_color_cursor(VTE_TERMINAL(widgets->InstallTerminal),&rgba);

@ -77,6 +77,10 @@ typedef struct {
int save_config;
dictionary *kernel_tabs;
dictionary *addition_tabs;
GMutex pulse_mutex;
int pulse_active;
GMutex progress_mutex;
int progress_active;
} config;
typedef struct {
@ -231,7 +235,6 @@ void on_module_remove_clicked(GtkWidget *,dictionary *dict);
void on_package_remove_clicked(GtkWidget *,dictionary *dict);
void on_launch_cliked(GtkWidget *,dictionary *dict);
void on_build_execute(GtkWidget *, dictionary *dict);
int yon_tag_add(GtkBox *target,char *tag_label, char *tag_style, char *icon_name);
kernels_tab *yon_tab_row_new(GtkListBox *target, char *target_string, main_window *widgets);
additions_kernels_tab *yon_additions_tab_row_new(GtkListBox *target, char *target_string, main_window *widgets);
@ -244,6 +247,9 @@ void on_info_clicked(GtkWidget *, main_window *widgets);
void on_changelog_clicked(GtkWidget *, kernels_tab *tab);
gboolean yon_pulse_run(main_window *widgets);
void on_build_execute(GtkWidget *, dictionary *dict);
void on_building_clicked(GtkWidget *, main_window *widgets);
void on_boot_toggled(GtkWidget *, char *path, main_window *widgets);

@ -54,6 +54,7 @@
#define OPERATION_SUCCESS_LABEL _("Terminal operation success")
#define OPERATION_ERROR_LABEL _("Terminal operation failed")
#define OPERATION_IN_PROGRESS_LABEL _("Terminal operation in process")
#define MODULE_INSTALL_CONFIRMATION_LABEL(target) yon_char_unite(_("Are you sure want to install kernel")," ",target,"?",NULL)
#define PACKAGE_INSTALL_CONFIRMATION_LABEL(target) yon_char_unite(_("Are you sure want to install package")," ",target,"?",NULL)

@ -186,6 +186,10 @@ msgstr ""
msgid "Terminal operation success"
msgstr ""
#: source/ubl-strings.h:55
msgid "Terminal operation in process"
msgstr ""
#: source/ubl-strings.h:56
msgid "Terminal operation failed"
msgstr ""

@ -191,6 +191,10 @@ msgstr "Операция терминала успешно завершена"
msgid "Terminal operation failed"
msgstr "Операция терминала завершена с ошибкой"
#: source/ubl-strings.h:55
msgid "Terminal operation in process"
msgstr "Операция терминала в процессе выполнения"
#: source/ubl-strings.h:58
msgid "Are you sure want to install kernel"
msgstr "Вы хотите установить в систему ядро"

Loading…
Cancel
Save