static VALUE term_fork_command(int argc, VALUE *argv, VALUE self) { VALUE rb_command, rb_command_argv, rb_envv, rb_directory; VALUE lastlog, utmp, wtmp; char *command; char **command_argv; char **envv; char *directory; pid_t pid; rb_scan_args(argc, argv, "07", &rb_command, &rb_command_argv, &rb_envv, &rb_directory, &lastlog, &utmp, &wtmp); command = NIL_P(rb_command) ? NULL : RVAL2CSTR(rb_command); command_argv = rval2cstrary(rb_command_argv); envv = rval2cstrary(rb_envv); directory = NIL_P(rb_directory) ? NULL : RVAL2CSTR(rb_directory); pid = vte_terminal_fork_command(RVAL2TERM(self), command, command_argv, envv, directory, NIL_P(lastlog) ? TRUE : RVAL2CBOOL(lastlog), NIL_P(utmp) ? TRUE : RVAL2CBOOL(utmp), NIL_P(wtmp) ? TRUE : RVAL2CBOOL(wtmp)); free_cstrary(command_argv); free_cstrary(envv); return INT2NUM(pid); }
//gpointer e (void *) são a mesma coisa! Gpointer é só um açúcar sintático. static void initialize_vte (GtkWidget * vte) { vte_terminal_fork_command (VTE_TERMINAL (vte), "/bin/bash", NULL, NULL, NULL, FALSE, FALSE, FALSE); start_warning (); }
static void init_shell (TerminalPlugin *term_plugin, const char *uri) { struct passwd *pw; const char *shell; const char *dir; static gboolean first_time = TRUE; VteTerminal *term = VTE_TERMINAL (term_plugin->shell); pw = getpwuid (getuid ()); if (pw) { shell = pw->pw_shell; dir = pw->pw_dir; } else { shell = "/bin/sh"; dir = "/"; } if (uri) dir = uri; if (!first_time) vte_terminal_reset (term, FALSE, TRUE); else first_time = FALSE; vte_terminal_fork_command (term, shell, NULL, NULL, dir, term_plugin->lastlog, term_plugin->update_records, term_plugin->update_records); }
static void term_eof_or_child_exited(VteTerminal *term, gpointer user_data) { vte_terminal_reset(VTE_TERMINAL(term), FALSE, TRUE); vte_terminal_fork_command(VTE_TERMINAL(term), conf_get_shell(), NULL, NULL, "", TRUE, TRUE, TRUE); gtk_widget_hide(GTK_WIDGET(mainwindow)); }
static void on_quit(VteTerminal* vte, PussVConsole* self) { vte_terminal_fork_command( VTE_TERMINAL(vte) , 0, 0 , 0, 0 , FALSE , FALSE , FALSE ); }
GtkWidget* create_window1(void){ /* get the current working directory for vte and pdf */ getcwd(cpath,255); /* load the program user interface from Glade3 by GtkBuilder */ GError* error = NULL; GtkBuilder* builder = gtk_builder_new (); if (!gtk_builder_add_from_file (builder, "thesiswp.gbuilder", &error)) { g_warning ("Couldn't load builder file: %s", error->message) ; g_error_free (error); } /* Pull out the UI elements built by glade3 */ GtkWidget* window; /* create and connect by glade */ GtkWidget* viewport2; /* create and connect by glade */ GtkWidget* terminal1; /* create and connect by glade */ //GtkWidget *vte; /* add by manually */ window = GTK_WIDGET(gtk_builder_get_object (builder,"window1")); viewport2 = GTK_WIDGET(gtk_builder_get_object (builder,"viewport2")); terminal1 = GTK_WIDGET(gtk_builder_get_object (builder,"terminal1")); // Hierachy // {{{ // ------------------------ // ->vbox1 // + scrollwindow1 // ->scrollwindow2 // ->viewport2 // ->vte // + hbox // }}} vte_terminal_fork_command(VTE_TERMINAL(terminal1), NULL, NULL, NULL, cpath, TRUE, TRUE,TRUE); /* create vte manually */ //vte = vte_terminal_new(); //vte_terminal_set_background_transparent(VTE_TERMINAL(vte), FALSE); //vte_terminal_fork_command(VTE_TERMINAL(vte), NULL, NULL, NULL, cpath, TRUE, TRUE,TRUE); //vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL (vte), TRUE); //vte_terminal_set_scroll_on_output(VTE_TERMINAL (vte), TRUE); /* add custom widget to those built by glad3 */ //gtk_container_add(GTK_CONTAINER(viewport2), vte); /* connect the signals in the interface */ gtk_builder_connect_signals(builder,NULL); return window; }
PUSS_EXPORT void* puss_plugin_create(Puss* app) { PussVConsole* self; GtkWindow* window; GModule* module; bindtextdomain(TEXT_DOMAIN, app->get_locale_path()); bind_textdomain_codeset(TEXT_DOMAIN, "UTF-8"); window = puss_get_main_window(app); module = (GModule*)g_object_get_data(G_OBJECT(window), LIBVTE_KEEP_KEY); if( !module ) { module = g_module_open("libvte", G_MODULE_BIND_LAZY); if( !module ) { g_printerr("warning(puss_vconsole) : keep libvte failed! reload plugin will cause error!\n"); } else { g_object_set_data_full(G_OBJECT(window), LIBVTE_KEEP_KEY, module, (GDestroyNotify)g_module_close); } } self = g_new0(PussVConsole, 1); self->app = app; self->vte = vte_terminal_new(); { GtkWidget* hbox = gtk_hbox_new(FALSE, 4); GtkWidget* sbar = gtk_vscrollbar_new( vte_terminal_get_adjustment(VTE_TERMINAL(self->vte)) ); gtk_box_pack_start(GTK_BOX(hbox), self->vte, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), sbar, FALSE, FALSE, 0); g_signal_connect(self->vte, "child-exited", G_CALLBACK(on_quit), self); vte_terminal_fork_command( VTE_TERMINAL(self->vte) , 0, 0 , 0, 0 , FALSE , FALSE , FALSE ); vte_terminal_set_size(VTE_TERMINAL(self->vte), vte_terminal_get_column_count(VTE_TERMINAL(self->vte)), 5); vte_terminal_set_audible_bell(VTE_TERMINAL(self->vte), FALSE); gtk_widget_set_size_request(self->vte, 200, 50); gtk_widget_show_all(hbox); self->panel = hbox; app->panel_append(self->panel, gtk_label_new(_("Terminal")), "puss_vconsole_plugin_panel", PUSS_PANEL_POS_BOTTOM); } return self; }
static void term_fork_command(VteTerminal *term, char *cmd) { #if VTE_CHECK_VERSION(0,25,0) char **argv = NULL; g_shell_parse_argv(cmd, NULL, &argv, NULL); vte_terminal_fork_command_full(term, VTE_PTY_DEFAULT, "", argv, NULL, G_SPAWN_CHILD_INHERITS_STDIN|G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL); #else vte_terminal_fork_command(term, cmd, NULL, NULL, "", TRUE, TRUE, TRUE); #endif }
void add_vte(){ struct v *temp = (struct v *)malloc(sizeof(struct v)); temp-> vte = vte_terminal_new(); vte_terminal_fork_command(VTE_TERMINAL(temp-> vte), "bash" , NULL, NULL, ".", FALSE, FALSE, FALSE); vte_terminal_set_size(VTE_TERMINAL(temp-> vte), 80, 5); gtk_box_pack_start (GTK_BOX (box_vte), temp-> vte, FALSE, TRUE, 5); gtk_widget_show (temp-> vte); set_data(temp); temp -> next = list -> next; (list -> next) -> prev = temp; list -> next = temp; temp -> prev = list; list = list -> next; c++; }
/* * Class: com_randomwalking_swt_terminal_internal_Vte * Method: vte_terminal_fork_comman * Signature: (ILjava/lang/String;[Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;ZZZ)I */ JNIEXPORT jint JNICALL Java_com_randomwalking_swt_terminal_internal_Vte__1vte_1terminal_1fork_1command (JNIEnv * env, jclass obj, jint terminal, jstring command, jobjectArray argv, jobjectArray envv, jstring directory, jboolean lastlog, jboolean utmp, jboolean wtmp) { const char *mcommand = NULL; if (command != NULL) { mcommand = (*env)->GetStringUTFChars(env, command, NULL); } //const jchar *mcommand = (*env)->GetStringChars(env, command, NULL); //const jchar *mdirectory = (*env)->GetStringChars(env, directory, NULL); jint pid = vte_terminal_fork_command(VTE_TERMINAL(terminal), mcommand, NULL, NULL, NULL, TRUE, TRUE, TRUE); if (mcommand != NULL) { (*env)->ReleaseStringUTFChars(env, command, mcommand); } // //(*env)->ReleaseStringChars(env, directory, mdirectory); return pid; }
static VALUE rg_fork_command(int argc, VALUE *argv, VALUE self) { VALUE rb_command, rb_command_argv, rb_envv, rb_directory; VALUE lastlog, utmp, wtmp; char *command; char **command_argv; char **envv; char *directory; pid_t pid; rb_scan_args(argc, argv, "07", &rb_command, &rb_command_argv, &rb_envv, &rb_directory, &lastlog, &utmp, &wtmp); #if VTE_CHECK_VERSION(0, 26, 0) if (argc == 0 || TYPE(rb_command) == T_HASH) return fork_command_full(1, &rb_command, self); rb_warn("'fork_commad(command, argv, envv, directory, lastlog, utmp, wtmp)' style" " has been deprecated since version 0.26." " Use 'fork_commad(options = {})' style."); #endif command = NIL_P(rb_command) ? NULL : RVAL2CSTR(rb_command); command_argv = rval2cstrary(rb_command_argv); envv = rval2cstrary(rb_envv); directory = NIL_P(rb_directory) ? NULL : RVAL2CSTR(rb_directory); pid = vte_terminal_fork_command(RVAL2TERM(self), command, command_argv, envv, directory, NIL_P(lastlog) ? TRUE : RVAL2CBOOL(lastlog), NIL_P(utmp) ? TRUE : RVAL2CBOOL(utmp), NIL_P(wtmp) ? TRUE : RVAL2CBOOL(wtmp)); free_cstrary(command_argv); free_cstrary(envv); return INT2NUM(pid); }
GtkWidget* build_term(void) { if (!popupmenu) build_popupmenu(); GtkWidget* term = vte_terminal_new(); vte_terminal_fork_command(VTE_TERMINAL(term), conf_get_shell(), NULL, NULL, "", TRUE, TRUE, TRUE); if (conf_get_bg_image() != NULL) vte_terminal_set_background_image_file(VTE_TERMINAL(term), conf_get_bg_image()); GdkColor fore, back; fore = conf_get_fg(); back = conf_get_bg(); GdkColor *palette = conf_get_color_palette(); if (palette == NULL) vte_terminal_set_colors(VTE_TERMINAL(term), &fore, &back, NULL, 0); else vte_terminal_set_colors(VTE_TERMINAL(term), &fore, &back, palette, 16); vte_terminal_set_background_tint_color(VTE_TERMINAL(term), &back); vte_terminal_set_allow_bold(VTE_TERMINAL(term), conf_get_allow_bold()); vte_terminal_set_scroll_on_output(VTE_TERMINAL(term), conf_get_scroll_on_output()); vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(term), TRUE); vte_terminal_set_font_from_string(VTE_TERMINAL(term), conf_get_font()); vte_terminal_set_scrollback_lines(VTE_TERMINAL(term), conf_get_lines()); vte_terminal_set_backspace_binding(VTE_TERMINAL(term), VTE_ERASE_ASCII_DELETE); vte_terminal_set_audible_bell (VTE_TERMINAL(term), conf_get_bell()); vte_terminal_set_cursor_blink_mode(VTE_TERMINAL(term), conf_get_cursor_blink()); vte_terminal_set_cursor_shape(VTE_TERMINAL(term), conf_get_cursor_shape()); term_connect_signals(term); return term; }
static pid_t terminal_execute (TerminalPlugin *term_plugin, const gchar *directory, const gchar *command, gchar **environment) { char **args, **args_ptr; GList *args_list, *args_list_ptr; gchar *dir; VteTerminal *term; pid_t pid; g_return_val_if_fail (command != NULL, 0); /* Prepare command args */ args_list = anjuta_util_parse_args_from_string (command); args = g_new (char*, g_list_length (args_list) + 1); args_list_ptr = args_list; args_ptr = args; while (args_list_ptr) { *args_ptr = (char*) args_list_ptr->data; args_list_ptr = g_list_next (args_list_ptr); args_ptr++; } *args_ptr = NULL; if (directory == NULL) dir = g_path_get_dirname (args[0]); else dir = g_strdup (directory); term = VTE_TERMINAL (term_plugin->term); /* vte_terminal_reset (term, TRUE, TRUE); */ pid = vte_terminal_fork_command (term, args[0], args, environment, dir, term_plugin->lastlog, term_plugin->update_records, term_plugin->update_records); /* vte_terminal_form_command return -1 if there is an error */ if (pid > 0) { gboolean focus; term_plugin->child_pid = pid; /* Display terminal widget */ focus = gtk_widget_is_focus (term_plugin->shell); gtk_container_remove (GTK_CONTAINER (term_plugin->frame), term_plugin->shell_box); gtk_container_add (GTK_CONTAINER (term_plugin->frame), term_plugin->term_box); gtk_widget_show_all (term_plugin->term_box); if (focus) gtk_widget_grab_focus (term_plugin->term); if (term_plugin->widget_added_to_shell) anjuta_shell_present_widget (ANJUTA_PLUGIN (term_plugin)->shell, term_plugin->frame, NULL); } g_free (dir); g_free (args); g_list_foreach (args_list, (GFunc)g_free, NULL); g_list_free (args_list); return pid; }
int main(int argc, char **argv){ GtkWidget *box_buttons; GtkWidget* button_new; GtkWidget* button_rem; GtkWidget* button_switch; GtkWidget* button_settings; gtk_init(&argc, &argv); window_main = gtk_window_new(GTK_WINDOW_TOPLEVEL); box_main = gtk_vbox_new (FALSE, 0); box_buttons = gtk_hbox_new (FALSE, 0); box_vte = gtk_vbox_new (FALSE, 0); button_new = gtk_button_new_with_label ("new terminal"); button_rem = gtk_button_new_with_label ("remove terminal"); button_switch = gtk_button_new_with_label ("switch >>"); button_settings = gtk_button_new_with_label ("settings"); list = (struct v*)malloc(sizeof(struct v)); list -> next = list; list -> prev = list; st = list; st -> vte = vte_terminal_new(); vte_terminal_fork_command(VTE_TERMINAL(st -> vte), "bash", NULL, NULL, ".", FALSE, FALSE, FALSE); vte_terminal_set_size(VTE_TERMINAL(st -> vte), 80,20); gtk_signal_connect (GTK_OBJECT (button_new), "clicked", GTK_SIGNAL_FUNC (add_vte), NULL); gtk_box_pack_start (GTK_BOX (box_buttons), button_new, TRUE, FALSE, 5); gtk_widget_show (button_new); gtk_signal_connect (GTK_OBJECT (button_rem), "clicked", GTK_SIGNAL_FUNC (remove_vte), NULL); gtk_box_pack_start (GTK_BOX (box_buttons), button_rem, TRUE, FALSE, 5); gtk_widget_show (button_rem); gtk_signal_connect (GTK_OBJECT (button_switch), "clicked", GTK_SIGNAL_FUNC (switch_vte), NULL); gtk_box_pack_start (GTK_BOX (box_buttons), button_switch, TRUE, FALSE, 5); gtk_widget_show (button_switch); gtk_signal_connect (GTK_OBJECT (button_settings), "clicked", GTK_SIGNAL_FUNC (settings), NULL); gtk_box_pack_start (GTK_BOX (box_buttons), button_settings, TRUE, FALSE, 5); gtk_widget_show (button_settings); gtk_box_pack_start (GTK_BOX (box_vte), st -> vte, FALSE, TRUE, 5); gtk_widget_show (st -> vte); gtk_box_pack_start(GTK_BOX (box_main), box_buttons, FALSE, TRUE, 5); gtk_box_pack_start(GTK_BOX (box_main), box_vte, FALSE, TRUE, 5); gtk_container_add(GTK_CONTAINER (window_main), box_main); gtk_widget_show(box_main); gtk_widget_show(box_buttons); gtk_widget_show(box_vte); gtk_widget_show(window_main); read_config(); gtk_main(); return 0; }
int main (int argc, char *argv[]) { GtkWidget *window, *terminal, *scrollbar, *design; GError *icon_error = NULL; GdkPixbuf *icon; GdkGeometry geo_hints; /* Init gtk and all widgets */ gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); terminal = vte_terminal_new (); scrollbar = gtk_vscrollbar_new (VTE_TERMINAL (terminal)->adjustment); design = gtk_hbox_new (FALSE, 0); /* Set window icon */ icon = gdk_pixbuf_new_from_file (TINYTERM_ICON_PATH, &icon_error); if (!icon) { fprintf (stderr, "%s\n", icon_error->message); g_error_free (icon_error); } gtk_window_set_icon (GTK_WINDOW (window), icon); /* Set window title */ gtk_window_set_title (GTK_WINDOW (window), "TinyTerm"); /* Set scrollback lines */ vte_terminal_set_scrollback_lines (VTE_TERMINAL (terminal), TINYTERM_SCROLLBACK_LINES); /* Apply geometry hints to handle terminal resizing */ geo_hints.base_width = VTE_TERMINAL (terminal)->char_width; geo_hints.base_height = VTE_TERMINAL (terminal)->char_height; geo_hints.min_width = VTE_TERMINAL (terminal)->char_width; geo_hints.min_height = VTE_TERMINAL (terminal)->char_height; geo_hints.width_inc = VTE_TERMINAL (terminal)->char_width; geo_hints.height_inc = VTE_TERMINAL (terminal)->char_height; gtk_window_set_geometry_hints (GTK_WINDOW (window), terminal, &geo_hints, GDK_HINT_RESIZE_INC | GDK_HINT_MIN_SIZE | GDK_HINT_BASE_SIZE); /* Open a standard shell */ vte_terminal_fork_command (VTE_TERMINAL (terminal), NULL, // binary to run (NULL=user's shell) NULL, // arguments NULL, // environment NULL, // dir to start (NULL=CWD) TRUE, // log session to lastlog TRUE, // log session to utmp/utmpx log TRUE); // log session to wtmp/wtmpx log /* Connect signals */ g_signal_connect (window, "delete-event", gtk_main_quit, NULL); g_signal_connect (terminal, "child-exited", gtk_main_quit, NULL); g_signal_connect (terminal, "key-press-event", G_CALLBACK (on_key_press), NULL); /* Set selection behavior for double-clicks */ vte_terminal_set_word_chars (VTE_TERMINAL (terminal), TINYTERM_WORD_CHARS); /* Put all widgets together and show the result */ gtk_box_pack_start (GTK_BOX (design), terminal, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (design), scrollbar, FALSE, FALSE, 0); gtk_container_add (GTK_CONTAINER (window), design); gtk_widget_show_all (window); gtk_main (); return 0; }
/** * Guest invocation callback */ static pid_t invoke(void *vte, guest_t *guest, char *args[], int argc) { return vte_terminal_fork_command(VTE_TERMINAL(vte), args[0], args, NULL, NULL, FALSE, FALSE, FALSE); }
void termit_append_tab_with_details(const struct TabInfo* ti) { struct TermitTab* pTab = g_malloc0(sizeof(struct TermitTab)); termit_style_copy(&pTab->style, &configs.style); if (ti->name) { pTab->tab_name = gtk_label_new(ti->name); pTab->custom_tab_name = TRUE; } else { gchar* label_text = g_strdup_printf("%s %d", configs.default_tab_name, termit.tab_max_number++); pTab->tab_name = gtk_label_new(label_text); g_free(label_text); pTab->custom_tab_name = FALSE; } pTab->encoding = (ti->encoding) ? g_strdup(ti->encoding) : g_strdup(configs.default_encoding); pTab->bksp_binding = ti->bksp_binding; pTab->delete_binding = ti->delete_binding; pTab->hbox = gtk_hbox_new(FALSE, 0); pTab->vte = vte_terminal_new(); vte_terminal_set_scrollback_lines(VTE_TERMINAL(pTab->vte), configs.scrollback_lines); if (configs.default_word_chars) vte_terminal_set_word_chars(VTE_TERMINAL(pTab->vte), configs.default_word_chars); vte_terminal_set_mouse_autohide(VTE_TERMINAL(pTab->vte), TRUE); vte_terminal_set_backspace_binding(VTE_TERMINAL(pTab->vte), pTab->bksp_binding); vte_terminal_set_delete_binding(VTE_TERMINAL(pTab->vte), pTab->delete_binding); #ifdef TERMIT_ENABLE_SEARCH vte_terminal_search_set_wrap_around(VTE_TERMINAL(pTab->vte), TRUE); #endif // TERMIT_ENABLE_SEARCH /* parse command */ gchar **cmd_argv; GError *cmd_err = NULL; gchar *cmd_path = NULL; gchar *cmd_file = NULL; pTab->command = (ti->command) ? g_strdup(ti->command) : g_strdup(configs.default_command); if (!g_shell_parse_argv(pTab->command, NULL, &cmd_argv, &cmd_err)) { ERROR("%s", _("Cannot parse command. Creating tab with shell")); g_error_free(cmd_err); } else { cmd_path = g_find_program_in_path(cmd_argv[0]); cmd_file = g_path_get_basename(cmd_argv[0]); } TRACE("command=%s cmd_path=%s cmd_file=%s", pTab->command, cmd_path, cmd_file); if (cmd_path && cmd_file) { g_free(cmd_argv[0]); cmd_argv[0] = g_strdup(cmd_path); #if VTE_CHECK_VERSION(0, 26, 0) > 0 if (vte_terminal_fork_command_full(VTE_TERMINAL(pTab->vte), VTE_PTY_DEFAULT, ti->working_dir, cmd_argv, NULL, 0, NULL, NULL, &pTab->pid, &cmd_err) != TRUE) { ERROR("failed to open tab: %s", cmd_err->message); g_error_free(cmd_err); } #else pTab->pid = vte_terminal_fork_command(VTE_TERMINAL(pTab->vte), cmd_path, cmd_argv, NULL, ti->working_dir, TRUE, TRUE, TRUE); #endif // version >= 0.26 } else { g_free(pTab->command); pTab->command = g_strdup(configs.default_command); gchar* argv[] = {pTab->command, NULL}; TRACE("defaults: cmd=%s working_dir=%s", pTab->command, ti->working_dir); /* default tab */ #if VTE_CHECK_VERSION(0, 26, 0) > 0 if (vte_terminal_fork_command_full(VTE_TERMINAL(pTab->vte), VTE_PTY_DEFAULT, ti->working_dir, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &pTab->pid, &cmd_err) != TRUE) { ERROR("failed to open tab: %s", cmd_err->message); g_error_free(cmd_err); } #else pTab->pid = vte_terminal_fork_command(VTE_TERMINAL(pTab->vte), pTab->command, NULL, NULL, ti->working_dir, TRUE, TRUE, TRUE); #endif // version >= 0.26 } g_strfreev(cmd_argv); g_free(cmd_path); g_free(cmd_file); g_signal_connect(G_OBJECT(pTab->vte), "beep", G_CALLBACK(termit_on_beep), pTab); g_signal_connect(G_OBJECT(pTab->vte), "focus-in-event", G_CALLBACK(termit_on_focus), pTab); g_signal_connect(G_OBJECT(pTab->vte), "window-title-changed", G_CALLBACK(termit_on_tab_title_changed), NULL); g_signal_connect(G_OBJECT(pTab->vte), "child-exited", G_CALLBACK(termit_on_child_exited), NULL); // g_signal_connect(G_OBJECT(pTab->vte), "eof", G_CALLBACK(termit_eof), NULL); g_signal_connect_swapped(G_OBJECT(pTab->vte), "button-press-event", G_CALLBACK(termit_on_popup), NULL); vte_terminal_set_encoding(VTE_TERMINAL(pTab->vte), pTab->encoding); pTab->matches = g_array_new(FALSE, TRUE, sizeof(struct Match)); termit_tab_add_matches(pTab, configs.matches); termit_tab_set_transparency(pTab, pTab->style.transparency); vte_terminal_set_font(VTE_TERMINAL(pTab->vte), pTab->style.font); gint index = gtk_notebook_append_page(GTK_NOTEBOOK(termit.notebook), pTab->hbox, pTab->tab_name); if (index == -1) { ERROR("%s", _("Cannot create a new tab")); return; } if (configs.fill_tabbar) { GValue val = {}; g_value_init(&val, G_TYPE_BOOLEAN); g_value_set_boolean(&val, TRUE); gtk_container_child_set_property(GTK_CONTAINER(termit.notebook), pTab->hbox, "tab-expand", &val); gtk_container_child_set_property(GTK_CONTAINER(termit.notebook), pTab->hbox, "tab-fill", &val); } termit_tab_set_audible_bell(pTab, configs.audible_bell); termit_tab_set_visible_bell(pTab, configs.visible_bell); pTab->scrollbar = gtk_vscrollbar_new(vte_terminal_get_adjustment(VTE_TERMINAL(pTab->vte))); gtk_box_pack_start(GTK_BOX(pTab->hbox), pTab->vte, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(pTab->hbox), pTab->scrollbar, FALSE, FALSE, 0); GtkWidget* tabWidget = gtk_notebook_get_nth_page(GTK_NOTEBOOK(termit.notebook), index); if (!tabWidget) { ERROR("tabWidget is NULL"); return; } g_object_set_data(G_OBJECT(tabWidget), TERMIT_TAB_DATA, pTab); if (index == 0) { // there is no "switch-page" signal on the first page termit_set_statusbar_message(index); } pTab->scrollbar_is_shown = configs.show_scrollbar; gtk_widget_show_all(termit.notebook); if (pTab->style.image_file == NULL) { vte_terminal_set_background_image(VTE_TERMINAL(pTab->vte), NULL); } else { vte_terminal_set_background_image_file(VTE_TERMINAL(pTab->vte), pTab->style.image_file); } termit_tab_apply_colors(pTab); gtk_notebook_set_current_page(GTK_NOTEBOOK(termit.notebook), index); gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(termit.notebook), pTab->hbox, TRUE); gtk_window_set_focus(GTK_WINDOW(termit.main_window), pTab->vte); termit_check_single_tab(); termit_hide_scrollbars(); }