Exemple #1
0
static void
on_open_shell_complete (GObject           *src,
			GAsyncResult      *res,
			gpointer           user_data)
{
  HotSshTab *self = user_data;
  HotSshTabPrivate *priv = hotssh_tab_get_instance_private (self);
  GError *local_error = NULL;
  GInputStream *istream;

  g_debug ("open shell complete");

  priv->channel = gssh_connection_open_shell_finish ((GSshConnection*)src,
						       res, &local_error);
  if (!priv->channel)
    goto out;

  page_transition (self, HOTSSH_TAB_PAGE_TERMINAL);

  istream = g_io_stream_get_input_stream ((GIOStream*)priv->channel);

  g_input_stream_read_bytes_async (istream, 8192, G_PRIORITY_DEFAULT,
				   priv->cancellable, on_istream_read_complete, self);
  
 out:
  if (local_error)
    page_transition_take_error (self, local_error);
}
Exemple #2
0
static void
on_istream_read_complete (GObject           *src,
			  GAsyncResult      *res,
			  gpointer           user_data)
{
  HotSshTab *self = user_data;
  HotSshTabPrivate *priv = hotssh_tab_get_instance_private (self);
  gs_unref_bytes GBytes *result = NULL;
  GError *local_error = NULL;
  const guint8 *buf;
  gsize len;

  result = g_input_stream_read_bytes_finish ((GInputStream*)src, res, &local_error);
  if (!result)
    goto out;

  buf = g_bytes_get_data (result, &len);
  g_debug ("read %u bytes", (guint)len);
  
  vte_terminal_feed ((VteTerminal*)priv->terminal, (char*)buf, len);

  g_input_stream_read_bytes_async ((GInputStream*)src, 8192, G_PRIORITY_DEFAULT,
				   priv->cancellable, on_istream_read_complete, self);

 out:
  if (local_error)
    page_transition_take_error (self, local_error);
}
Exemple #3
0
static void
selection_buffer_read (SelectionBuffer *buffer)
{
  selection_buffer_ref (buffer);
  g_input_stream_read_bytes_async (buffer->stream, 1000, G_PRIORITY_DEFAULT,
                                   buffer->cancellable, selection_buffer_read_cb,
                                   buffer);
}
static void
gum_duk_debug_session_read_next_chunk (GumDukDebugSession * self)
{
  g_input_stream_read_bytes_async (self->input,
      GUM_DUK_DEBUG_BUFFER_SIZE,
      G_PRIORITY_DEFAULT,
      self->cancellable,
      (GAsyncReadyCallback) gum_duk_debug_session_on_read_ready,
      self);
}