Hardcode ui xml in the editor

master
Yevgen Muntyan 2005-08-01 23:09:31 +00:00
parent 7986e586d8
commit 3e6c7acf9b
4 changed files with 32 additions and 32 deletions

View File

@ -452,7 +452,7 @@ static void filter_entry_activated (GtkEntry *entry,
GtkFileChooser *dialog)
{
const char *text;
Filter *filter;
Filter *filter = NULL;
MooEditFileMgr *mgr;
mgr = g_object_get_data (G_OBJECT (dialog), "file-mgr");

View File

@ -1019,7 +1019,7 @@ gboolean moo_prefs_save (const char *file)
gboolean empty;
GError *err = NULL;
char *text;
gboolean result;
gboolean result = TRUE;
g_return_val_if_fail (file != NULL, FALSE);
@ -1035,31 +1035,28 @@ gboolean moo_prefs_save (const char *file)
empty = FALSE;
if (empty)
{
if (g_file_test (file, G_FILE_TEST_EXISTS))
if (moo_unlink (file))
g_critical ("%s: %s", G_STRLOC,
g_strerror (errno));
return TRUE;
}
text = format_xml (xml);
g_return_val_if_fail (text != NULL, FALSE);
if (text)
{
result = moo_save_file_utf8 (file, text, -1, &err);
if (!result)
{
g_critical ("%s: could not save preferences to '%s'",
G_STRLOC, file);
}
if (err)
{
g_critical ("%s: %s", G_STRLOC, err->message);
g_error_free (err);
}
}
else if (moo_unlink (file))
{
g_critical ("%s: %s", G_STRLOC,
g_strerror (errno));
}
g_free (text);
return result;

View File

@ -3,13 +3,22 @@
#
EXTRA_PROGRAMS = medit mterm markup editor termbuffer
bin_PROGRAMS =
noinst_PROGRAMS =
EXTRA_DIST = pyapp.py.in
EXTRA_DIST = \
pyapp.py.in \
meditui.xml \
editor-ui.xml
BUILT_SOURCES = editor-ui.h
editor-ui.h: editor-ui.xml
sh $(srcdir)/../moo/mooutils/xml2h.sh MEDIT_UI $(srcdir)/editor-ui.xml > editor-ui.h
all-am: pyapp.py
if BUILD_MOOAPP
noinst_PROGRAMS += editor
bin_PROGRAMS += editor
endif
if BUILD_MOOEDIT
noinst_PROGRAMS += medit
@ -46,7 +55,9 @@ if MINGW_BUILD
editor_LDFLAGS += -mwindows
endif MINGW_BUILD
editor_SOURCES = editor.c
editor_SOURCES = \
editor.c \
editor-ui.h
##############################################################################

View File

@ -14,14 +14,13 @@
#line 14 "@srcdir@/editor.c.in"
#include "mooapp/mooapp.h"
#include "mooui/moouiobject.h"
#include "editor-ui.h"
static void init_terminal (void);
static void init_editor (void);
int main (int argc, char *argv[])
{
const char *file = "@srcdir@/editor-ui.xml";
MooApp *app;
MooUIXML *xml;
MooEditor *editor;
@ -42,16 +41,9 @@ int main (int argc, char *argv[])
"description", "MEdit is a text editor",
NULL));
if (!g_file_test (file, G_FILE_TEST_EXISTS))
{
file = "editor-ui.xml";
if (!g_file_test (file, G_FILE_TEST_EXISTS))
g_error ("could not find editor-ui.xml");
}
xml = moo_app_get_ui_xml (app);
if (!moo_ui_xml_add_ui_from_file (xml, file, NULL))
if (!moo_ui_xml_add_ui_from_string (xml, MEDIT_UI, -1, NULL))
g_error ("%s", G_STRLOC);
moo_app_init (app);