Exemple #1
0
static VALUE
rg_initialize(VALUE self, VALUE flags_or_fd)
{
    VtePty *pty = NULL;
    GError *error = NULL;

    if (TYPE(flags_or_fd) == T_FIXNUM) {
        pty = vte_pty_new_foreign(NUM2INT(flags_or_fd), &error);
    } else {
        pty = vte_pty_new(RVAL2VTEPTYFLAGS(flags_or_fd), &error);
    }
    if (error)
        RAISE_GERROR(error);

    G_INITIALIZE(self, pty);

    return Qnil;
}
Exemple #2
0
static int window_create_show()
{
    char *tmp;

    // window
    m_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    tmp = get_res_path(ICON_APP);
    gtk_window_set_icon_from_file(GTK_WINDOW(m_window), tmp, NULL);
    free(tmp);
    gtk_window_set_title(GTK_WINDOW(m_window), "jnXssh");
    gtk_window_maximize(GTK_WINDOW(m_window));
    gtk_widget_set_events(m_window, GDK_BUTTON_PRESS_MASK|GDK_KEY_PRESS_MASK);
    g_signal_connect(G_OBJECT(m_window), "key-press-event", G_CALLBACK(on_window_key_press), NULL);
    g_signal_connect(G_OBJECT(m_window), "destroy", G_CALLBACK (gtk_main_quit), NULL);
    
        // vbox
        GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
        gtk_container_add(GTK_CONTAINER(m_window), vbox);

            // notebook
            GtkWidget *notebook = page_get_notebook();
            gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);

            // pty + vte
            GtkWidget *vte = vte_terminal_new();
            gtk_box_pack_start(GTK_BOX(vbox), vte, FALSE, FALSE, 1);
            vte_terminal_set_size((VteTerminal*)vte, 1, 1);
            VtePty *pty = vte_pty_new(VTE_PTY_DEFAULT, NULL); 
            vte_terminal_set_pty_object((VteTerminal*)vte, pty);
            pthread_t tid;
            pthread_create(&tid, NULL, proc_allvte, pty);

    gtk_widget_show_all(m_window);

    return 0;
}