medit/tests/medit.cpp.in

46 lines
1.5 KiB
C++
Raw Normal View History

2005-06-22 18:20:32 +00:00
//
// tests/medit.cpp.in
//
// 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.
//
#include "mooedit/mooeditor.h"
#include "mooedit/mooeditlangmgr.h"
#include "mooui/moouiobject.h"
int main (int argc, char **argv)
{
gtk_init (&argc, &argv);
char *rcfile = g_build_filename (g_get_home_dir (), ".meditrc", NULL);
moo_prefs_load (rcfile);
MooEditor *editor = moo_editor_new ();
MooEditLangMgr *mgr = moo_editor_get_lang_mgr (editor);
moo_edit_lang_mgr_add_lang_files_dir (mgr, "/usr/share/gtksourceview-1.0/language-specs");
moo_edit_lang_mgr_add_lang_files_dir (mgr, "@MOO_EDIT_LANG_FILES_DIR@");
g_signal_connect (editor, "all-windows-closed", G_CALLBACK (gtk_main_quit), NULL);
MooEditWindow *win = moo_editor_new_window (editor);
MooUIXML *xml = moo_ui_object_get_ui_xml (MOO_UI_OBJECT (win));
if (!moo_ui_xml_add_ui_from_file (xml, "@srcdir@/meditui.xml", NULL))
if (!moo_ui_xml_add_ui_from_file (xml, "meditui.xml", NULL))
g_error ("could not find medui.xml");
if (argc > 1) moo_edit_window_open (MOO_EDIT_WINDOW (win), argv[1], NULL);
gtk_main ();
moo_prefs_save (rcfile);
g_free (rcfile);
}