|
|
|
|
@ -46,7 +46,7 @@ void yon_terminal_integrated_start_shell(GtkWidget *terminal, char* command, voi
|
|
|
|
|
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);
|
|
|
|
|
char *install_command=yon_char_unite("PS1=\"\";tput reset; tput cup 0 0; tput ed; ",command,"; STATUS=$?; stty -echo; exit ${STATUS}","\n",NULL);
|
|
|
|
|
char *install_command=yon_char_unite("PS1=\"\";tput reset; tput cup 0 0; tput ed; ",command,command[strlen(command)-1]=='\n'?"":";"," STATUS=$?; stty -echo; exit ${STATUS}","\n",NULL);
|
|
|
|
|
if(endwork_function)
|
|
|
|
|
g_signal_connect(G_OBJECT(terminal), "child-exited", G_CALLBACK(endwork_function), endwork_function_argument);
|
|
|
|
|
printf("%s\n",install_command);
|
|
|
|
|
@ -138,6 +138,43 @@ void yon_terminal_integrated_start_shell(GtkWidget *terminal, char* command, voi
|
|
|
|
|
yon_terminal_integrated_start(terminal,command);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_terminal_window_launch_shell(GtkWindow *parent_window, char *command, char *success_label,char *fail_label){
|
|
|
|
|
|
|
|
|
|
struct terminal_window_struct *data = malloc(sizeof(struct terminal_window_struct));
|
|
|
|
|
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
|
|
|
|
GtkWidget *header = gtk_header_bar_new();
|
|
|
|
|
GtkWidget *terminal = vte_terminal_new();
|
|
|
|
|
GtkWidget *status_box = gtk_box_new(GTK_ORIENTATION_VERTICAL,5);
|
|
|
|
|
GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL,5);
|
|
|
|
|
GtkWidget *terminal_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
|
|
|
|
|
GtkWidget *scroll = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL,gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(terminal)));
|
|
|
|
|
gtk_widget_set_size_request(window,450,300);
|
|
|
|
|
|
|
|
|
|
gtk_window_set_titlebar(GTK_WINDOW(window),header);
|
|
|
|
|
gtk_container_add(GTK_CONTAINER(window),box);
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(box),status_box,0,0,0);
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(box),terminal_box,1,1,0);
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(terminal_box),terminal,1,1,0);
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(terminal_box),scroll,0,0,0);
|
|
|
|
|
gtk_widget_set_margin_bottom(terminal_box,5);
|
|
|
|
|
gtk_widget_set_margin_start(terminal_box,5);
|
|
|
|
|
gtk_widget_set_margin_end(terminal_box,5);
|
|
|
|
|
gtk_widget_show_all(window);
|
|
|
|
|
|
|
|
|
|
vte_terminal_set_scrollback_lines(VTE_TERMINAL(terminal),-1);
|
|
|
|
|
|
|
|
|
|
gtk_window_set_modal(GTK_WINDOW(window),1);
|
|
|
|
|
gtk_header_bar_set_show_close_button(GTK_HEADER_BAR(header),1);
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window),gtk_window_get_title(parent_window));
|
|
|
|
|
gtk_window_set_icon_name(GTK_WINDOW(window),gtk_window_get_icon_name(parent_window));
|
|
|
|
|
|
|
|
|
|
data->StatusBox=status_box;
|
|
|
|
|
data->success_label=success_label;
|
|
|
|
|
data->fail_label=fail_label;
|
|
|
|
|
g_signal_connect(G_OBJECT(terminal), "child-exited", G_CALLBACK(__on_yon_terminal_done), data);
|
|
|
|
|
yon_terminal_integrated_start_shell(terminal,command,NULL,NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void __on_terminal_window_update_clicked(GtkWidget *,struct terminal_window *window){
|
|
|
|
|
vte_terminal_reset(VTE_TERMINAL(window->terminal),1,1);
|
|
|
|
|
yon_terminal_integrated_start(window->terminal,window->command);
|
|
|
|
|
|