Esempio n. 1
0
static void fusion_tls_input_stream_class_init (FusionTLSInputStreamClass * klass) {
	fusion_tls_input_stream_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (FusionTLSInputStreamPrivate));
	G_INPUT_STREAM_CLASS (klass)->read_fn = fusion_tls_input_stream_real_read;
	G_INPUT_STREAM_CLASS (klass)->close_fn = fusion_tls_input_stream_real_close;
	G_OBJECT_CLASS (klass)->finalize = fusion_tls_input_stream_finalize;
}
static void
soup_content_sniffer_stream_class_init (SoupContentSnifferStreamClass *sniffer_class)
{
	GObjectClass *object_class = G_OBJECT_CLASS (sniffer_class);
	GInputStreamClass *input_stream_class =
		G_INPUT_STREAM_CLASS (sniffer_class);
 
	g_type_class_add_private (sniffer_class, sizeof (SoupContentSnifferStreamPrivate));

	object_class->finalize = soup_content_sniffer_stream_finalize;
	object_class->set_property = soup_content_sniffer_stream_set_property;
	object_class->get_property = soup_content_sniffer_stream_get_property;

	input_stream_class->read_fn = soup_content_sniffer_stream_read;
	input_stream_class->skip = soup_content_sniffer_stream_skip;

	g_object_class_install_property (
		object_class, PROP_SNIFFER,
		g_param_spec_object ("sniffer",
				     "Sniffer",
				     "The stream's SoupContentSniffer",
				     SOUP_TYPE_CONTENT_SNIFFER,
				     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
	g_object_class_install_property (
		object_class, PROP_MESSAGE,
		g_param_spec_object ("message",
				     "Message",
				     "The stream's SoupMessage",
				     SOUP_TYPE_MESSAGE,
				     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
static void
ostree_chain_input_stream_class_init (OstreeChainInputStreamClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
  
  g_type_class_add_private (klass, sizeof (OstreeChainInputStreamPrivate));

  gobject_class->get_property = ostree_chain_input_stream_get_property;
  gobject_class->set_property = ostree_chain_input_stream_set_property;
  gobject_class->finalize     = ostree_chain_input_stream_finalize;

  stream_class->read_fn = ostree_chain_input_stream_read;
  stream_class->close_fn = ostree_chain_input_stream_close;

  /**
   * OstreeChainInputStream:streams: (element-type GInputStream)
   *
   * Chain of input streams read in order.
   */
  g_object_class_install_property (gobject_class,
				   PROP_STREAMS,
				   g_param_spec_pointer ("streams",
							 "", "",
							 G_PARAM_READWRITE |
							 G_PARAM_CONSTRUCT_ONLY |
							 G_PARAM_STATIC_STRINGS));

}
static void
ostree_libarchive_input_stream_class_init (OstreeLibarchiveInputStreamClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
  
  g_type_class_add_private (klass, sizeof (OstreeLibarchiveInputStreamPrivate));

  gobject_class->get_property = ostree_libarchive_input_stream_get_property;
  gobject_class->set_property = ostree_libarchive_input_stream_set_property;
  gobject_class->finalize = ostree_libarchive_input_stream_finalize;

  stream_class->read_fn = ostree_libarchive_input_stream_read;
  stream_class->close_fn = ostree_libarchive_input_stream_close;

  /**
   * OstreeLibarchiveInputStream:archive:
   *
   * The archive that the stream reads from.
   */
  g_object_class_install_property (gobject_class,
				   PROP_ARCHIVE,
				   g_param_spec_pointer ("archive",
							 "", "",
							 G_PARAM_READWRITE |
							 G_PARAM_CONSTRUCT_ONLY |
							 G_PARAM_STATIC_STRINGS));

}
static void mega_http_input_stream_class_init(MegaHttpInputStreamClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
  GParamSpec *param_spec;

  gobject_class->set_property = mega_http_input_stream_set_property;
  gobject_class->get_property = mega_http_input_stream_get_property;

  gobject_class->dispose = mega_http_input_stream_dispose;
  gobject_class->finalize = mega_http_input_stream_finalize;

  g_type_class_add_private(klass, sizeof(MegaHttpInputStreamPrivate));

  G_INPUT_STREAM_CLASS(klass)->read_fn = stream_read;

  /* object properties */

  param_spec = g_param_spec_object(
    /* name    */ "client",
    /* nick    */ "Client",
    /* blurb   */ "Set/get client",
    /* is_type */ MEGA_TYPE_HTTP_CLIENT,
    /* flags   */ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
  );

  g_object_class_install_property(gobject_class, PROP_CLIENT, param_spec);

  /* object properties end */

  /* object signals */

  /* object signals end */
}
Esempio n. 6
0
static void
g_filter_input_stream_class_init (GFilterInputStreamClass *klass)
{
  GObjectClass *object_class;
  GInputStreamClass *istream_class;

  object_class = G_OBJECT_CLASS (klass);
  object_class->get_property = g_filter_input_stream_get_property;
  object_class->set_property = g_filter_input_stream_set_property;
  object_class->finalize     = g_filter_input_stream_finalize;

  istream_class = G_INPUT_STREAM_CLASS (klass);
  istream_class->read_fn  = g_filter_input_stream_read;
  istream_class->skip  = g_filter_input_stream_skip;
  istream_class->close_fn = g_filter_input_stream_close;

  istream_class->read_async   = g_filter_input_stream_read_async;
  istream_class->read_finish  = g_filter_input_stream_read_finish;
  istream_class->skip_async   = g_filter_input_stream_skip_async;
  istream_class->skip_finish  = g_filter_input_stream_skip_finish;
  istream_class->close_async  = g_filter_input_stream_close_async;
  istream_class->close_finish = g_filter_input_stream_close_finish;

  g_object_class_install_property (object_class,
                                   PROP_BASE_STREAM,
                                   g_param_spec_object ("base-stream",
                                                         P_("The Filter Base Stream"),
                                                         P_("The underlying base stream the io ops will be done on"),
                                                         G_TYPE_INPUT_STREAM,
                                                         G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | 
                                                         G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB));

}
static void
g_filter_input_stream_class_init (GFilterInputStreamClass *klass)
{
  GObjectClass *object_class;
  GInputStreamClass *istream_class;

  object_class = G_OBJECT_CLASS (klass);
  object_class->get_property = g_filter_input_stream_get_property;
  object_class->set_property = g_filter_input_stream_set_property;
  object_class->finalize     = g_filter_input_stream_finalize;

  istream_class = G_INPUT_STREAM_CLASS (klass);
  istream_class->read_fn  = g_filter_input_stream_read;
  istream_class->skip  = g_filter_input_stream_skip;
  istream_class->close_fn = g_filter_input_stream_close;

  g_type_class_add_private (klass, sizeof (GFilterInputStreamPrivate));

  g_object_class_install_property (object_class,
                                   PROP_BASE_STREAM,
                                   g_param_spec_object ("base-stream",
                                                         P_("The Filter Base Stream"),
                                                         P_("The underlying base stream on which the io ops will be done."),
                                                         G_TYPE_INPUT_STREAM,
                                                         G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | 
                                                         G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB));

  g_object_class_install_property (object_class,
                                   PROP_CLOSE_BASE,
                                   g_param_spec_boolean ("close-base-stream",
                                                         P_("Close Base Stream"),
                                                         P_("If the base stream should be closed when the filter stream is closed."),
                                                         TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT |
                                                         G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB));
}
static gboolean
soup_cache_input_stream_close_fn (GInputStream  *stream,
				  GCancellable  *cancellable,
				  GError       **error)
{
	SoupCacheInputStream *istream = SOUP_CACHE_INPUT_STREAM (stream);
	SoupCacheInputStreamPrivate *priv = istream->priv;

	if (!priv->read_finished) {
		if (priv->output_stream) {
			/* Cancel any pending write operation or return an error if none. */
			if (g_output_stream_has_pending (priv->output_stream))
				g_cancellable_cancel (priv->cancellable);
			else {
				GError *notify_error = NULL;
				g_set_error_literal (&notify_error, G_IO_ERROR, G_IO_ERROR_PARTIAL_INPUT,
						     _("Failed to completely cache the resource"));
				notify_and_clear (istream, notify_error);
			}
		} else if (priv->cancellable)
			/* The file_replace_async() hasn't finished yet */
			g_cancellable_cancel (priv->cancellable);
	}

	return G_INPUT_STREAM_CLASS (soup_cache_input_stream_parent_class)->close_fn (stream, cancellable, error);
}
static gssize
soup_content_sniffer_stream_skip (GInputStream  *stream,
				  gsize          count,
				  GCancellable  *cancellable,
				  GError       **error)
{
	SoupContentSnifferStream *sniffer = SOUP_CONTENT_SNIFFER_STREAM (stream);
	gssize nskipped;

	if (sniffer->priv->sniffing) {
		/* Read into the internal buffer... */
		nskipped = soup_content_sniffer_stream_read (stream, NULL, 0, cancellable, error);
		if (nskipped == -1)
			return -1;
		/* Now fall through */
	}

	if (sniffer->priv->buffer) {
		nskipped = MIN (count, sniffer->priv->buffer_nread);
		if (nskipped == sniffer->priv->buffer_nread) {
			g_free (sniffer->priv->buffer);
			sniffer->priv->buffer = NULL;
		} else {
			/* FIXME */
			memmove (sniffer->priv->buffer,
				 sniffer->priv->buffer + nskipped,
				 sniffer->priv->buffer_nread - nskipped);
			sniffer->priv->buffer_nread -= nskipped;
		}
	} else {
		nskipped = G_INPUT_STREAM_CLASS (soup_content_sniffer_stream_parent_class)->
			skip (stream, count, cancellable, error);
	}
	return nskipped;
}
Esempio n. 10
0
static void
soup_cache_input_stream_class_init (SoupCacheInputStreamClass *klass)
{
	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
	GInputStreamClass *istream_class = G_INPUT_STREAM_CLASS (klass);

	g_type_class_add_private (klass, sizeof (SoupCacheInputStreamPrivate));

	gobject_class->get_property = soup_cache_input_stream_get_property;
	gobject_class->set_property = soup_cache_input_stream_set_property;
	gobject_class->finalize = soup_cache_input_stream_finalize;

	istream_class->read_fn = soup_cache_input_stream_read_fn;
	istream_class->close_fn = soup_cache_input_stream_close_fn;

	g_object_class_install_property (gobject_class, PROP_OUTPUT_STREAM,
					 g_param_spec_object ("output-stream", "Output stream",
							      "the output stream where to write.",
							      G_TYPE_OUTPUT_STREAM,
							      G_PARAM_READWRITE |
							      G_PARAM_CONSTRUCT_ONLY |
							      G_PARAM_STATIC_STRINGS));

	signals[CACHING_FINISHED] =
		g_signal_new ("caching-finished",
			      G_OBJECT_CLASS_TYPE (gobject_class),
			      G_SIGNAL_RUN_FIRST,
			      G_STRUCT_OFFSET (SoupCacheInputStreamClass, caching_finished),
			      NULL, NULL,
			      NULL,
			      G_TYPE_NONE, 2,
			      G_TYPE_INT, G_TYPE_ERROR);
}
static void
webkit_soup_directory_input_stream_class_init (WebKitSoupDirectoryInputStreamClass *stream_class)
{
	GInputStreamClass *inputstream_class = G_INPUT_STREAM_CLASS (stream_class);

	inputstream_class->read_fn = webkit_soup_directory_input_stream_read;
	inputstream_class->close_fn = webkit_soup_directory_input_stream_close;
}
static void
_gtk_source_buffer_input_stream_class_init (GtkSourceBufferInputStreamClass *klass)
{
	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
	GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);

	gobject_class->get_property = _gtk_source_buffer_input_stream_get_property;
	gobject_class->set_property = _gtk_source_buffer_input_stream_set_property;
	gobject_class->dispose = _gtk_source_buffer_input_stream_dispose;

	stream_class->read_fn = _gtk_source_buffer_input_stream_read;
	stream_class->close_fn = _gtk_source_buffer_input_stream_close;

	g_object_class_install_property (gobject_class,
					 PROP_BUFFER,
					 g_param_spec_object ("buffer",
							      "GtkTextBuffer",
							      "",
							      GTK_TYPE_TEXT_BUFFER,
							      G_PARAM_READWRITE |
							      G_PARAM_CONSTRUCT_ONLY |
							      G_PARAM_STATIC_STRINGS));

	/**
	 * GtkSourceBufferInputStream:newline-type:
	 *
	 * The :newline-type property determines what is considered
	 * as a line ending when reading complete lines from the stream.
	 */
	g_object_class_install_property (gobject_class,
					 PROP_NEWLINE_TYPE,
					 g_param_spec_enum ("newline-type",
							    "Newline type",
							    "",
							    GTK_SOURCE_TYPE_NEWLINE_TYPE,
							    GTK_SOURCE_NEWLINE_TYPE_LF,
							    G_PARAM_READWRITE |
							    G_PARAM_STATIC_STRINGS |
							    G_PARAM_CONSTRUCT_ONLY));

	/**
	 * GtkSourceBufferInputStream:add-trailing-newline:
	 *
	 * The :add-trailing-newline property specifies whether or not to
	 * add a trailing newline when reading the buffer.
	 */
	g_object_class_install_property (gobject_class,
	                                 PROP_ADD_TRAILING_NEWLINE,
	                                 g_param_spec_boolean ("add-trailing-newline",
	                                                       "Add trailing newline",
	                                                       "",
	                                                       TRUE,
	                                                       G_PARAM_READWRITE |
	                                                       G_PARAM_STATIC_STRINGS |
	                                                       G_PARAM_CONSTRUCT_ONLY));
}
Esempio n. 13
0
static void
g_unix_input_stream_class_init (GUnixInputStreamClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
  
  g_type_class_add_private (klass, sizeof (GUnixInputStreamPrivate));

  gobject_class->get_property = g_unix_input_stream_get_property;
  gobject_class->set_property = g_unix_input_stream_set_property;
  gobject_class->finalize = g_unix_input_stream_finalize;

  stream_class->read_fn = g_unix_input_stream_read;
  stream_class->close_fn = g_unix_input_stream_close;
  stream_class->read_async = g_unix_input_stream_read_async;
  stream_class->read_finish = g_unix_input_stream_read_finish;
  if (0)
    {
      /* TODO: Implement instead of using fallbacks */
      stream_class->skip_async = g_unix_input_stream_skip_async;
      stream_class->skip_finish = g_unix_input_stream_skip_finish;
    }
  stream_class->close_async = g_unix_input_stream_close_async;
  stream_class->close_finish = g_unix_input_stream_close_finish;

  /**
   * GUnixInputStream:fd:
   *
   * The file descriptor that the stream reads from.
   *
   * Since: 2.20
   */
  g_object_class_install_property (gobject_class,
				   PROP_FD,
				   g_param_spec_int ("fd",
						     P_("File descriptor"),
						     P_("The file descriptor to read from"),
						     G_MININT, G_MAXINT, -1,
						     G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));

  /**
   * GUnixInputStream:close-fd:
   *
   * Whether to close the file descriptor when the stream is closed.
   *
   * Since: 2.20
   */
  g_object_class_install_property (gobject_class,
				   PROP_CLOSE_FD,
				   g_param_spec_boolean ("close-fd",
							 P_("Close file descriptor"),
							 P_("Whether to close the file descriptor when the stream is closed"),
							 TRUE,
							 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
}
static void
g_winhttp_file_input_stream_class_init (GWinHttpFileInputStreamClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);

  gobject_class->finalize = g_winhttp_file_input_stream_finalize;

  stream_class->read_fn = g_winhttp_file_input_stream_read;
  stream_class->close_fn = g_winhttp_file_input_stream_close;
}
static void
g_tls_input_stream_gnutls_class_init (KmsGTlsInputStreamGnutlsClass * klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GInputStreamClass *input_stream_class = G_INPUT_STREAM_CLASS (klass);

  g_type_class_add_private (klass, sizeof (KmsGTlsInputStreamGnutlsPrivate));

  gobject_class->dispose = g_tls_input_stream_gnutls_dispose;

  input_stream_class->read_fn = g_tls_input_stream_gnutls_read;
}
Esempio n. 16
0
static void
soup_input_stream_read_async (GInputStream        *stream,
			      void                *buffer,
			      gsize                count,
			      int                  io_priority,
			      GCancellable        *cancellable,
			      GAsyncReadyCallback  callback,
			      gpointer             user_data)
{
  SoupInputStreamPrivate *priv = SOUP_INPUT_STREAM_GET_PRIVATE (stream);
  GSimpleAsyncResult *result;

  /* If the session uses the default GMainContext, then we can do
   * async I/O directly. But if it has its own main context, we fall
   * back to the async-via-sync-in-another-thread implementation.
   */
  if (soup_session_get_async_context (priv->session))
    {
      G_INPUT_STREAM_CLASS (soup_input_stream_parent_class)->
	read_async (stream, buffer, count, io_priority,
		    cancellable, callback, user_data);
      return;
    }

  result = g_simple_async_result_new (G_OBJECT (stream),
				      callback, user_data,
				      soup_input_stream_read_async);

  if (priv->finished)
    {
      g_simple_async_result_set_op_res_gssize (result, 0);
      g_simple_async_result_complete_in_idle (result);
      g_object_unref (result);
      return;
    }

  if (priv->leftover_bufsize)
    {
      gsize nread = read_from_leftover (priv, buffer, count);
      g_simple_async_result_set_op_res_gssize (result, nread);
      g_simple_async_result_complete_in_idle (result);
      g_object_unref (result);
      return;
    }

  priv->result = result;

  priv->got_chunk_cb = read_async_done;
  priv->finished_cb = read_async_done;
  priv->cancelled_cb = read_async_done;
  soup_input_stream_prepare_for_io (stream, cancellable, buffer, count);
}
Esempio n. 17
0
static void
byzanz_queue_input_stream_class_init (ByzanzQueueInputStreamClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  GInputStreamClass *input_stream_class = G_INPUT_STREAM_CLASS (klass);

  object_class->dispose = byzanz_queue_input_stream_dispose;
  object_class->finalize = byzanz_queue_input_stream_finalize;

  input_stream_class->read_fn = byzanz_queue_input_stream_read;
  input_stream_class->skip = byzanz_queue_input_stream_skip;
  input_stream_class->close_fn = byzanz_queue_input_stream_close;
  /* FIXME: implement async ops */
}
Esempio n. 18
0
static void
g_resource_file_input_stream_class_init (GResourceFileInputStreamClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
  GFileInputStreamClass *file_stream_class = G_FILE_INPUT_STREAM_CLASS (klass);

  gobject_class->finalize = g_resource_file_input_stream_finalize;

  stream_class->read_fn = g_resource_file_input_stream_read;
  stream_class->skip = g_resource_file_input_stream_skip;
  stream_class->close_fn = g_resource_file_input_stream_close;
  file_stream_class->tell = g_resource_file_input_stream_tell;
  file_stream_class->can_seek = g_resource_file_input_stream_can_seek;
  file_stream_class->seek = g_resource_file_input_stream_seek;
  file_stream_class->query_info = g_resource_file_input_stream_query_info;
}
Esempio n. 19
0
static void
soup_input_stream_class_init (SoupInputStreamClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
  
  g_type_class_add_private (klass, sizeof (SoupInputStreamPrivate));
  
  gobject_class->finalize = soup_input_stream_finalize;

  stream_class->read_fn = soup_input_stream_read;
  stream_class->close_fn = soup_input_stream_close;
  stream_class->read_async = soup_input_stream_read_async;
  stream_class->read_finish = soup_input_stream_read_finish;
  stream_class->close_async = soup_input_stream_close_async;
  stream_class->close_finish = soup_input_stream_close_finish;
}
Esempio n. 20
0
static void
g_win32_input_stream_class_init (GWin32InputStreamClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);

  g_type_class_add_private (klass, sizeof (GWin32InputStreamPrivate));

  gobject_class->get_property = g_win32_input_stream_get_property;
  gobject_class->set_property = g_win32_input_stream_set_property;
  gobject_class->finalize = g_win32_input_stream_finalize;

  stream_class->read_fn = g_win32_input_stream_read;
  stream_class->close_fn = g_win32_input_stream_close;

  /**
   * GWin32InputStream:handle:
   *
   * The handle that the stream reads from.
   *
   * Since: 2.26
   */
  g_object_class_install_property (gobject_class,
				   PROP_HANDLE,
				   g_param_spec_pointer ("handle",
							 P_("File handle"),
							 P_("The file handle to read from"),
							 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));

  /**
   * GWin32InputStream:close-handle:
   *
   * Whether to close the file handle when the stream is closed.
   *
   * Since: 2.26
   */
  g_object_class_install_property (gobject_class,
				   PROP_CLOSE_HANDLE,
				   g_param_spec_boolean ("close-handle",
							 P_("Close file handle"),
							 P_("Whether to close the file handle when the stream is closed"),
							 TRUE,
							 G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
}
Esempio n. 21
0
static void
g_local_file_input_stream_class_init (GLocalFileInputStreamClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
  GFileInputStreamClass *file_stream_class = G_FILE_INPUT_STREAM_CLASS (klass);
  
  g_type_class_add_private (klass, sizeof (GLocalFileInputStreamPrivate));
  
  gobject_class->finalize = g_local_file_input_stream_finalize;

  stream_class->read_fn = g_local_file_input_stream_read;
  stream_class->skip = g_local_file_input_stream_skip;
  stream_class->close_fn = g_local_file_input_stream_close;
  file_stream_class->tell = g_local_file_input_stream_tell;
  file_stream_class->can_seek = g_local_file_input_stream_can_seek;
  file_stream_class->seek = g_local_file_input_stream_seek;
  file_stream_class->query_info = g_local_file_input_stream_query_info;
}
Esempio n. 22
0
static void
g_ssl_input_stream_class_init(GSSLInputStreamClass *klass)
{
	GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
	GInputStreamClass *ginputstream_class = G_INPUT_STREAM_CLASS(klass);

	g_type_class_add_private(klass, sizeof(GSSLInputStreamPrivate));

	gobject_class->finalize = _g_ssl_input_stream_finalize;
	gobject_class->get_property = _g_ssl_input_stream_get_property;
	gobject_class->set_property = _g_ssl_input_stream_set_property;

	ginputstream_class->read_fn = _g_ssl_input_stream_read;
	ginputstream_class->read_async = _g_ssl_input_stream_read_async;
	ginputstream_class->read_finish = _g_ssl_input_stream_read_finish;

	g_object_class_install_property(gobject_class, PROP_SSL,
	                                g_param_spec_pointer("ssl", NULL, NULL, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
}
static void gvir_input_stream_class_init(GVirInputStreamClass *klass)
{
    GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
    GInputStreamClass *ginputstream_class = G_INPUT_STREAM_CLASS(klass);

    gobject_class->finalize = gvir_input_stream_finalize;
    gobject_class->get_property = gvir_input_stream_get_property;
    gobject_class->set_property = gvir_input_stream_set_property;

    ginputstream_class->read_fn = NULL;
    ginputstream_class->read_async = gvir_input_stream_read_async;
    ginputstream_class->read_finish = gvir_input_stream_read_finish;

    g_object_class_install_property(gobject_class, PROP_STREAM,
                                    g_param_spec_object("stream",
                                                        "stream",
                                                        "GVirStream",
                                                        GVIR_TYPE_STREAM, G_PARAM_CONSTRUCT_ONLY |
                                                        G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
Esempio n. 24
0
static void
xedit_document_input_stream_class_init (XeditDocumentInputStreamClass *klass)
{
	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
	GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);

	g_type_class_add_private (klass, sizeof (XeditDocumentInputStreamPrivate));

	gobject_class->get_property = xedit_document_input_stream_get_property;
	gobject_class->set_property = xedit_document_input_stream_set_property;

	stream_class->read_fn = xedit_document_input_stream_read;
	stream_class->close_fn = xedit_document_input_stream_close;

	g_object_class_install_property (gobject_class,
					 PROP_BUFFER,
					 g_param_spec_object ("buffer",
							      "Buffer",
							      "The buffer which is read",
							      GTK_TYPE_TEXT_BUFFER,
							      G_PARAM_READWRITE |
							      G_PARAM_CONSTRUCT_ONLY));

	/**
	 * XeditDocumentInputStream:newline-type:
	 *
	 * The :newline-type property determines what is considered
	 * as a line ending when reading complete lines from the stream.
	 */ 
	g_object_class_install_property (gobject_class,
					 PROP_NEWLINE_TYPE,
					 g_param_spec_enum ("newline-type",
							    "Newline type",
							    "The accepted types of line ending",
							    XEDIT_TYPE_DOCUMENT_NEWLINE_TYPE,
							    XEDIT_DOCUMENT_NEWLINE_TYPE_LF,
							    G_PARAM_READWRITE |
							    G_PARAM_STATIC_NAME |
							    G_PARAM_STATIC_BLURB |
							    G_PARAM_CONSTRUCT_ONLY));
}
Esempio n. 25
0
static void
g_unix_input_stream_read_async (GInputStream        *stream,
				void                *buffer,
				gsize                count,
				int                  io_priority,
				GCancellable        *cancellable,
				GAsyncReadyCallback  callback,
				gpointer             user_data)
{
  GSource *source;
  GUnixInputStream *unix_stream;
  ReadAsyncData *data;

  unix_stream = G_UNIX_INPUT_STREAM (stream);

  if (!unix_stream->priv->is_pipe_or_socket)
    {
      G_INPUT_STREAM_CLASS (g_unix_input_stream_parent_class)->
	read_async (stream, buffer, count, io_priority,
		    cancellable, callback, user_data);
      return;
    }

  data = g_new0 (ReadAsyncData, 1);
  data->count = count;
  data->buffer = buffer;
  data->callback = callback;
  data->user_data = user_data;
  data->cancellable = cancellable;
  data->stream = unix_stream;

  source = _g_fd_source_new (unix_stream->priv->fd,
			     G_IO_IN,
			     cancellable);
  g_source_set_name (source, "GUnixInputStream");
  
  g_source_set_callback (source, (GSourceFunc)read_async_cb, data, g_free);
  g_source_attach (source, g_main_context_get_thread_default ());
 
  g_source_unref (source);
}
Esempio n. 26
0
static gssize
g_unix_input_stream_read_finish (GInputStream  *stream,
				 GAsyncResult  *result,
				 GError       **error)
{
  GUnixInputStream *unix_stream = G_UNIX_INPUT_STREAM (stream);
  GSimpleAsyncResult *simple;
  gssize nread;

  if (!unix_stream->priv->is_pipe_or_socket)
    {
      return G_INPUT_STREAM_CLASS (g_unix_input_stream_parent_class)->
	read_finish (stream, result, error);
    }

  simple = G_SIMPLE_ASYNC_RESULT (result);
  g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == g_unix_input_stream_read_async);
  
  nread = g_simple_async_result_get_op_res_gssize (simple);
  return nread;
}
Esempio n. 27
0
static void
g_socket_input_stream_class_init (GSocketInputStreamXClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GInputStreamClass *ginputstream_class = G_INPUT_STREAM_CLASS (klass);

  g_type_class_add_private (klass, sizeof (GSocketInputStreamXPrivate));

  gobject_class->finalize = g_socket_input_stream_finalize;
  gobject_class->get_property = g_socket_input_stream_get_property;
  gobject_class->set_property = g_socket_input_stream_set_property;

  ginputstream_class->read_fn = g_socket_input_stream_read;

  g_object_class_install_property (gobject_class, PROP_SOCKET,
				   g_param_spec_object ("socket",
							"socket",
							"The socket that this stream wraps",
							G_TYPE_SOCKET, G_PARAM_CONSTRUCT_ONLY |
							G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
Esempio n. 28
0
static void
checkcopy_input_stream_class_init (CheckcopyInputStreamClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  GInputStreamClass *in_class = G_INPUT_STREAM_CLASS (klass);

  g_type_class_add_private (klass, sizeof (CheckcopyInputStreamPrivate));
  parent_class = g_type_class_peek_parent (klass);

  object_class->get_property = checkcopy_input_stream_get_property;
  object_class->set_property = checkcopy_input_stream_set_property;

  object_class->finalize = checkcopy_input_stream_finalize;
  object_class->constructor = checkcopy_input_stream_construct;

  g_object_class_install_property (object_class, PROP_CHECKSUM_TYPE,
           g_param_spec_int ("checksum-type", _("Checksum type"), _("Checksum type"), 
                             0, G_MAXINT, G_CHECKSUM_SHA1,
                             G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));

  in_class->read_fn = read_fn;
  //in_class->skip = skip;
  //in_class->close_fn = close_fn;
}
Esempio n. 29
0
static void
nice_input_stream_class_init (NiceInputStreamClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);

  g_type_class_add_private (klass, sizeof (NiceInputStreamPrivate));

  gobject_class->set_property = nice_input_stream_set_property;
  gobject_class->get_property = nice_input_stream_get_property;
  gobject_class->dispose = nice_input_stream_dispose;

  stream_class->read_fn = nice_input_stream_read;
  stream_class->close_fn = nice_input_stream_close;

  /***
   * NiceInputStream:agent:
   *
   * The #NiceAgent to wrap with an input stream. This must be an existing
   * reliable agent.
   *
   * A reference is not held on the #NiceAgent. If the agent is destroyed before
   * the #NiceInputStream, %G_IO_ERROR_CLOSED will be returned for all
   * subsequent operations on the stream.
   *
   * Since: 0.1.5
   */
  g_object_class_install_property (gobject_class, PROP_AGENT,
      g_param_spec_object ("agent",
          "NiceAgent",
          "The underlying NiceAgent",
          NICE_TYPE_AGENT,
          G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  /***
   * NiceInputStream:stream-id:
   *
   * ID of the stream to use in the #NiceInputStream:agent.
   *
   * Since: 0.1.5
   */
  g_object_class_install_property (gobject_class, PROP_STREAM_ID,
      g_param_spec_uint (
          "stream-id",
          "Agent’s stream ID",
          "The ID of the agent’s stream to wrap.",
          0, G_MAXUINT,
          0,
          G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  /***
   * NiceInputStream:component-id:
   *
   * ID of the component to use in the #NiceInputStream:agent.
   *
   * Since: 0.1.5
   */
  g_object_class_install_property (gobject_class, PROP_COMPONENT_ID,
      g_param_spec_uint (
          "component-id",
          "Agent’s component ID",
          "The ID of the agent’s component to wrap.",
          0, G_MAXUINT,
          0,
          G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}