2005-06-23 13:18:45 -07:00
|
|
|
/*
|
|
|
|
* tests/markup.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004-2005 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* See COPYING file that comes with this distribution.
|
|
|
|
*/
|
2005-06-22 11:20:32 -07:00
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#define MOOTERM_COMPILATION
|
2005-06-23 06:50:25 -07:00
|
|
|
#include "mooterm/mooterm.h"
|
2005-06-22 11:20:32 -07:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2005-06-23 13:18:45 -07:00
|
|
|
|
2005-06-22 15:13:12 -07:00
|
|
|
int main (int argc, char *argv[])
|
2005-06-22 11:20:32 -07:00
|
|
|
{
|
2005-07-01 02:53:39 -07:00
|
|
|
const char *cmd = NULL;
|
2005-06-23 13:18:45 -07:00
|
|
|
GtkWidget *win, *swin, *term;
|
|
|
|
MooTermBuffer *buf;
|
|
|
|
|
|
|
|
gtk_init (&argc, &argv);
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2005-06-22 15:13:12 -07:00
|
|
|
if (argc > 1)
|
2005-06-22 11:20:32 -07:00
|
|
|
{
|
2005-07-01 02:53:39 -07:00
|
|
|
cmd = argv[1];
|
2005-06-22 15:13:12 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-07-01 02:53:39 -07:00
|
|
|
cmd = g_getenv ("SHELL");
|
|
|
|
if (!cmd)
|
|
|
|
cmd = "sh";
|
2005-06-22 11:20:32 -07:00
|
|
|
}
|
|
|
|
|
2005-06-23 13:18:45 -07:00
|
|
|
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
2005-07-04 12:22:02 -07:00
|
|
|
gtk_window_set_default_size (GTK_WINDOW (win), 700, 500);
|
2005-06-23 13:18:45 -07:00
|
|
|
swin = gtk_scrolled_window_new (NULL, NULL);
|
2005-06-22 11:20:32 -07:00
|
|
|
gtk_container_add (GTK_CONTAINER (win), swin);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin),
|
|
|
|
GTK_POLICY_NEVER,
|
|
|
|
GTK_POLICY_AUTOMATIC);
|
|
|
|
|
2005-06-23 13:18:45 -07:00
|
|
|
term = GTK_WIDGET (g_object_new (MOO_TYPE_TERM, NULL));
|
2005-06-22 11:20:32 -07:00
|
|
|
gtk_container_add (GTK_CONTAINER (swin), term);
|
|
|
|
|
|
|
|
gtk_widget_show_all (win);
|
|
|
|
|
2005-06-23 13:18:45 -07:00
|
|
|
buf = moo_term_get_buffer (MOO_TERM (term));
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2005-07-01 03:26:55 -07:00
|
|
|
g_signal_connect_swapped (buf, "set-window-title",
|
|
|
|
G_CALLBACK (gtk_window_set_title), win);
|
|
|
|
|
2005-06-22 15:13:12 -07:00
|
|
|
moo_term_fork_command (MOO_TERM (term), cmd, NULL, NULL);
|
2005-06-22 11:20:32 -07:00
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (win), "destroy", gtk_main_quit, NULL);
|
|
|
|
gtk_main ();
|
|
|
|
}
|