diff --git a/source/ubl-settings-resourcequota.c b/source/ubl-settings-resourcequota.c index f65cf35..2024274 100644 --- a/source/ubl-settings-resourcequota.c +++ b/source/ubl-settings-resourcequota.c @@ -190,10 +190,11 @@ main_window *setup_window(){ void main_update_dispatcher() { int second = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->spinUpdateDispatcher)); - char *cmd = "systemd-cgtop"; - GtkWidget* parent=gtk_widget_get_parent(widgets->vteDispatcher); - gtk_container_remove(GTK_CONTAINER(parent),widgets->vteDispatcher); - yon_terminal_integrated_launch(parent, cmd, NULL, NULL); + char* str_second = yon_char_from_int(second); + char *cmd = yon_char_get_augumented("systemd-cgtop -d ", str_second); + yon_terminal_integrated_launch(widgets->vteDispatcher, cmd, NULL, NULL); + free(str_second); + free(cmd); } diff --git a/source/ubl-utils.c b/source/ubl-utils.c index b443d5e..ba842df 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -807,6 +807,13 @@ static render_data render; #ifdef VTE_TERMINAL +static void child_ready(VteTerminal *terminal, GPid pid, GError *error, gpointer user_data) +{ + if (!terminal) return; + if (pid == -1) printf("Error\n\n\n"); + else vte_terminal_feed_child(VTE_TERMINAL(terminal),(char*)user_data,strlen((char*)user_data)); +} + /** * void yon_terminal_integrated_launch(GtkWidget *place_to_show, void *endwork_function, void* endwork_function_argument) * [EN] @@ -818,7 +825,7 @@ static render_data render; * терминал добавляется в контейнер [place_to_show] виджета, * после завершения работы терминала вызывается функция [endwork_function] с аргументом [endwork_function_argument]. */ -void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, void *endwork_function, void* endwork_function_argument){ +void yon_terminal_integrated_launch(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument){ char **commands=new_arr(char*,2); gchar **envp = g_get_environ(); commands[0]=(gchar *)g_strdup(g_environ_getenv(envp, "SHELL")); @@ -826,11 +833,9 @@ void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, voi char **env=new_arr(char*,2); env[0]=""; env[1]=NULL; - GtkWidget *terminal = vte_terminal_new(); vte_terminal_set_size(VTE_TERMINAL(terminal),10,15); VtePty *pty = vte_pty_new_sync(VTE_PTY_DEFAULT,NULL,NULL); vte_terminal_set_pty(VTE_TERMINAL(terminal),pty); - gtk_container_add(GTK_CONTAINER(place_to_show),terminal); char *install_command=yon_char_unite("tput cup 0 0 && tput ed; ",command," ; sleep 5;exit 0","\n",NULL); if(endwork_function) g_signal_connect(G_OBJECT(terminal), "child-exited", G_CALLBACK(endwork_function), endwork_function_argument); @@ -844,7 +849,7 @@ void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, voi NULL, -1, NULL, - NULL, + child_ready, install_command); vte_pty_spawn_async(pty, NULL, @@ -856,7 +861,7 @@ void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, voi -1, NULL, NULL, - install_command); + NULL); vte_terminal_set_scrollback_lines(VTE_TERMINAL(terminal), 100); vte_terminal_set_scroll_on_output(VTE_TERMINAL(terminal), TRUE); vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(terminal), TRUE); diff --git a/source/ubl-utils.h b/source/ubl-utils.h index fc1ce42..98247ae 100644 --- a/source/ubl-utils.h +++ b/source/ubl-utils.h @@ -172,7 +172,7 @@ int yon_launch(thread_output *thread); /** * */ -void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, void *endwork_function, void* endwork_function_argument); +void yon_terminal_integrated_launch(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument); #endif /**yon_gtk_builder_get_widget(builder, widget_name) diff --git a/ubl-settings-resourcequota.glade b/ubl-settings-resourcequota.glade index e87d568..ef384da 100644 --- a/ubl-settings-resourcequota.glade +++ b/ubl-settings-resourcequota.glade @@ -172,6 +172,13 @@ + + 1 + 1000 + 1 + 1 + 10 + True False @@ -1089,6 +1096,7 @@ limit 5 5 5 + adjustment1 False