2005-06-23 20:18:45 +00: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 18:20:32 +00:00
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#define MOOTERM_COMPILATION
|
2005-07-11 02:54:58 +00:00
|
|
|
#include "mooterm/mooterm-private.h"
|
|
|
|
#include "mooterm/mootermbuffer-private.h"
|
2005-06-22 18:20:32 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2005-06-23 20:18:45 +00:00
|
|
|
|
2005-06-22 22:13:12 +00:00
|
|
|
int main (int argc, char *argv[])
|
2005-06-22 18:20:32 +00:00
|
|
|
{
|
2005-07-01 09:53:39 +00:00
|
|
|
const char *cmd = NULL;
|
2005-06-23 20:18:45 +00:00
|
|
|
GtkWidget *win, *swin, *term;
|
2005-07-11 02:54:58 +00:00
|
|
|
gboolean debug = FALSE;
|
2005-06-23 20:18:45 +00:00
|
|
|
|
|
|
|
gtk_init (&argc, &argv);
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2005-06-22 22:13:12 +00:00
|
|
|
if (argc > 1)
|
2005-06-22 18:20:32 +00:00
|
|
|
{
|
2005-07-11 02:54:58 +00:00
|
|
|
if (!strcmp (argv[1], "--debug"))
|
|
|
|
{
|
|
|
|
debug = TRUE;
|
|
|
|
if (argc > 2)
|
|
|
|
cmd = argv[2];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cmd = argv[1];
|
|
|
|
}
|
2005-06-22 22:13:12 +00:00
|
|
|
}
|
2005-07-11 02:54:58 +00:00
|
|
|
|
|
|
|
if (!cmd)
|
2005-06-22 22:13:12 +00:00
|
|
|
{
|
2005-07-01 09:53:39 +00:00
|
|
|
cmd = g_getenv ("SHELL");
|
|
|
|
if (!cmd)
|
|
|
|
cmd = "sh";
|
2005-06-22 18:20:32 +00:00
|
|
|
}
|
|
|
|
|
2005-07-11 02:54:58 +00:00
|
|
|
if (debug)
|
|
|
|
{
|
|
|
|
gdk_window_set_debug_updates (TRUE);
|
|
|
|
}
|
|
|
|
|
2005-06-23 20:18:45 +00:00
|
|
|
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
2005-07-04 19:22:02 +00:00
|
|
|
gtk_window_set_default_size (GTK_WINDOW (win), 700, 500);
|
2005-06-23 20:18:45 +00:00
|
|
|
swin = gtk_scrolled_window_new (NULL, NULL);
|
2005-06-22 18:20:32 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (win), swin);
|
|
|
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin),
|
|
|
|
GTK_POLICY_NEVER,
|
2005-07-11 02:54:58 +00:00
|
|
|
// GTK_POLICY_NEVER);
|
|
|
|
// GTK_POLICY_AUTOMATIC);
|
|
|
|
GTK_POLICY_ALWAYS);
|
2005-06-22 18:20:32 +00:00
|
|
|
|
2005-06-23 20:18:45 +00:00
|
|
|
term = GTK_WIDGET (g_object_new (MOO_TYPE_TERM, NULL));
|
2005-06-22 18:20:32 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (swin), term);
|
|
|
|
|
|
|
|
gtk_widget_show_all (win);
|
|
|
|
|
2005-07-11 02:54:58 +00:00
|
|
|
g_signal_connect_swapped (term, "set-window-title",
|
2005-07-01 10:26:55 +00:00
|
|
|
G_CALLBACK (gtk_window_set_title), win);
|
2005-07-11 02:54:58 +00:00
|
|
|
g_signal_connect_swapped (term, "set-icon-name",
|
|
|
|
G_CALLBACK (gdk_window_set_icon_name), win->window);
|
2005-07-01 10:26:55 +00:00
|
|
|
|
2005-06-22 22:13:12 +00:00
|
|
|
moo_term_fork_command (MOO_TERM (term), cmd, NULL, NULL);
|
2005-06-22 18:20:32 +00:00
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (win), "destroy", gtk_main_quit, NULL);
|
|
|
|
gtk_main ();
|
|
|
|
}
|