|
|
|
|
@ -522,6 +522,7 @@ 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){
|
|
|
|
|
// gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->MainRevealer),0);
|
|
|
|
|
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress),0);
|
|
|
|
|
g_mutex_lock(&main_config.progress_mutex);
|
|
|
|
|
main_config.progress_active=0;
|
|
|
|
|
g_mutex_unlock(&main_config.progress_mutex);
|
|
|
|
|
@ -565,52 +566,11 @@ gboolean on_command_execute_success(GtkWidget *,gint status,main_window *widgets
|
|
|
|
|
return G_SOURCE_REMOVE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gboolean yon_terminal_get_progress(main_window *widgets){
|
|
|
|
|
char *text = vte_terminal_get_text_format(VTE_TERMINAL(widgets->InstallTerminal),VTE_FORMAT_TEXT);
|
|
|
|
|
GRegex *regex = g_regex_new("\\d?\\d?\\d%",0,0,NULL);
|
|
|
|
|
|
|
|
|
|
GMatchInfo *match = NULL;
|
|
|
|
|
g_regex_match(regex,text,0,&match);
|
|
|
|
|
g_regex_unref(regex);
|
|
|
|
|
double percentage = 0.0;
|
|
|
|
|
char *last_match = NULL;
|
|
|
|
|
while (g_match_info_matches(match)) {
|
|
|
|
|
char *current_match = g_match_info_fetch(match, 0);
|
|
|
|
|
if (last_match) {
|
|
|
|
|
g_free(last_match);
|
|
|
|
|
}
|
|
|
|
|
last_match = current_match;
|
|
|
|
|
g_match_info_next(match, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (last_match) {
|
|
|
|
|
yon_char_remove_last_symbol(last_match,'%');
|
|
|
|
|
percentage = atof(last_match);
|
|
|
|
|
yon_debug_output("%s\n", text);
|
|
|
|
|
yon_debug_output("%s\n", last_match);
|
|
|
|
|
|
|
|
|
|
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress), percentage / 100);
|
|
|
|
|
g_free(last_match);
|
|
|
|
|
}
|
|
|
|
|
g_match_info_unref(match);
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void *yon_command_execute_async(char *command,main_window *widgets){
|
|
|
|
|
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress),0);
|
|
|
|
|
vte_terminal_reset(VTE_TERMINAL(widgets->InstallTerminal),0,1);
|
|
|
|
|
yon_terminal_integrated_start_shell(widgets->InstallTerminal,yon_debug_output("%s\n",command),NULL,NULL);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->CancelButton,1);
|
|
|
|
|
// g_signal_connect_after(G_OBJECT(widgets->InstallTerminal),"child-exited",G_CALLBACK(on_command_execute_success),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);
|
|
|
|
|
@ -618,7 +578,7 @@ void *yon_command_execute_async(char *command,main_window *widgets){
|
|
|
|
|
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);
|
|
|
|
|
g_timeout_add(500,(GSourceFunc)on_terminal_check_progress,widgets);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->UpdateButton,0);
|
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
|
if (main_config.kernel_tabs){
|
|
|
|
|
@ -1354,6 +1314,17 @@ additions_kernels_tab *yon_additions_tab_row_new(GtkListBox *target, char *targe
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gboolean on_terminal_check_progress(main_window *widgets){
|
|
|
|
|
g_mutex_lock(&main_config.progress_mutex);
|
|
|
|
|
if (!main_config.progress_active){
|
|
|
|
|
g_mutex_unlock(&main_config.progress_mutex);
|
|
|
|
|
return G_SOURCE_REMOVE;
|
|
|
|
|
}
|
|
|
|
|
gtk_progress_bar_pulse(GTK_PROGRESS_BAR(widgets->InstallationProgress));
|
|
|
|
|
g_mutex_unlock(&main_config.progress_mutex);
|
|
|
|
|
return G_SOURCE_CONTINUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// standard functions
|
|
|
|
|
|
|
|
|
|
/**config_init()
|
|
|
|
|
@ -1518,7 +1489,13 @@ void on_boot_toggled(GtkWidget *, char *path, main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_terminal_cancel(GtkWidget *,main_window *widgets){
|
|
|
|
|
vte_terminal_feed_child(VTE_TERMINAL(widgets->InstallTerminal), "\x03", 1);
|
|
|
|
|
const char cancel_signal = 3;
|
|
|
|
|
char *command = yon_char_new(" ");
|
|
|
|
|
command[0]=cancel_signal;
|
|
|
|
|
char *tmp = yon_char_unite(command,"exit 0\n",NULL);
|
|
|
|
|
free(command);
|
|
|
|
|
vte_terminal_feed_child(VTE_TERMINAL(widgets->InstallTerminal),tmp,strlen(tmp));
|
|
|
|
|
free(tmp);
|
|
|
|
|
yon_launch(pacman_unlock_database_command);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1629,9 +1606,6 @@ void yon_main_window_complete(main_window *widgets){
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LoadCustomMenuItem),"activate",G_CALLBACK(on_config_custom_load),widgets);
|
|
|
|
|
gtk_overlay_add_overlay(GTK_OVERLAY(widgets->MainOverlay),widgets->LoadingSpinner);
|
|
|
|
|
|
|
|
|
|
// yon_gtk_scrolled_window_set_horizontal_at_desired_size(widgets->Window,GTK_SCROLLED_WINDOW(gtk_widget_get_parent(gtk_widget_get_parent(widgets->KernelsPackageBox))));
|
|
|
|
|
// yon_gtk_scrolled_window_set_horizontal_at_desired_size(widgets->Window,GTK_SCROLLED_WINDOW(gtk_widget_get_parent(gtk_widget_get_parent(widgets->AdditionsPackageBox))));
|
|
|
|
|
|
|
|
|
|
char *path = yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL);
|
|
|
|
|
yon_window_config_load(path);
|
|
|
|
|
int paned_pos=0;
|
|
|
|
|
@ -1643,7 +1617,7 @@ void yon_main_window_complete(main_window *widgets){
|
|
|
|
|
if (getuid()){
|
|
|
|
|
gtk_widget_set_sensitive(widgets->BuildingButton,0);
|
|
|
|
|
}
|
|
|
|
|
gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(widgets->InstallationProgress),1);
|
|
|
|
|
gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(widgets->InstallationProgress),0.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);
|
|
|
|
|
@ -1657,7 +1631,6 @@ void yon_main_window_complete(main_window *widgets){
|
|
|
|
|
yon_save_window_set_postsave_function(on_save_done,widgets);
|
|
|
|
|
|
|
|
|
|
gtk_button_clicked(GTK_BUTTON(widgets->MoreButton));
|
|
|
|
|
// on_terminal_revealer_open(NULL,widgets);
|
|
|
|
|
yon_terminal_integrated_start(widgets->InstallTerminal,pacman_update_command);
|
|
|
|
|
yon_gtk_widget_set_scroll_window_for_scroll(gtk_widget_get_parent(widgets->InstallTerminal),GTK_SCROLLBAR(widgets->TerminalScroll));
|
|
|
|
|
}
|
|
|
|
|
|