aboutsummaryrefslogtreecommitdiff
path: root/src/fetch-file.c
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-12-01 14:33:32 -0500
committerKen VanDine <ken.vandine@canonical.com>2011-12-01 14:33:32 -0500
commitc157f744805b87d39eb49ee162645d9af25b05b5 (patch)
tree9a1adac71b0b94de8a72d20fd39c821efe6b87c3 /src/fetch-file.c
parent6c40e13a44770e9bda393e5b0b1ebefa6b8077d5 (diff)
parent048fe88d783124358184248e33100caf9d6af82d (diff)
downloadayatana-indicator-sound-c157f744805b87d39eb49ee162645d9af25b05b5.tar.gz
ayatana-indicator-sound-c157f744805b87d39eb49ee162645d9af25b05b5.tar.bz2
ayatana-indicator-sound-c157f744805b87d39eb49ee162645d9af25b05b5.zip
Import upstream version 0.8.0.0
Diffstat (limited to 'src/fetch-file.c')
-rw-r--r--src/fetch-file.c313
1 files changed, 193 insertions, 120 deletions
diff --git a/src/fetch-file.c b/src/fetch-file.c
index 401c53f..e5f36b1 100644
--- a/src/fetch-file.c
+++ b/src/fetch-file.c
@@ -1,4 +1,4 @@
-/* fetch-file.c generated by valac 0.12.1, the Vala compiler
+/* fetch-file.c generated by valac 0.14.0, the Vala compiler
* generated from fetch-file.vala, do not modify */
/*
@@ -69,11 +69,13 @@ struct _FetchFileFetchDataData {
GAsyncResult* _res_;
GSimpleAsyncResult* _async_result;
FetchFile* self;
- GFileInputStream* _tmp0_;
+ GFile* _tmp0_;
GFileInputStream* _tmp1_;
GFileInputStream* _tmp2_;
- GDataInputStream* _tmp3_;
- GError * e;
+ GFileInputStream* _tmp3_;
+ GDataInputStream* _tmp4_;
+ GDataInputStream* _tmp5_;
+ GError* e;
GError * _inner_error_;
};
@@ -84,19 +86,42 @@ struct _FetchFileReadSomethingAsyncData {
GSimpleAsyncResult* _async_result;
FetchFile* self;
gssize size;
- guint8* _tmp0_;
+ gssize _tmp0_;
+ guint8* _tmp1_;
guint8* buffer;
gint buffer_length1;
gint _buffer_size_;
gssize bufsize;
- gboolean _tmp1_;
- gssize _tmp2_;
- gssize _tmp3_;
- guint8* _tmp4_;
+ gboolean _tmp2_;
+ gboolean _tmp3_;
+ gssize _tmp4_;
+ GDataInputStream* _tmp5_;
+ guint8* _tmp6_;
+ gint _tmp6__length1;
+ gssize _tmp7_;
+ gssize _tmp8_;
+ gssize _tmp9_;
+ gssize _tmp10_;
+ gssize _tmp11_;
+ gssize _tmp12_;
+ guint8* _tmp13_;
guint8* cpybuf;
gint cpybuf_length1;
gint _cpybuf_size_;
- GError * e;
+ guint8* _tmp14_;
+ gint _tmp14__length1;
+ guint8* _tmp15_;
+ gint _tmp15__length1;
+ gssize _tmp16_;
+ GByteArray* _tmp17_;
+ guint8* _tmp18_;
+ gint _tmp18__length1;
+ GByteArray* _tmp19_;
+ guint8* _tmp20_;
+ gint _tmp20__length1;
+ GError* e;
+ GByteArray* _tmp21_;
+ const gchar* _tmp22_;
GError * _inner_error_;
};
@@ -115,11 +140,11 @@ FetchFile* fetch_file_construct (GType object_type, const gchar* uri, const gcha
static void fetch_file_fetch_data_data_free (gpointer _data);
void fetch_file_fetch_data (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void fetch_file_fetch_data_finish (FetchFile* self, GAsyncResult* _res_);
-static gboolean fetch_file_fetch_data_co (FetchFileFetchDataData* data);
+static gboolean fetch_file_fetch_data_co (FetchFileFetchDataData* _data_);
static void fetch_file_read_something_async (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void fetch_file_read_something_finish (FetchFile* self, GAsyncResult* _res_);
static void fetch_file_read_something_async_data_free (gpointer _data);
-static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncData* data);
+static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncData* _data_);
static void fetch_file_read_something_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
const gchar* fetch_file_get_intended_property (FetchFile* self);
const gchar* fetch_file_get_uri (FetchFile* self);
@@ -134,9 +159,13 @@ static void _vala_fetch_file_set_property (GObject * object, guint property_id,
FetchFile* fetch_file_construct (GType object_type, const gchar* uri, const gchar* prop) {
FetchFile * self = NULL;
+ const gchar* _tmp0_;
+ const gchar* _tmp1_;
g_return_val_if_fail (uri != NULL, NULL);
g_return_val_if_fail (prop != NULL, NULL);
- self = (FetchFile*) g_object_new (object_type, "uri", uri, "intended-property", prop, NULL);
+ _tmp0_ = uri;
+ _tmp1_ = prop;
+ self = (FetchFile*) g_object_new (object_type, "uri", _tmp0_, "intended-property", _tmp1_, NULL);
return self;
}
@@ -147,10 +176,10 @@ FetchFile* fetch_file_new (const gchar* uri, const gchar* prop) {
static void fetch_file_fetch_data_data_free (gpointer _data) {
- FetchFileFetchDataData* data;
- data = _data;
- _g_object_unref0 (data->self);
- g_slice_free (FetchFileFetchDataData, data);
+ FetchFileFetchDataData* _data_;
+ _data_ = _data;
+ _g_object_unref0 (_data_->self);
+ g_slice_free (FetchFileFetchDataData, _data_);
}
@@ -161,10 +190,12 @@ static gpointer _g_object_ref0 (gpointer self) {
void fetch_file_fetch_data (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
FetchFileFetchDataData* _data_;
+ FetchFile* _tmp0_;
_data_ = g_slice_new0 (FetchFileFetchDataData);
_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, fetch_file_fetch_data);
g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, fetch_file_fetch_data_data_free);
- _data_->self = _g_object_ref0 (self);
+ _tmp0_ = _g_object_ref0 (self);
+ _data_->self = _tmp0_;
fetch_file_fetch_data_co (_data_);
}
@@ -175,66 +206,71 @@ void fetch_file_fetch_data_finish (FetchFile* self, GAsyncResult* _res_) {
}
-static gboolean fetch_file_fetch_data_co (FetchFileFetchDataData* data) {
- switch (data->_state_) {
+static gboolean fetch_file_fetch_data_co (FetchFileFetchDataData* _data_) {
+ switch (_data_->_state_) {
case 0:
goto _state_0;
default:
g_assert_not_reached ();
}
_state_0:
- data->_tmp0_ = NULL;
- data->_tmp0_ = g_file_read (data->self->priv->file, NULL, &data->_inner_error_);
- data->_tmp1_ = data->_tmp0_;
- if (data->_inner_error_ != NULL) {
- goto __catch14_g_error;
+ {
+ _data_->_tmp0_ = _data_->self->priv->file;
+ _data_->_tmp1_ = NULL;
+ _data_->_tmp1_ = g_file_read (_data_->_tmp0_, NULL, &_data_->_inner_error_);
+ _data_->_tmp2_ = _data_->_tmp1_;
+ if (_data_->_inner_error_ != NULL) {
+ goto __catch14_g_error;
+ }
+ _data_->_tmp3_ = _data_->_tmp2_;
+ _data_->_tmp4_ = g_data_input_stream_new ((GInputStream*) _data_->_tmp3_);
+ _g_object_unref0 (_data_->self->priv->stream);
+ _data_->self->priv->stream = _data_->_tmp4_;
+ _g_object_unref0 (_data_->_tmp3_);
+ _data_->_tmp5_ = _data_->self->priv->stream;
+ g_data_input_stream_set_byte_order (_data_->_tmp5_, G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN);
}
- data->_tmp2_ = data->_tmp1_;
- data->_tmp3_ = NULL;
- data->_tmp3_ = g_data_input_stream_new ((GInputStream*) data->_tmp2_);
- _g_object_unref0 (data->self->priv->stream);
- data->self->priv->stream = data->_tmp3_;
- _g_object_unref0 (data->_tmp2_);
- g_data_input_stream_set_byte_order (data->self->priv->stream, G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN);
goto __finally14;
__catch14_g_error:
{
- data->e = data->_inner_error_;
- data->_inner_error_ = NULL;
- g_signal_emit_by_name (data->self, "failed");
- _g_error_free0 (data->e);
+ _data_->e = _data_->_inner_error_;
+ _data_->_inner_error_ = NULL;
+ g_signal_emit_by_name (_data_->self, "failed");
+ _g_error_free0 (_data_->e);
}
__finally14:
- if (data->_inner_error_ != NULL) {
- g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
- g_clear_error (&data->_inner_error_);
+ if (_data_->_inner_error_ != NULL) {
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
+ g_clear_error (&_data_->_inner_error_);
return FALSE;
}
- fetch_file_read_something_async (data->self, NULL, NULL);
- if (data->_state_ == 0) {
- g_simple_async_result_complete_in_idle (data->_async_result);
+ fetch_file_read_something_async (_data_->self, NULL, NULL);
+ if (_data_->_state_ == 0) {
+ g_simple_async_result_complete_in_idle (_data_->_async_result);
} else {
- g_simple_async_result_complete (data->_async_result);
+ g_simple_async_result_complete (_data_->_async_result);
}
- g_object_unref (data->_async_result);
+ g_object_unref (_data_->_async_result);
return FALSE;
}
static void fetch_file_read_something_async_data_free (gpointer _data) {
- FetchFileReadSomethingAsyncData* data;
- data = _data;
- _g_object_unref0 (data->self);
- g_slice_free (FetchFileReadSomethingAsyncData, data);
+ FetchFileReadSomethingAsyncData* _data_;
+ _data_ = _data;
+ _g_object_unref0 (_data_->self);
+ g_slice_free (FetchFileReadSomethingAsyncData, _data_);
}
static void fetch_file_read_something_async (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
FetchFileReadSomethingAsyncData* _data_;
+ FetchFile* _tmp0_;
_data_ = g_slice_new0 (FetchFileReadSomethingAsyncData);
_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, fetch_file_read_something_async);
g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, fetch_file_read_something_async_data_free);
- _data_->self = _g_object_ref0 (self);
+ _tmp0_ = _g_object_ref0 (self);
+ _data_->self = _tmp0_;
fetch_file_read_something_async_co (_data_);
}
@@ -246,16 +282,16 @@ static void fetch_file_read_something_finish (FetchFile* self, GAsyncResult* _re
static void fetch_file_read_something_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
- FetchFileReadSomethingAsyncData* data;
- data = _user_data_;
- data->_source_object_ = source_object;
- data->_res_ = _res_;
- fetch_file_read_something_async_co (data);
+ FetchFileReadSomethingAsyncData* _data_;
+ _data_ = _user_data_;
+ _data_->_source_object_ = source_object;
+ _data_->_res_ = _res_;
+ fetch_file_read_something_async_co (_data_);
}
-static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncData* data) {
- switch (data->_state_) {
+static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncData* _data_) {
+ switch (_data_->_state_) {
case 0:
goto _state_0;
case 1:
@@ -264,108 +300,142 @@ static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncD
g_assert_not_reached ();
}
_state_0:
- data->size = (gssize) 1024;
- data->_tmp0_ = NULL;
- data->_tmp0_ = g_new0 (guint8, data->size);
- data->buffer = data->_tmp0_;
- data->buffer_length1 = data->size;
- data->_buffer_size_ = data->size;
- data->bufsize = (gssize) 1;
+ _data_->size = (gssize) 1024;
+ _data_->_tmp0_ = _data_->size;
+ _data_->_tmp1_ = NULL;
+ _data_->_tmp1_ = g_new0 (guint8, _data_->_tmp0_);
+ _data_->buffer = _data_->_tmp1_;
+ _data_->buffer_length1 = _data_->_tmp0_;
+ _data_->_buffer_size_ = _data_->buffer_length1;
+ _data_->bufsize = (gssize) 1;
{
- data->_tmp1_ = TRUE;
+ _data_->_tmp2_ = TRUE;
while (TRUE) {
- if (!data->_tmp1_) {
- if (!(data->bufsize > 0)) {
+ _data_->_tmp3_ = _data_->_tmp2_;
+ if (!_data_->_tmp3_) {
+ _data_->_tmp4_ = _data_->bufsize;
+ if (!(_data_->_tmp4_ > ((gssize) 0))) {
break;
}
}
- data->_tmp1_ = FALSE;
- data->_state_ = 1;
- g_input_stream_read_async ((GInputStream*) data->self->priv->stream, data->buffer, (gsize) data->buffer_length1, G_PRIORITY_DEFAULT, NULL, fetch_file_read_something_async_ready, data);
- return FALSE;
- _state_1:
- data->_tmp2_ = g_input_stream_read_finish ((GInputStream*) data->self->priv->stream, data->_res_, &data->_inner_error_);
- data->_tmp3_ = data->_tmp2_;
- if (data->_inner_error_ != NULL) {
- goto __catch15_g_error;
- }
- data->bufsize = data->_tmp3_;
- if (data->bufsize < 1) {
- break;
- }
- if (data->bufsize != data->size) {
- data->_tmp4_ = NULL;
- data->_tmp4_ = g_new0 (guint8, data->bufsize);
- data->cpybuf = data->_tmp4_;
- data->cpybuf_length1 = data->bufsize;
- data->_cpybuf_size_ = data->bufsize;
- memcpy (data->cpybuf, data->buffer, (gsize) data->bufsize);
- g_byte_array_append (data->self->priv->data, data->cpybuf, data->cpybuf_length1);
- data->cpybuf = (g_free (data->cpybuf), NULL);
- } else {
- g_byte_array_append (data->self->priv->data, data->buffer, data->buffer_length1);
+ _data_->_tmp2_ = FALSE;
+ {
+ _data_->_tmp5_ = _data_->self->priv->stream;
+ _data_->_tmp6_ = _data_->buffer;
+ _data_->_tmp6__length1 = _data_->buffer_length1;
+ _data_->_state_ = 1;
+ g_input_stream_read_async ((GInputStream*) _data_->_tmp5_, _data_->_tmp6_, (gsize) _data_->_tmp6__length1, G_PRIORITY_DEFAULT, NULL, fetch_file_read_something_async_ready, _data_);
+ return FALSE;
+ _state_1:
+ _data_->_tmp7_ = 0L;
+ _data_->_tmp7_ = g_input_stream_read_finish ((GInputStream*) _data_->_tmp5_, _data_->_res_, &_data_->_inner_error_);
+ _data_->_tmp8_ = _data_->_tmp7_;
+ if (_data_->_inner_error_ != NULL) {
+ goto __catch15_g_error;
+ }
+ _data_->bufsize = _data_->_tmp8_;
+ _data_->_tmp9_ = _data_->bufsize;
+ if (_data_->_tmp9_ < ((gssize) 1)) {
+ break;
+ }
+ _data_->_tmp10_ = _data_->bufsize;
+ _data_->_tmp11_ = _data_->size;
+ if (_data_->_tmp10_ != _data_->_tmp11_) {
+ _data_->_tmp12_ = _data_->bufsize;
+ _data_->_tmp13_ = NULL;
+ _data_->_tmp13_ = g_new0 (guint8, _data_->_tmp12_);
+ _data_->cpybuf = _data_->_tmp13_;
+ _data_->cpybuf_length1 = _data_->_tmp12_;
+ _data_->_cpybuf_size_ = _data_->cpybuf_length1;
+ _data_->_tmp14_ = _data_->cpybuf;
+ _data_->_tmp14__length1 = _data_->cpybuf_length1;
+ _data_->_tmp15_ = _data_->buffer;
+ _data_->_tmp15__length1 = _data_->buffer_length1;
+ _data_->_tmp16_ = _data_->bufsize;
+ memcpy (_data_->_tmp14_, _data_->_tmp15_, (gsize) _data_->_tmp16_);
+ _data_->_tmp17_ = _data_->self->priv->data;
+ _data_->_tmp18_ = _data_->cpybuf;
+ _data_->_tmp18__length1 = _data_->cpybuf_length1;
+ g_byte_array_append (_data_->_tmp17_, _data_->_tmp18_, _data_->_tmp18__length1);
+ _data_->cpybuf = (g_free (_data_->cpybuf), NULL);
+ } else {
+ _data_->_tmp19_ = _data_->self->priv->data;
+ _data_->_tmp20_ = _data_->buffer;
+ _data_->_tmp20__length1 = _data_->buffer_length1;
+ g_byte_array_append (_data_->_tmp19_, _data_->_tmp20_, _data_->_tmp20__length1);
+ }
}
goto __finally15;
__catch15_g_error:
{
- data->e = data->_inner_error_;
- data->_inner_error_ = NULL;
- g_signal_emit_by_name (data->self, "failed");
- _g_error_free0 (data->e);
+ _data_->e = _data_->_inner_error_;
+ _data_->_inner_error_ = NULL;
+ g_signal_emit_by_name (_data_->self, "failed");
+ _g_error_free0 (_data_->e);
}
__finally15:
- if (data->_inner_error_ != NULL) {
- data->buffer = (g_free (data->buffer), NULL);
- g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
- g_clear_error (&data->_inner_error_);
+ if (_data_->_inner_error_ != NULL) {
+ _data_->buffer = (g_free (_data_->buffer), NULL);
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
+ g_clear_error (&_data_->_inner_error_);
return FALSE;
}
}
}
- g_signal_emit_by_name (data->self, "completed", data->self->priv->data, data->self->priv->_intended_property);
- data->buffer = (g_free (data->buffer), NULL);
- if (data->_state_ == 0) {
- g_simple_async_result_complete_in_idle (data->_async_result);
+ _data_->_tmp21_ = _data_->self->priv->data;
+ _data_->_tmp22_ = _data_->self->priv->_intended_property;
+ g_signal_emit_by_name (_data_->self, "completed", _data_->_tmp21_, _data_->_tmp22_);
+ _data_->buffer = (g_free (_data_->buffer), NULL);
+ if (_data_->_state_ == 0) {
+ g_simple_async_result_complete_in_idle (_data_->_async_result);
} else {
- g_simple_async_result_complete (data->_async_result);
+ g_simple_async_result_complete (_data_->_async_result);
}
- g_object_unref (data->_async_result);
+ g_object_unref (_data_->_async_result);
return FALSE;
}
const gchar* fetch_file_get_uri (FetchFile* self) {
const gchar* result;
+ const gchar* _tmp0_;
g_return_val_if_fail (self != NULL, NULL);
- result = self->priv->_uri;
+ _tmp0_ = self->priv->_uri;
+ result = _tmp0_;
return result;
}
static void fetch_file_set_uri (FetchFile* self, const gchar* value) {
- gchar* _tmp0_;
+ const gchar* _tmp0_;
+ gchar* _tmp1_;
g_return_if_fail (self != NULL);
- _tmp0_ = g_strdup (value);
+ _tmp0_ = value;
+ _tmp1_ = g_strdup (_tmp0_);
_g_free0 (self->priv->_uri);
- self->priv->_uri = _tmp0_;
+ self->priv->_uri = _tmp1_;
g_object_notify ((GObject *) self, "uri");
}
const gchar* fetch_file_get_intended_property (FetchFile* self) {
const gchar* result;
+ const gchar* _tmp0_;
g_return_val_if_fail (self != NULL, NULL);
- result = self->priv->_intended_property;
+ _tmp0_ = self->priv->_intended_property;
+ result = _tmp0_;
return result;
}
static void fetch_file_set_intended_property (FetchFile* self, const gchar* value) {
- gchar* _tmp0_;
+ const gchar* _tmp0_;
+ gchar* _tmp1_;
g_return_if_fail (self != NULL);
- _tmp0_ = g_strdup (value);
+ _tmp0_ = value;
+ _tmp1_ = g_strdup (_tmp0_);
_g_free0 (self->priv->_intended_property);
- self->priv->_intended_property = _tmp0_;
+ self->priv->_intended_property = _tmp1_;
g_object_notify ((GObject *) self, "intended-property");
}
@@ -374,7 +444,8 @@ static void g_cclosure_user_marshal_VOID__POINTER_STRING (GClosure * closure, GV
typedef void (*GMarshalFunc_VOID__POINTER_STRING) (gpointer data1, gpointer arg_1, const char* arg_2, gpointer data2);
register GMarshalFunc_VOID__POINTER_STRING callback;
register GCClosure * cc;
- register gpointer data1, data2;
+ register gpointer data1;
+ register gpointer data2;
cc = (GCClosure *) closure;
g_return_if_fail (n_param_values == 3);
if (G_CCLOSURE_SWAP_DATA (closure)) {
@@ -393,17 +464,19 @@ static GObject * fetch_file_constructor (GType type, guint n_construct_propertie
GObject * obj;
GObjectClass * parent_class;
FetchFile * self;
- GFile* _tmp0_ = NULL;
- GByteArray* _tmp1_ = NULL;
+ const gchar* _tmp0_;
+ GFile* _tmp1_ = NULL;
+ GByteArray* _tmp2_;
parent_class = G_OBJECT_CLASS (fetch_file_parent_class);
obj = parent_class->constructor (type, n_construct_properties, construct_properties);
self = FETCH_FILE (obj);
- _tmp0_ = g_file_new_for_uri (self->priv->_uri);
+ _tmp0_ = self->priv->_uri;
+ _tmp1_ = g_file_new_for_uri (_tmp0_);
_g_object_unref0 (self->priv->file);
- self->priv->file = _tmp0_;
- _tmp1_ = g_byte_array_new ();
+ self->priv->file = _tmp1_;
+ _tmp2_ = g_byte_array_new ();
_g_byte_array_free0 (self->priv->data);
- self->priv->data = _tmp1_;
+ self->priv->data = _tmp2_;
return obj;
}