ocarina: Reenable the named pipe
I eventually want to use a unix socket so I can get bidirectional access. For now, I'll just reuse the old code. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
42c6bdff0e
commit
3df9d153f6
|
@ -143,6 +143,7 @@ static void init(int argc, char **argv)
|
|||
init_tabs();
|
||||
init_playlist();
|
||||
init_status();
|
||||
init_pipe();
|
||||
|
||||
/* Connect signals */
|
||||
connect_signal("PlayButton", "clicked", libsaria::audio::play, NULL);
|
||||
|
@ -152,7 +153,6 @@ static void init(int argc, char **argv)
|
|||
connect_signal("NextButton", "clicked", libsaria::deck::next, NULL);
|
||||
|
||||
/* Show any widgets that need showing */
|
||||
/* ocarina::init_pipe();*/
|
||||
gtk_timeout_add(250, timeout_poll, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,9 @@ GtkWidget *get_widget(const string &);
|
|||
void connect_signal(const string &, const string &, GCallback, void *);
|
||||
string run_chooser(const string &);
|
||||
|
||||
/* pipe.cpp */
|
||||
void init_pipe();
|
||||
|
||||
/* playlist.cpp */
|
||||
void update_playlist(notify_t, libsaria::PlaylistNotification *);
|
||||
bool playlist_key_pressed(GtkTreeView *treeview, string &);
|
||||
|
@ -77,11 +80,4 @@ void update_tabs(notify_t, libsaria::Playlist *);
|
|||
/* window.cpp */
|
||||
void init_window();
|
||||
|
||||
namespace ocarina
|
||||
{
|
||||
|
||||
void init_pipe();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -9,7 +9,7 @@ using namespace std;
|
|||
|
||||
static GIOChannel *pipe_in;
|
||||
|
||||
void pipe_read_text(GIOChannel *source, string &text)
|
||||
static void pipe_read_text(GIOChannel *source, string &text)
|
||||
{
|
||||
gchar *str = NULL;
|
||||
GError *error = NULL;
|
||||
|
@ -25,7 +25,7 @@ void pipe_read_text(GIOChannel *source, string &text)
|
|||
g_free(str);
|
||||
}
|
||||
|
||||
gboolean pipe_read(GIOChannel *source, GIOCondition condition, gpointer data)
|
||||
static gboolean pipe_read(GIOChannel *source, GIOCondition condition, gpointer data)
|
||||
{
|
||||
string text;
|
||||
pipe_read_text(source, text);
|
||||
|
@ -33,18 +33,15 @@ gboolean pipe_read(GIOChannel *source, GIOCondition condition, gpointer data)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
namespace ocarina
|
||||
void init_pipe()
|
||||
{
|
||||
void init_pipe()
|
||||
{
|
||||
GError *error = NULL;
|
||||
string pipe = libsaria::app::pipe_file();
|
||||
if (pipe == "")
|
||||
return;
|
||||
GError *error = NULL;
|
||||
string pipe = libsaria::app::pipe_file();
|
||||
if (pipe == "")
|
||||
return;
|
||||
|
||||
pipe_in = g_io_channel_new_file(pipe.c_str(), "r+", &error);
|
||||
if (!pipe_in)
|
||||
return;
|
||||
g_io_add_watch(pipe_in, G_IO_IN, pipe_read, NULL);
|
||||
}
|
||||
pipe_in = g_io_channel_new_file(pipe.c_str(), "r+", &error);
|
||||
if (!pipe_in)
|
||||
return;
|
||||
g_io_add_watch(pipe_in, G_IO_IN, pipe_read, NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue