Input pipe api for ggap

master
Yevgen Muntyan 2007-07-13 03:42:31 -05:00
parent 2ad1088945
commit 13c91d518f
6 changed files with 52 additions and 10 deletions

View File

@ -87,4 +87,8 @@ AC_DEFUN_ONCE([MOO_AC_FLAGS],[
AC_SUBST(MOO_XML2H)
AC_SUBST(MOO_GLADE_SUBDIR_RULE)
AC_SUBST(MOO_GLADE_RULE)
if test "x$MOO_USE_PIPE_INPUT" = "xyes"; then
AC_DEFINE(MOO_USE_PIPE_INPUT, 1, [use fifo for input])
fi
])

View File

@ -1,12 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<medit-project version="1.0" type="C" name="moo">
<active>debug</active>
<commands>
<compile>
<cmd>$(make) $(base).lo</cmd>
<working_dir>$(builddir)</working_dir>
</compile>
</commands>
<configurations>
<debug>
<build_dir>build/debug</build_dir>

View File

@ -909,6 +909,12 @@ start_input (MooApp *app)
TRUE);
}
const char *
moo_app_get_input_pipe_name (void)
{
return moo_app_input ? _moo_app_input_get_path (moo_app_input) : NULL;
}
gboolean
moo_app_send_msg (MooApp *app,

View File

@ -123,6 +123,8 @@ void moo_app_open_files (MooApp *app,
void moo_app_reload_python_plugins (void);
const char *moo_app_get_input_pipe_name (void);
G_END_DECLS

View File

@ -66,12 +66,14 @@ struct _MooAppInput
{
GSList *pipes;
char *appname;
char *main_path;
};
static InputChannel *input_channel_new (const char *appname,
const char *name,
gboolean may_fail);
static void input_channel_free (InputChannel *ch);
static InputChannel *input_channel_new (const char *appname,
const char *name,
gboolean may_fail);
static void input_channel_free (InputChannel *ch);
static char *input_channel_get_path (InputChannel *ch);
MooAppInput *
@ -90,7 +92,10 @@ _moo_app_input_new (const char *appname,
ch->appname = g_strdup (appname);
if ((ich = input_channel_new (appname, _moo_get_pid_string (), FALSE)))
{
ch->pipes = g_slist_prepend (ch->pipes, ich);
ch->main_path = input_channel_get_path (ich);
}
if (name && (ich = input_channel_new (appname, name, FALSE)))
ch->pipes = g_slist_prepend (ch->pipes, ich);
@ -108,11 +113,20 @@ _moo_app_input_free (MooAppInput *ch)
g_slist_foreach (ch->pipes, (GFunc) input_channel_free, NULL);
g_free (ch->main_path);
g_free (ch->appname);
_moo_free (MooAppInput, ch);
}
const char *
_moo_app_input_get_path (MooAppInput *ch)
{
g_return_val_if_fail (ch != NULL, NULL);
return ch->main_path;
}
static void
commit (GString **buffer)
{
@ -354,6 +368,13 @@ struct InputChannel
GSList *connections;
};
static char *
input_channel_get_path (InputChannel *ch)
{
g_return_val_if_fail (ch != NULL, NULL);
return g_strdup (ch->path);
}
static void
connection_free (Connection *conn)
{
@ -630,6 +651,13 @@ struct InputChannel
GSList *connections;
};
static char *
input_channel_get_path (InputChannel *ch)
{
g_return_val_if_fail (ch != NULL, NULL);
return g_strdup (ch->path);
}
static void
input_channel_shutdown (InputChannel *ch)
{
@ -976,6 +1004,13 @@ struct InputChannel
guint event_id;
};
static char *
input_channel_get_path (InputChannel *ch)
{
g_return_val_if_fail (ch != NULL, NULL);
return g_strdup (ch->pipe_name);
}
static ListenerInfo *
listener_info_new (const char *pipe_name,
guint event_id)

View File

@ -79,6 +79,7 @@ gboolean _moo_app_input_send_msg (const char *appname,
const char *name,
const char *data,
gssize len);
const char *_moo_app_input_get_path (MooAppInput *ch);
G_END_DECLS