Merge pull request 'Test fix for terminals' (#14) from YanTheKaller/libublsettings-gtk3:master into master

Reviewed-on: #14
master v1.12
Dmitry Razumov 2 years ago
commit 2bc96217da

@ -14,44 +14,14 @@ static void child_ready(VteTerminal *terminal, GPid pid, GError *error, gpointer
}
void yon_terminal_integrated_launch(GtkWidget *place_to_show, 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"));
commands[1]=NULL;
char **env=new_arr(char*,2);
env[0]="";
env[1]=NULL;
GtkWidget *terminal = vte_terminal_new();
int size;
config_str parsed = yon_char_parse(command,&size," ");
yon_char_parsed_add_or_create_if_exists(parsed,&size,NULL);
vte_terminal_spawn_async(VTE_TERMINAL(terminal),VTE_PTY_NO_HELPER,NULL,parsed,NULL,G_SPAWN_SEARCH_PATH,NULL,NULL,NULL,2000,NULL,NULL,NULL);
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("clear;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);
vte_terminal_spawn_async(VTE_TERMINAL(terminal),
VTE_PTY_DEFAULT,
NULL,
commands,
NULL,
0,
NULL, NULL,
NULL,
-1,
NULL,
child_ready,
install_command);
vte_pty_spawn_async(pty,
NULL,
commands,
NULL,
0,
NULL, NULL,
NULL,
-1,
NULL,
NULL,
NULL);
vte_terminal_set_scrollback_lines(VTE_TERMINAL(terminal), -1);
vte_terminal_set_scroll_on_output(VTE_TERMINAL(terminal), TRUE);
vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(terminal), TRUE);
@ -59,42 +29,13 @@ void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, voi
}
void yon_terminal_integrated_start(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"));
commands[1]=NULL;
char **env=new_arr(char*,2);
env[0]="";
env[1]=NULL;
int size;
config_str parsed = yon_char_parse(command,&size," ");
yon_char_parsed_add_or_create_if_exists(parsed,&size,NULL);
vte_terminal_spawn_async(VTE_TERMINAL(terminal),VTE_PTY_NO_HELPER,NULL,parsed,NULL,G_SPAWN_SEARCH_PATH,NULL,NULL,NULL,2000,NULL,NULL,NULL);
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("clear;tput cup 0 0 && tput ed && ",command," ; stty -echo; unset PS1","\n",NULL);
if(endwork_function)
g_signal_connect(G_OBJECT(terminal), "child-exited", G_CALLBACK(endwork_function), endwork_function_argument);
vte_terminal_spawn_async(VTE_TERMINAL(terminal),
VTE_PTY_DEFAULT,
NULL,
commands,
NULL,
0,
NULL, NULL,
NULL,
-1,
NULL,
child_ready,
install_command);
vte_pty_spawn_async(pty,
NULL,
commands,
NULL,
0,
NULL, NULL,
NULL,
-1,
NULL,
NULL,
NULL);
vte_terminal_set_scrollback_lines(VTE_TERMINAL(terminal), -1);
vte_terminal_set_scroll_on_output(VTE_TERMINAL(terminal), TRUE);
vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(terminal), TRUE);
@ -461,6 +402,31 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end
}
// gtk misc section
int yon_gtk_window_setup(GtkWindow *window, GtkWindow *transistent_window, char *title, char *icon_name, char *window_id){
if (GTK_IS_WINDOW(window)){
int success=0;
if (transistent_window){
gtk_window_set_transient_for(window,transistent_window);
success++;
}
if (!yon_char_is_empty(title)){
gtk_window_set_title(window,title);
success++;
}
if (!yon_char_is_empty(icon_name)){
gtk_window_set_icon_name(window,icon_name);
success++;
}
if (!yon_char_is_empty(window_id)){
yon_window_config_custom_window_setup(window,window_id);
success++;
}
return success;
} else {
return 0;
}
}
GtkWidget *yon_ubl_menu_item_about_new(char *buttonname){
GtkWidget *menu_item = gtk_menu_item_new();
gtk_style_context_add_class(gtk_widget_get_style_context(menu_item),"menuitembottom");

@ -153,6 +153,8 @@ void yon_window_config_custom_window_set(GtkWindow *window, char *window_name);
int yon_gtk_icon_view_hide_empty(dictionary *icon_view_segment);
int yon_gtk_window_setup(GtkWindow *window, GtkWindow *transistent_window, char *title, char *icon_name, char *window_id);
/**yon_ubl_menu_item_documentation_new(char *buttonname)
* [EN]
*

Loading…
Cancel
Save