Exemplo n.º 1
0
static gboolean
_g_ssl_input_stream_read_ready(gpointer data)
{
	GSSLInputStream *stream = (GSSLInputStream *)data;
	GSimpleAsyncResult *simple;
	GError *error = NULL;
	gssize result;

	g_assert(stream != NULL);
	g_assert(stream->priv->result != NULL);

	if(!g_source_is_destroyed(g_main_current_source()))
	{
		simple = stream->priv->result;
		stream->priv->result = NULL;

		if((result = openssl_read(stream->priv->ssl, stream->priv->buffer, stream->priv->count, stream->priv->cancellable, &error)) > 0)
		{
			g_simple_async_result_set_op_res_gssize(simple, result);
		}

		if(error)
		{
			g_simple_async_result_set_from_error(simple, error);
			g_error_free(error);
		}

		if(stream->priv->cancellable)
		{
			g_object_unref(stream->priv->cancellable);
		}

		g_simple_async_result_complete(simple);
		g_object_unref(simple);
	}

	return FALSE;
}
static void
modem_time_check_ready (MMBaseModem *self,
                        GAsyncResult *res,
                        GSimpleAsyncResult *simple)
{
    GError *error = NULL;
    GVariant *result;

    g_simple_async_result_set_op_res_gboolean (simple, FALSE);

    result = mm_base_modem_at_sequence_finish (self, res, NULL, &error);
    if (!error) {
        MMBroadbandModemSierra *sierra = MM_BROADBAND_MODEM_SIERRA (self);

        sierra->priv->time_method = g_variant_get_uint32 (result);
        if (sierra->priv->time_method != TIME_METHOD_UNKNOWN)
            g_simple_async_result_set_op_res_gboolean (simple, TRUE);
    }
    g_clear_error (&error);

    g_simple_async_result_complete (simple);
    g_object_unref (simple);
}
static void
pk_proxy_created_cb (GObject *source,
                     GAsyncResult *result,
                     gpointer user_data)
{
  GtkAppChooserOnlinePk *self = user_data;
  GDBusProxy *proxy;

  proxy = g_dbus_proxy_new_finish (result, NULL);

  if (proxy == NULL)
    {
      g_simple_async_result_set_op_res_gboolean (self->priv->init_result, FALSE);
    }
  else
    {
      g_simple_async_result_set_op_res_gboolean (self->priv->init_result, TRUE);
      self->priv->proxy = proxy;
    }

  g_simple_async_result_complete (self->priv->init_result);
  g_clear_object (&self->priv->init_result);
}
Exemplo n.º 4
0
static void
on_provider_new (GObject *source,
                 GAsyncResult *result,
                 gpointer user_data)
{
        GSimpleAsyncResult *async = G_SIMPLE_ASYNC_RESULT (user_data);
        NewClosure *closure = g_simple_async_result_get_op_res_gpointer (async);
        GError *error = NULL;
        UmRealmProvider *provider;

        provider = um_realm_provider_proxy_new_finish (result, &error);
        closure->manager->provider = provider;

        if (error == NULL) {
                g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (closure->manager->provider), -1);
                g_debug ("Created realm manager");
        } else {
                g_simple_async_result_take_error (async, error);
        }
        g_simple_async_result_complete (async);

        g_object_unref (async);
}
Exemplo n.º 5
0
static gboolean deja_dup_config_number_real_set_from_config_co (DejaDupConfigNumberSetFromConfigData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->spin;
	_data_->_tmp1_ = ((DejaDupConfigWidget*) _data_->self)->settings;
	_data_->_tmp2_ = deja_dup_config_widget_get_key ((DejaDupConfigWidget*) _data_->self);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = 0;
	_data_->_tmp4_ = g_settings_get_int ((GSettings*) _data_->_tmp1_, _data_->_tmp3_);
	gtk_spin_button_set_value (_data_->_tmp0_, (gdouble) _data_->_tmp4_);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}
static void
rygel_media_export_music_item_real_commit (RygelUpdatableObject *base, GAsyncReadyCallback callback, gpointer user_data) {
  RygelMediaExportMusicItem *self = RYGEL_MEDIA_EXPORT_MUSIC_ITEM (base);

  g_return_if_fail (self);
  g_return_if_fail (callback);

  rygel_trackable_item_changed (RYGEL_TRACKABLE_ITEM (self));
  /* Setup the async result.
   */
  GSimpleAsyncResult *async_result =
    g_simple_async_result_new (G_OBJECT (self), callback, user_data,
      rygel_media_export_music_item_real_commit);

  /* Do the work that could take a while.
   */
  GError *error = NULL;
  RygelMediaExportMediaCache *cache = rygel_media_export_media_cache_get_default ();

  rygel_media_export_media_cache_save_item (cache, RYGEL_MEDIA_ITEM (self), &error);

  /* Set any error in the async result, if necessary.
   */
  if (error) {
    g_simple_async_result_set_from_error (async_result, error);
    g_error_free (error);
  }

  /* Let the caller know that the async operation is finished,
   * and that its result is now available.
   */
  g_simple_async_result_complete (async_result);

  /* Free our data structure. */
  g_object_unref (async_result);
  g_object_unref (cache);
}
Exemplo n.º 7
0
static gboolean
send_async_cb (gpointer data)
{
	GSimpleAsyncResult *simple;
	SoupSession *session;
	SendAsyncHelper *helper = (SendAsyncHelper *)data;

	session = soup_request_get_session (SOUP_REQUEST (helper->http));
	simple = g_simple_async_result_new (G_OBJECT (helper->http),
					    helper->callback, helper->user_data,
					    soup_request_http_send_async);

	g_simple_async_result_set_op_res_gpointer (simple, helper->httpstream, g_object_unref);

	/* Update message status */
	soup_message_set_status (helper->http->priv->msg, SOUP_STATUS_OK);

	/* Issue signals  */
	soup_message_got_headers (helper->http->priv->msg);

	if (soup_session_get_feature_for_message (session, SOUP_TYPE_CONTENT_SNIFFER, helper->http->priv->msg)) {
		const char *content_type = soup_message_headers_get_content_type (helper->http->priv->msg->response_headers, NULL);
		soup_message_content_sniffed (helper->http->priv->msg, content_type, NULL);
	}

	g_simple_async_result_complete (simple);

	soup_message_finished (helper->http->priv->msg);

	g_object_unref (simple);

	g_object_unref (helper->http);
	g_slice_free (SendAsyncHelper, helper);

	return FALSE;
}
Exemplo n.º 8
0
static void
write_all_cb (GObject      *source_object,
              GAsyncResult *res,
              gpointer      user_data)
{
  GOutputStream *stream = G_OUTPUT_STREAM (source_object);
  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);

  gssize bytes_written;
  GError *err = NULL;
  WriteAllData *write_data;

  bytes_written = g_output_stream_write_finish (stream, res, &err);
  if (bytes_written == -1)
  {
    g_simple_async_result_take_error (simple, err);
    goto done;
  }
  
  write_data = g_simple_async_result_get_op_res_gpointer (simple);

  write_data->bytes_written += bytes_written;
  if (write_data->bytes_written < write_data->count)
  {
    g_output_stream_write_async (stream,
                                 (const guint8 *)write_data->buffer + write_data->bytes_written,
                                 write_data->count - write_data->bytes_written,
                                 write_data->io_priority, write_data->cancellable,
                                 write_all_cb, simple);
    return;
  }

done:
  g_simple_async_result_complete (simple);
  g_object_unref (simple);
}
Exemplo n.º 9
0
static void
caller_free (gpointer data)
{
  ReauthorizeCaller *caller = data;
  if (caller->cancel_sig)
    g_signal_handler_disconnect (caller->cancellable, caller->cancel_sig);
  if (caller->cancellable)
    g_object_unref (caller->cancellable);
  g_signal_handler_disconnect (caller->helper, caller->read_sig);
  g_signal_handler_disconnect (caller->helper, caller->close_sig);
  g_object_unref (caller->helper);

  if (caller->result)
    {
      g_debug ("cancelling agent authentication");
      g_simple_async_result_set_error (caller->result, G_IO_ERROR, G_IO_ERROR_CANCELLED,
                                       "Operation was cancelled");
      g_simple_async_result_complete (caller->result);
      g_object_unref (caller->result);
    }

  g_free (caller->cookie);
  g_free (caller);
}
Exemplo n.º 10
0
static void
reply_cb (GObject *source,
          GAsyncResult *res,
          gpointer user_data)
{
  GSimpleAsyncResult *result = G_SIMPLE_ASYNC_RESULT (user_data);
  struct request_res *rr = g_simple_async_result_get_op_res_gpointer (result);

  GError *error = NULL;
  GInputStream *in = soup_request_send_finish (rr->request, res, &error);

  if (error) {
    g_simple_async_result_set_error (result, GRL_NET_WC_ERROR,
                                     GRL_NET_WC_ERROR_UNAVAILABLE,
                                     _("Data not available"));
    g_error_free (error);

    g_simple_async_result_complete (result);
    g_object_unref (result);
    return;
  }

  rr->length = soup_request_get_content_length (rr->request) + 1;
  if (rr->length == 1)
    rr->length = 50 * 1024;

  rr->buffer = g_new (gchar, rr->length);

  g_input_stream_read_async (in,
                             rr->buffer,
                             rr->length,
                             G_PRIORITY_DEFAULT,
                             NULL,
                             read_async_cb,
                             user_data);
}
static void
parent_enable_unsolicited_events_ready (MMIfaceModem3gpp *self,
                                        GAsyncResult *res,
                                        GSimpleAsyncResult *simple)
{
    GError *error = NULL;

    if (!iface_modem_3gpp_parent->enable_unsolicited_events_finish (self, res, &error)) {
        g_simple_async_result_take_error (simple, error);
        g_simple_async_result_complete (simple);
        g_object_unref (simple);
    }

    /* Our own enable now */
    mm_base_modem_at_sequence_full (
        MM_BASE_MODEM (self),
        mm_base_modem_peek_port_primary (MM_BASE_MODEM (self)),
        unsolicited_enable_sequence,
        NULL,  /* response_processor_context */
        NULL,  /* response_processor_context_free */
        NULL, /* cancellable */
        (GAsyncReadyCallback)own_enable_unsolicited_events_ready,
        simple);
}
static void
create_tube_complete (GSimpleAsyncResult *simple, const GError *error)
{
  CreateTubeData *data;

  g_object_ref (simple);

  data = g_simple_async_result_get_op_res_gpointer (simple);

  if (data->channel != NULL)
    {
      g_signal_handlers_disconnect_by_func (data->channel,
          create_tube_channel_invalidated_cb, simple);
      g_signal_handlers_disconnect_by_func (data->channel,
          create_tube_incoming_cb, simple);
    }

  if (error != NULL)
    g_simple_async_result_set_from_error (simple, error);

  g_simple_async_result_complete (simple);

  g_object_unref (simple);
}
Exemplo n.º 13
0
static void
load_snapshot_loaded_cb (GFile *snapshot_file,
                         GAsyncResult *result,
                         GSimpleAsyncResult *simple)
{
	EShell *shell;
	GObject *object;
	LoadContext *context;
	EMsgComposer *composer;
	CamelMimeMessage *message;
	CamelStream *camel_stream;
	gchar *contents = NULL;
	gsize length;
	GError *local_error = NULL;

	context = g_simple_async_result_get_op_res_gpointer (simple);

	g_file_load_contents_finish (
		snapshot_file, result, &contents, &length, NULL, &local_error);

	if (local_error != NULL) {
		g_warn_if_fail (contents == NULL);
		g_simple_async_result_take_error (simple, local_error);
		g_simple_async_result_complete (simple);
		return;
	}

	/* Create an in-memory buffer for the MIME parser to read from.
	 * We have to do this because CamelStreams are syncrhonous-only,
	 * and feeding the parser a direct file stream would block. */
	message = camel_mime_message_new ();
	camel_stream = camel_stream_mem_new_with_buffer (contents, length);
	camel_data_wrapper_construct_from_stream_sync (
		CAMEL_DATA_WRAPPER (message), camel_stream, NULL, &local_error);
	g_object_unref (camel_stream);
	g_free (contents);

	if (local_error != NULL) {
		g_simple_async_result_take_error (simple, local_error);
		g_simple_async_result_complete (simple);
		g_object_unref (message);
		return;
	}

	/* g_async_result_get_source_object() returns a new reference. */
	object = g_async_result_get_source_object (G_ASYNC_RESULT (simple));

	/* Create a new composer window from the loaded message and
	 * restore its snapshot file so it continues auto-saving to
	 * the same file. */
	shell = E_SHELL (object);
	g_object_ref (snapshot_file);
	composer = e_msg_composer_new_with_message (shell, message, TRUE, NULL);
	g_object_set_data_full (
		G_OBJECT (composer),
		SNAPSHOT_FILE_KEY, snapshot_file,
		(GDestroyNotify) delete_snapshot_file);
	context->composer = g_object_ref_sink (composer);
	g_object_unref (message);

	g_object_unref (object);

	g_simple_async_result_complete (simple);
	g_object_unref (simple);
}
Exemplo n.º 14
0
static gboolean deja_dup_config_rel_path_real_set_from_config_co (DejaDupConfigRelPathSetFromConfigData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = ((DejaDupConfigWidget*) _data_->self)->settings;
	_data_->_tmp1_ = deja_dup_config_widget_get_key ((DejaDupConfigWidget*) _data_->self);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = g_settings_get_value ((GSettings*) _data_->_tmp0_, _data_->_tmp2_);
	_data_->byte_val = _data_->_tmp3_;
	_data_->val = NULL;
	{
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = g_variant_get_bytestring (_data_->byte_val);
		_data_->_tmp5_ = NULL;
		_data_->_tmp5_ = g_filename_to_utf8 (_data_->_tmp4_, (gssize) (-1), NULL, NULL, &_data_->_inner_error_);
		_data_->_tmp6_ = _data_->_tmp5_;
		if (_data_->_inner_error_ != NULL) {
			goto __catch6_g_error;
		}
		_g_free0 (_data_->val);
		_data_->val = _data_->_tmp6_;
	}
	goto __finally6;
	__catch6_g_error:
	{
		_data_->e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp7_ = _data_->e;
		_data_->_tmp8_ = _data_->_tmp7_->message;
		g_warning ("ConfigRelPath.vala:39: %s\n", _data_->_tmp8_);
		_g_error_free0 (_data_->e);
	}
	__finally6:
	if (_data_->_inner_error_ != NULL) {
		_g_free0 (_data_->val);
		_g_variant_unref0 (_data_->byte_val);
		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;
	}
	_data_->_tmp9_ = _data_->val;
	if (_data_->_tmp9_ == NULL) {
		_data_->_tmp10_ = g_strdup ("");
		_g_free0 (_data_->val);
		_data_->val = _data_->_tmp10_;
	}
	_data_->_tmp11_ = ((DejaDupConfigEntry*) _data_->self)->entry;
	_data_->_tmp12_ = _data_->val;
	gtk_entry_set_text (_data_->_tmp11_, _data_->_tmp12_);
	_g_free0 (_data_->val);
	_g_variant_unref0 (_data_->byte_val);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}
Exemplo n.º 15
0
static void
imsi_read_ready (MMBaseModem *modem,
                 GAsyncResult *res,
                 GSimpleAsyncResult *simple)
{
    GError *error = NULL;
    const gchar *response, *str;
    gchar buf[19];
    gchar imsi[16];
    gsize len = 0;
    gint sw1, sw2;
    gint i;

    response = mm_base_modem_at_command_finish (modem, res, &error);
    if (!response) {
        g_simple_async_result_take_error (simple, error);
        g_simple_async_result_complete (simple);
        g_object_unref (simple);
        return;
    }

    memset (buf, 0, sizeof (buf));
    str = mm_strip_tag (response, "+CRSM:");

    /* With or without quotes... */
    if (sscanf (str, "%d,%d,\"%18c\"", &sw1, &sw2, (char *) &buf) != 3 &&
        sscanf (str, "%d,%d,%18c", &sw1, &sw2, (char *) &buf) != 3) {
        g_simple_async_result_set_error (simple,
                                         MM_CORE_ERROR,
                                         MM_CORE_ERROR_FAILED,
                                         "Failed to parse the CRSM response: '%s'",
                                         response);
        g_simple_async_result_complete (simple);
        g_object_unref (simple);
        return;
    }

    if ((sw1 != 0x90 || sw2 != 0x00) &&
        (sw1 != 0x91) &&
        (sw1 != 0x92) &&
        (sw1 != 0x9f)) {
        g_simple_async_result_set_error (simple,
                                         MM_CORE_ERROR,
                                         MM_CORE_ERROR_FAILED,
                                         "SIM failed to handle CRSM request (sw1 %d sw2 %d)",
                                         sw1, sw2);
        g_simple_async_result_complete (simple);
        g_object_unref (simple);
        return;
    }

    /* Make sure the buffer is only digits or 'F' */
    for (len = 0; len < sizeof (buf) && buf[len]; len++) {
        if (isdigit (buf[len]))
            continue;
        if (buf[len] == 'F' || buf[len] == 'f') {
            buf[len] = 'F';  /* canonicalize the F */
            continue;
        }
        if (buf[len] == '\"') {
            buf[len] = 0;
            break;
        }

        /* Invalid character */
        g_simple_async_result_set_error (simple,
                                         MM_CORE_ERROR,
                                         MM_CORE_ERROR_FAILED,
                                         "CRSM IMSI response contained invalid character '%c'",
                                         buf[len]);
        g_simple_async_result_complete (simple);
        g_object_unref (simple);
        return;
    }

    /* BCD encoded IMSIs plus the length byte and parity are 18 digits long */
    if (len != 18) {
        g_simple_async_result_set_error (simple,
                                         MM_CORE_ERROR,
                                         MM_CORE_ERROR_FAILED,
                                         "Invalid +CRSM IMSI response size (was %zd, expected 18)",
                                         len);
        g_simple_async_result_complete (simple);
        g_object_unref (simple);
        return;
    }

    /* Skip the length byte (digit 0-1) and parity (digit 3). Swap digits in
     * the EFimsi response to get the actual IMSI, each group of 2 digits is
     * reversed in the +CRSM response.  i.e.:
     *
     *    **0*21436587a9cbed -> 0123456789abcde
     */
    memset (imsi, 0, sizeof (imsi));
    imsi[0] = buf[2];
    for (i = 1; i < 8; i++) {
        imsi[(i * 2) - 1] = buf[(i * 2) + 3];
        imsi[i * 2] = buf[(i * 2) + 2];
    }

    /* Zero out the first F, if any, for IMSIs shorter than 15 digits */
    for (i = 0; i < 15; i++) {
        if (imsi[i] == 'F') {
            imsi[i++] = 0;
            break;
        }
    }

    /* Ensure all 'F's, if any, are at the end */
    for (; i < 15; i++) {
        if (imsi[i] != 'F') {
            g_simple_async_result_set_error (simple,
                                             MM_CORE_ERROR,
                                             MM_CORE_ERROR_FAILED,
                                             "Invalid +CRSM IMSI length (unexpected F)");
            g_simple_async_result_complete (simple);
            g_object_unref (simple);
            return;
        }
    }

    g_simple_async_result_set_op_res_gpointer (simple, imsi, NULL);
    g_simple_async_result_complete (simple);
    g_object_unref (simple);
}
static gboolean rotation_plugin_try_restore_state_co (RotationPluginTryRestoreStateData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->mrl;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = g_file_new_for_uri (_data_->_tmp0_);
	_data_->file = _data_->_tmp1_;
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = _data_->file;
	_data_->_tmp4_ = FALSE;
	_data_->_tmp4_ = g_file_has_uri_scheme (_data_->_tmp3_, "http");
	if (_data_->_tmp4_) {
		_data_->_tmp2_ = TRUE;
	} else {
		_data_->_tmp5_ = NULL;
		_data_->_tmp5_ = _data_->file;
		_data_->_tmp6_ = FALSE;
		_data_->_tmp6_ = g_file_has_uri_scheme (_data_->_tmp5_, "dvd");
		_data_->_tmp2_ = _data_->_tmp6_;
	}
	if (_data_->_tmp2_) {
		_g_object_unref0 (_data_->file);
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp7_ = NULL;
		_data_->_tmp7_ = _data_->file;
		_data_->_state_ = 1;
		g_file_query_info_async (_data_->_tmp7_, GIO_ROTATION_FILE_ATTRIBUTE, G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, NULL, rotation_plugin_try_restore_state_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp8_ = NULL;
		_data_->_tmp8_ = g_file_query_info_finish (_data_->_tmp7_, _data_->_res_, &_data_->_inner_error_);
		_data_->file_info = _data_->_tmp8_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			if (g_error_matches (_data_->_inner_error_, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED)) {
				goto __catch1_g_io_error_not_supported;
			}
			goto __catch1_g_error;
		}
		_data_->_tmp9_ = NULL;
		_data_->_tmp9_ = _data_->file_info;
		_data_->_tmp10_ = NULL;
		_data_->_tmp10_ = g_file_info_get_attribute_string (_data_->_tmp9_, GIO_ROTATION_FILE_ATTRIBUTE);
		_data_->_tmp11_ = NULL;
		_data_->_tmp11_ = g_strdup (_data_->_tmp10_);
		_data_->state_str = _data_->_tmp11_;
		_data_->_tmp12_ = NULL;
		_data_->_tmp12_ = _data_->state_str;
		if (_data_->_tmp12_ != NULL) {
			_data_->_tmp13_ = NULL;
			_data_->_tmp13_ = _data_->state_str;
			_data_->_tmp14_ = 0ULL;
			_data_->_tmp14_ = uint64_parse (_data_->_tmp13_);
			_data_->state = (gint) ((BvwRotation) _data_->_tmp14_);
			_data_->_tmp15_ = NULL;
			_data_->_tmp15_ = _data_->self->priv->bvw;
			_data_->_tmp16_ = 0;
			_data_->_tmp16_ = _data_->state;
			bacon_video_widget_set_rotation (_data_->_tmp15_, (BvwRotation) _data_->_tmp16_);
		}
		_g_free0 (_data_->state_str);
		_g_object_unref0 (_data_->file_info);
	}
	goto __finally1;
	__catch1_g_io_error_not_supported:
	{
		_data_->e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_g_error_free0 (_data_->e);
	}
	goto __finally1;
	__catch1_g_error:
	{
		_data_->_vala1_e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp17_ = NULL;
		_data_->_tmp17_ = _data_->_vala1_e;
		_data_->_tmp18_ = NULL;
		_data_->_tmp18_ = _data_->_tmp17_->message;
		g_warning ("totem-rotation-plugin.vala:175: Could not query file attribute: %s", _data_->_tmp18_);
		_g_error_free0 (_data_->_vala1_e);
	}
	__finally1:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		_g_object_unref0 (_data_->file);
		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_object_unref0 (_data_->file);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}
Exemplo n.º 17
0
static void
e_webdav_discover_content_refresh_done_cb (GObject *source_object,
					   GAsyncResult *result,
					   gpointer user_data)
{
	RefreshData *rd = user_data;
	ESource *source;
	gchar *certificate_pem = NULL;
	GTlsCertificateFlags certificate_errors = 0;
	GSList *discovered_sources = NULL;
	GSList *calendar_user_addresses = NULL;
	GError *local_error = NULL;

	g_return_if_fail (E_IS_SOURCE (source_object));
	g_return_if_fail (rd != NULL);

	source = E_SOURCE (source_object);

	if (!e_webdav_discover_sources_finish (source, result,
		&certificate_pem, &certificate_errors, &discovered_sources,
		&calendar_user_addresses, &local_error)) {
		if (!g_cancellable_is_cancelled (rd->cancellable) && certificate_pem &&
		    g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_SSL_FAILED)) {
			GtkWindow *parent;
			GtkWidget *widget;

			widget = gtk_widget_get_toplevel (rd->content);
			parent = widget ? GTK_WINDOW (widget) : NULL;

			e_trust_prompt_run_for_source (parent, source, certificate_pem, certificate_errors,
				NULL, FALSE, rd->cancellable, e_webdav_discover_content_trust_prompt_done_cb, rd);
			rd = NULL;
		} else if (g_cancellable_is_cancelled (rd->cancellable) ||
		    (!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED) &&
		    !g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_UNAUTHORIZED) &&
		    !g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_FORBIDDEN))) {
			g_simple_async_result_take_error (rd->simple, local_error);
			local_error = NULL;
			g_simple_async_result_complete (rd->simple);
		} else {
			EWebDAVDiscoverContentData *data;

			data = g_object_get_data (G_OBJECT (rd->content), WEBDAV_DISCOVER_CONTENT_DATA_KEY);
			g_return_if_fail (data != NULL);

			e_credentials_prompter_prompt (data->credentials_prompter, source,
				local_error ? local_error->message : NULL,
				rd->credentials ? E_CREDENTIALS_PROMPTER_PROMPT_FLAG_NONE:
				E_CREDENTIALS_PROMPTER_PROMPT_FLAG_ALLOW_STORED_CREDENTIALS,
				e_webdav_discover_content_credentials_prompt_done_cb, rd);
			rd = NULL;
		}
	} else {
		EWebDAVDiscoverContentData *data;

		data = g_object_get_data (G_OBJECT (rd->content), WEBDAV_DISCOVER_CONTENT_DATA_KEY);
		g_warn_if_fail (data != NULL);

		if (data) {
			e_webdav_discover_content_fill_discovered_sources (data->sources_tree_view,
				data->supports_filter, discovered_sources);
			e_webdav_discover_content_fill_calendar_emails (data->email_addresses_combo,
				calendar_user_addresses);
		}

		g_simple_async_result_set_op_res_gboolean (rd->simple, TRUE);
		g_simple_async_result_complete (rd->simple);
	}

	g_free (certificate_pem);
	e_webdav_discover_free_discovered_sources (discovered_sources);
	g_slist_free_full (calendar_user_addresses, g_free);
	refresh_data_free (rd);
	g_clear_error (&local_error);
}
static void
nwrat_query_ready (MMBaseModem *self,
                   GAsyncResult *res,
                   GSimpleAsyncResult *simple)
{
    LoadCurrentModesResult result;
    GError *error = NULL;
    const gchar *response;
    GRegex *r;
    GMatchInfo *match_info = NULL;
    gint a = -1;
    gint b = -1;

    response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
    if (!response) {
        g_simple_async_result_take_error (simple, error);
        g_simple_async_result_complete (simple);
        g_object_unref (simple);
        return;
    }

    /* Parse response */
    r = g_regex_new ("\\$NWRAT:\\s*(\\d),(\\d),(\\d)", G_REGEX_UNGREEDY, 0, NULL);
    g_assert (r != NULL);

    if (!g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, &error)) {
        if (error)
            g_simple_async_result_take_error (simple, error);
        else
            g_simple_async_result_set_error (simple,
                                             MM_CORE_ERROR,
                                             MM_CORE_ERROR_FAILED,
                                             "Couldn't match NWRAT reply: %s",
                                             response);
        g_simple_async_result_complete (simple);
        g_object_unref (simple);
        g_match_info_free (match_info);
        g_regex_unref (r);
        return;
    }

    if (!mm_get_int_from_match_info (match_info, 1, &a) ||
        !mm_get_int_from_match_info (match_info, 2, &b) ||
        a < 0 || a > 2 ||
        b < 1 || b > 2) {
        g_simple_async_result_set_error (
            simple,
            MM_CORE_ERROR,
            MM_CORE_ERROR_FAILED,
            "Failed to parse mode/tech response '%s': invalid modes reported",
            response);
        g_match_info_free (match_info);
        g_regex_unref (r);
        g_simple_async_result_complete (simple);
        g_object_unref (simple);
        return;
    }

    switch (a) {
    case 0:
        result.allowed = (MM_MODEM_MODE_2G | MM_MODEM_MODE_3G);
        result.preferred = MM_MODEM_MODE_NONE;
        break;
    case 1:
        if (b == 1) {
            result.allowed = MM_MODEM_MODE_2G;
            result.preferred = MM_MODEM_MODE_NONE;
        } else /* b == 2 */ {
            result.allowed = (MM_MODEM_MODE_2G | MM_MODEM_MODE_3G);
            result.preferred = MM_MODEM_MODE_2G;
        }
        break;
    case 2:
        if (b == 1) {
            result.allowed = MM_MODEM_MODE_3G;
            result.preferred = MM_MODEM_MODE_NONE;
        } else /* b == 2 */ {
            result.allowed = (MM_MODEM_MODE_2G | MM_MODEM_MODE_3G);
            result.preferred = MM_MODEM_MODE_3G;
        }
        break;
    default:
        /* We only allow mode 0|1|2 */
        g_assert_not_reached ();
        break;
    }

    g_match_info_free (match_info);
    g_regex_unref (r);

    /* When a valid result is given, we never complete in idle */
    g_simple_async_result_set_op_res_gpointer (simple, &result, NULL);
    g_simple_async_result_complete (simple);
    g_object_unref (simple);
}
Exemplo n.º 19
0
static gboolean gtm601_at_sim_get_service_center_number_real_run_co (Gtm601AtSimGetServiceCenterNumberRunData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = fso_gsm_abstract_mediator_get_modem ((FsoGsmAbstractMediator*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = fso_gsm_modem_createAtCommand (_data_->_tmp1_, FSO_GSM_TYPE_PLUS_CSCA, (GBoxedCopyFunc) g_object_ref, g_object_unref, "+CSCA");
	_data_->cmd = (FsoGsmPlusCSCA*) _data_->_tmp2_;
	_data_->_tmp3_ = fso_gsm_abstract_mediator_get_modem ((FsoGsmAbstractMediator*) _data_->self);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = NULL;
	_data_->_tmp5_ = fso_gsm_plus_csca_query (_data_->cmd);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = 0;
	_data_->_state_ = 1;
	fso_gsm_modem_processAtCommandAsync (_data_->_tmp4_, (FsoGsmAtCommand*) _data_->cmd, _data_->_tmp6_, FSO_GSM_MODEM_DEFAULT_RETRIES, 0, gtm601_at_sim_get_service_center_number_run_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp8_ = NULL;
	_data_->_tmp8_ = fso_gsm_modem_processAtCommandAsync_finish (_data_->_tmp4_, _data_->_res_, &_data_->_tmp7_);
	_data_->_tmp9_ = _data_->_tmp8_;
	_data_->_tmp9__length1 = _data_->_tmp7_;
	_g_free0 (_data_->_tmp6_);
	_data_->response = _data_->_tmp9_;
	_data_->response_length1 = _data_->_tmp9__length1;
	_data_->_response_size_ = _data_->response_length1;
	fso_gsm_checkResponseValid ((FsoGsmAtCommand*) _data_->cmd, _data_->response, _data_->response_length1, &_data_->_inner_error_);
	if (_data_->_inner_error_ != NULL) {
		if ((_data_->_inner_error_->domain == FREE_SMARTPHONE_GSM_ERROR) || (_data_->_inner_error_->domain == FREE_SMARTPHONE_ERROR)) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_data_->response = (_vala_array_free (_data_->response, _data_->response_length1, (GDestroyNotify) g_free), NULL);
			_g_object_unref0 (_data_->cmd);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_data_->response = (_vala_array_free (_data_->response, _data_->response_length1, (GDestroyNotify) g_free), NULL);
			_g_object_unref0 (_data_->cmd);
			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;
		}
	}
	_data_->_tmp10_ = _data_->cmd->number;
	_data_->_tmp11_ = NULL;
	_data_->_tmp11_ = codec_hexToString (_data_->_tmp10_, (guint) 0x20, (guint) 0x7f, NULL);
	_g_free0 (((FsoGsmSimGetServiceCenterNumber*) _data_->self)->number);
	((FsoGsmSimGetServiceCenterNumber*) _data_->self)->number = _data_->_tmp11_;
	_data_->response = (_vala_array_free (_data_->response, _data_->response_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (_data_->cmd);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}
Exemplo n.º 20
0
static gboolean gtm601_at_network_list_providers_real_run_co (Gtm601AtNetworkListProvidersRunData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = g_new0 (FreeSmartphoneGSMNetworkProvider, 0);
	_data_->providers_tmp = _data_->_tmp0_;
	_data_->providers_tmp_length1 = 0;
	_data_->_providers_tmp_size_ = _data_->providers_tmp_length1;
	_data_->_tmp1_ = fso_gsm_abstract_mediator_get_modem ((FsoGsmAbstractMediator*) _data_->self);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = fso_gsm_modem_createAtCommand (_data_->_tmp2_, FSO_GSM_TYPE_PLUS_COPS, (GBoxedCopyFunc) g_object_ref, g_object_unref, "+COPS");
	_data_->cmd = (FsoGsmPlusCOPS*) _data_->_tmp3_;
	_data_->_tmp4_ = fso_gsm_abstract_mediator_get_modem ((FsoGsmAbstractMediator*) _data_->self);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = NULL;
	_data_->_tmp6_ = fso_gsm_plus_cops_test (_data_->cmd);
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = 0;
	_data_->_state_ = 1;
	fso_gsm_modem_processAtCommandAsync (_data_->_tmp5_, (FsoGsmAtCommand*) _data_->cmd, _data_->_tmp7_, FSO_GSM_MODEM_DEFAULT_RETRIES, 0, gtm601_at_network_list_providers_run_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp9_ = NULL;
	_data_->_tmp9_ = fso_gsm_modem_processAtCommandAsync_finish (_data_->_tmp5_, _data_->_res_, &_data_->_tmp8_);
	_data_->_tmp10_ = _data_->_tmp9_;
	_data_->_tmp10__length1 = _data_->_tmp8_;
	_g_free0 (_data_->_tmp7_);
	_data_->response = _data_->_tmp10_;
	_data_->response_length1 = _data_->_tmp10__length1;
	_data_->_response_size_ = _data_->response_length1;
	fso_gsm_checkTestResponseValid ((FsoGsmAtCommand*) _data_->cmd, _data_->response, _data_->response_length1, &_data_->_inner_error_);
	if (_data_->_inner_error_ != NULL) {
		if ((_data_->_inner_error_->domain == FREE_SMARTPHONE_GSM_ERROR) || (_data_->_inner_error_->domain == FREE_SMARTPHONE_ERROR)) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_data_->response = (_vala_array_free (_data_->response, _data_->response_length1, (GDestroyNotify) g_free), NULL);
			_g_object_unref0 (_data_->cmd);
			_data_->providers_tmp = (_vala_FreeSmartphoneGSMNetworkProvider_array_free (_data_->providers_tmp, _data_->providers_tmp_length1), 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_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_data_->response = (_vala_array_free (_data_->response, _data_->response_length1, (GDestroyNotify) g_free), NULL);
			_g_object_unref0 (_data_->cmd);
			_data_->providers_tmp = (_vala_FreeSmartphoneGSMNetworkProvider_array_free (_data_->providers_tmp, _data_->providers_tmp_length1), 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;
		}
	}
	_data_->_tmp11_ = _data_->cmd->providers;
	_data_->_tmp11__length1 = _data_->cmd->providers_length1;
	{
		_data_->p_collection_length1 = 0;
		_data_->_p_collection_size_ = 0;
		_data_->p_collection = _data_->_tmp11_;
		_data_->p_collection_length1 = _data_->_tmp11__length1;
		for (_data_->p_it = 0; _data_->p_it < _data_->_tmp11__length1; _data_->p_it = _data_->p_it + 1) {
			memset (&_data_->_tmp12_, 0, sizeof (FreeSmartphoneGSMNetworkProvider));
			free_smartphone_gsm_network_provider_copy (&_data_->p_collection[_data_->p_it], &_data_->_tmp12_);
			_data_->p = _data_->_tmp12_;
			{
				_data_->_tmp13_ = _data_->providers_tmp;
				_data_->_tmp13__length1 = _data_->providers_tmp_length1;
				_data_->_tmp14_ = _data_->p;
				_data_->_tmp15_ = _data_->_tmp14_.status;
				_data_->_tmp16_ = _data_->p;
				_data_->_tmp17_ = _data_->_tmp16_.shortname;
				_data_->_tmp18_ = NULL;
				_data_->_tmp18_ = codec_hexToString (_data_->_tmp17_, (guint) 0x20, (guint) 0x7f, NULL);
				_data_->_tmp19_ = _data_->_tmp18_;
				_data_->_tmp20_ = _data_->p;
				_data_->_tmp21_ = _data_->_tmp20_.longname;
				_data_->_tmp22_ = NULL;
				_data_->_tmp22_ = codec_hexToString (_data_->_tmp21_, (guint) 0x20, (guint) 0x7f, NULL);
				_data_->_tmp23_ = _data_->_tmp22_;
				_data_->_tmp24_ = _data_->p;
				_data_->_tmp25_ = _data_->_tmp24_.mccmnc;
				_data_->_tmp26_ = _data_->p;
				_data_->_tmp27_ = _data_->_tmp26_.act;
				memset (&_data_->_tmp28_, 0, sizeof (FreeSmartphoneGSMNetworkProvider));
				free_smartphone_gsm_network_provider_init (&_data_->_tmp28_, _data_->_tmp15_, _data_->_tmp19_, _data_->_tmp23_, _data_->_tmp25_, _data_->_tmp27_);
				_vala_array_add1 (&_data_->providers_tmp, &_data_->providers_tmp_length1, &_data_->_providers_tmp_size_, &_data_->_tmp28_);
				_g_free0 (_data_->_tmp23_);
				_g_free0 (_data_->_tmp19_);
				free_smartphone_gsm_network_provider_destroy (&_data_->p);
			}
		}
	}
	_data_->_tmp29_ = _data_->providers_tmp;
	_data_->_tmp29__length1 = _data_->providers_tmp_length1;
	fso_gsm_network_list_providers_set_providers ((FsoGsmNetworkListProviders*) _data_->self, _data_->_tmp29_, _data_->_tmp29__length1);
	_data_->response = (_vala_array_free (_data_->response, _data_->response_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (_data_->cmd);
	_data_->providers_tmp = (_vala_FreeSmartphoneGSMNetworkProvider_array_free (_data_->providers_tmp, _data_->providers_tmp_length1), 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_object_unref (_data_->_async_result);
	return FALSE;
}
Exemplo n.º 21
0
static gboolean tracker_bus_fd_cursor_real_next_async_co (TrackerBusFdCursorNextAsyncData* _data_) {
#line 122 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	switch (_data_->_state_) {
#line 122 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		case 0:
#line 575 "tracker-bus-fd-cursor.c"
		goto _state_0;
		default:
#line 122 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		g_assert_not_reached ();
#line 580 "tracker-bus-fd-cursor.c"
	}
	_state_0:
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_data_->_tmp1_ = NULL;
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_data_->_tmp1_ = _data_->cancellable;
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_data_->_tmp2_ = FALSE;
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_data_->_tmp2_ = tracker_sparql_cursor_next ((TrackerSparqlCursor*) _data_->self, _data_->_tmp1_, &_data_->_inner_error_);
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_data_->_tmp0_ = _data_->_tmp2_;
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		g_error_free (_data_->_inner_error_);
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		if (_data_->_state_ == 0) {
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
			g_simple_async_result_complete_in_idle (_data_->_async_result);
#line 603 "tracker-bus-fd-cursor.c"
		} else {
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
			g_simple_async_result_complete (_data_->_async_result);
#line 607 "tracker-bus-fd-cursor.c"
		}
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		g_object_unref (_data_->_async_result);
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		return FALSE;
#line 613 "tracker-bus-fd-cursor.c"
	}
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_data_->result = _data_->_tmp0_;
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	if (_data_->_state_ == 0) {
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		g_simple_async_result_complete_in_idle (_data_->_async_result);
#line 621 "tracker-bus-fd-cursor.c"
	} else {
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		g_simple_async_result_complete (_data_->_async_result);
#line 625 "tracker-bus-fd-cursor.c"
	}
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	g_object_unref (_data_->_async_result);
#line 124 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	return FALSE;
#line 122 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	if (_data_->_state_ == 0) {
#line 122 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		g_simple_async_result_complete_in_idle (_data_->_async_result);
#line 635 "tracker-bus-fd-cursor.c"
	} else {
#line 122 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		g_simple_async_result_complete (_data_->_async_result);
#line 639 "tracker-bus-fd-cursor.c"
	}
#line 122 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	g_object_unref (_data_->_async_result);
#line 122 "/home/martyn/Source/checkout/gnome/tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	return FALSE;
#line 645 "tracker-bus-fd-cursor.c"
}
Exemplo n.º 22
0
static gboolean pdp_qmi_real_sc_activate_co (PdpQmiScActivateData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = fso_gsm_pdp_handler_get_modem ((FsoGsmPdpHandler*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = fso_gsm_modem_data (_data_->_tmp1_);
	_data_->data = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->data;
	_data_->_tmp4_ = _data_->_tmp3_->contextParams;
	if (_data_->_tmp4_ == NULL) {
		_data_->_tmp5_ = g_error_new_literal (FREE_SMARTPHONE_ERROR, FREE_SMARTPHONE_ERROR_INTERNAL_ERROR, "Context parameters not set");
		_data_->_inner_error_ = _data_->_tmp5_;
		if ((_data_->_inner_error_->domain == FREE_SMARTPHONE_GSM_ERROR) || (_data_->_inner_error_->domain == FREE_SMARTPHONE_ERROR)) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_g_object_unref0 (_data_->data);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->data);
			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;
		}
	}
	_data_->_tmp6_ = _data_->data;
	_data_->_tmp7_ = _data_->_tmp6_->contextParams;
	_data_->_tmp8_ = _data_->_tmp7_->apn;
	if (_data_->_tmp8_ == NULL) {
		_data_->_tmp9_ = g_error_new_literal (FREE_SMARTPHONE_ERROR, FREE_SMARTPHONE_ERROR_INTERNAL_ERROR, "APN not set");
		_data_->_inner_error_ = _data_->_tmp9_;
		if ((_data_->_inner_error_->domain == FREE_SMARTPHONE_GSM_ERROR) || (_data_->_inner_error_->domain == FREE_SMARTPHONE_ERROR)) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_g_object_unref0 (_data_->data);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->data);
			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;
		}
	}
	_data_->_tmp10_ = _data_->data;
	_data_->_tmp11_ = _data_->_tmp10_->contextParams;
	_data_->_tmp12_ = _data_->_tmp11_->apn;
	_data_->_tmp13_ = NULL;
	_data_->_tmp13_ = string_to_string (_data_->_tmp12_);
	_data_->_tmp14_ = _data_->data;
	_data_->_tmp15_ = _data_->_tmp14_->contextParams;
	_data_->_tmp16_ = _data_->_tmp15_->username;
	_data_->_tmp17_ = NULL;
	_data_->_tmp17_ = string_to_string (_data_->_tmp16_);
	_data_->_tmp18_ = _data_->data;
	_data_->_tmp19_ = _data_->_tmp18_->contextParams;
	_data_->_tmp20_ = _data_->_tmp19_->password;
	_data_->_tmp21_ = NULL;
	_data_->_tmp21_ = string_to_string (_data_->_tmp20_);
	_data_->_tmp22_ = NULL;
	_data_->_tmp22_ = g_strconcat ("up:", _data_->_tmp13_, " ", _data_->_tmp17_, " ", _data_->_tmp21_, NULL);
	_data_->cmdline = _data_->_tmp22_;
	_data_->_tmp23_ = _data_->self->fd;
	_data_->_tmp24_ = _data_->cmdline;
	_data_->_tmp25_ = _data_->cmdline;
	_data_->_tmp26_ = strlen (_data_->_tmp25_);
	_data_->_tmp27_ = _data_->_tmp26_;
	write (_data_->_tmp23_, _data_->_tmp24_, (gsize) _data_->_tmp27_);
	_g_free0 (_data_->cmdline);
	_g_object_unref0 (_data_->data);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}
Exemplo n.º 23
0
static gboolean fso_gsm_gsm_pdp_service_real_set_credentials_co (FsoGsmGsmPdpServiceSetCredentialsData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	fso_gsm_service_checkAvailability ((FsoGsmService*) _data_->self, FSO_GSM_MODEM_STATUS_ALIVE_NO_SIM, &_data_->_inner_error_);
	if (_data_->_inner_error_ != NULL) {
		if ((((_data_->_inner_error_->domain == FREE_SMARTPHONE_GSM_ERROR) || (_data_->_inner_error_->domain == FREE_SMARTPHONE_ERROR)) || (_data_->_inner_error_->domain == G_DBUS_ERROR)) || (_data_->_inner_error_->domain == G_IO_ERROR)) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			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;
		}
	}
	_data_->_tmp0_ = ((FsoGsmService*) _data_->self)->modem;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = fso_gsm_modem_createMediator (_data_->_tmp0_, FSO_GSM_TYPE_PDP_SET_CREDENTIALS, (GBoxedCopyFunc) g_object_ref, g_object_unref, &_data_->_inner_error_);
	_data_->m = (FsoGsmPdpSetCredentials*) _data_->_tmp1_;
	if (_data_->_inner_error_ != NULL) {
		if ((((_data_->_inner_error_->domain == FREE_SMARTPHONE_GSM_ERROR) || (_data_->_inner_error_->domain == FREE_SMARTPHONE_ERROR)) || (_data_->_inner_error_->domain == G_DBUS_ERROR)) || (_data_->_inner_error_->domain == G_IO_ERROR)) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			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;
		}
	}
	_data_->_tmp2_ = _data_->m;
	_data_->_tmp3_ = _data_->apn;
	_data_->_tmp4_ = _data_->username;
	_data_->_tmp5_ = _data_->password;
	_data_->_state_ = 1;
	fso_gsm_pdp_set_credentials_run (_data_->_tmp2_, _data_->_tmp3_, _data_->_tmp4_, _data_->_tmp5_, fso_gsm_gsm_pdp_service_set_credentials_ready, _data_);
	return FALSE;
	_state_1:
	fso_gsm_pdp_set_credentials_run_finish (_data_->_tmp2_, _data_->_res_, &_data_->_inner_error_);
	if (_data_->_inner_error_ != NULL) {
		if ((((_data_->_inner_error_->domain == FREE_SMARTPHONE_GSM_ERROR) || (_data_->_inner_error_->domain == FREE_SMARTPHONE_ERROR)) || (_data_->_inner_error_->domain == G_DBUS_ERROR)) || (_data_->_inner_error_->domain == G_IO_ERROR)) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_g_object_unref0 (_data_->m);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->m);
			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_object_unref0 (_data_->m);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}
Exemplo n.º 24
0
/**
 * shell_screenshot_screenshot_window:
 * @screenshot: the #ShellScreenshot
 * @include_frame: Whether to include the frame or not
 * @include_cursor: Whether to include the cursor or not
 * @filename: The filename for the screenshot
 * @callback: (scope async): function to call returning success or failure
 * of the async grabbing
 *
 * Takes a screenshot of the focused window (optionally omitting the frame)
 * in @filename as png image.
 *
 */
void
shell_screenshot_screenshot_window (ShellScreenshot *screenshot,
                                    gboolean include_frame,
                                    gboolean include_cursor,
                                    const char *filename,
                                    ShellScreenshotCallback callback)
{
  GSimpleAsyncResult *result;
  GSettings *settings;

  _screenshot_data *screenshot_data = g_new0 (_screenshot_data, 1);

  MetaScreen *screen = shell_global_get_screen (screenshot->global);
  MetaCursorTracker *tracker;
  MetaDisplay *display = meta_screen_get_display (screen);
  MetaWindow *window = meta_display_get_focus_window (display);
  ClutterActor *window_actor;
  gfloat actor_x, actor_y;
  MetaShapedTexture *stex;
  MetaRectangle rect;
  cairo_rectangle_int_t clip;

  screenshot_data->screenshot = g_object_ref (screenshot);
  screenshot_data->filename = g_strdup (filename);
  screenshot_data->callback = callback;

  if (!window)
    {
      screenshot_data->filename_used = g_strdup ("");
      result = g_simple_async_result_new (NULL, on_screenshot_written, (gpointer)screenshot_data, shell_screenshot_screenshot_window);
      g_simple_async_result_set_op_res_gboolean (result, FALSE);
      g_simple_async_result_complete (result);
      g_object_unref (result);

      return;
    }

  window_actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window));
  clutter_actor_get_position (window_actor, &actor_x, &actor_y);

  if (include_frame || !meta_window_get_frame (window))
    {
      meta_window_get_outer_rect (window, &rect);

      screenshot_data->screenshot_area.x = rect.x;
      screenshot_data->screenshot_area.y = rect.y;

      clip.x = rect.x - (gint) actor_x;
      clip.y = rect.y - (gint) actor_y;
    }
  else
    {
      rect = *meta_window_get_rect (window);

      screenshot_data->screenshot_area.x = (gint) actor_x + rect.x;
      screenshot_data->screenshot_area.y = (gint) actor_y + rect.y;

      clip.x = rect.x;
      clip.y = rect.y;
    }

  clip.width = screenshot_data->screenshot_area.width = rect.width;
  clip.height = screenshot_data->screenshot_area.height = rect.height;

  stex = META_SHAPED_TEXTURE (meta_window_actor_get_texture (META_WINDOW_ACTOR (window_actor)));
  screenshot_data->image = meta_shaped_texture_get_image (stex, &clip);

  settings = g_settings_new (A11Y_APPS_SCHEMA);
  if (include_cursor && !g_settings_get_boolean (settings, MAGNIFIER_ACTIVE_KEY))
    {
      tracker = meta_cursor_tracker_get_for_screen (screen);
      _draw_cursor_image (tracker, screenshot_data->image, screenshot_data->screenshot_area);
    }
  g_object_unref (settings);

  result = g_simple_async_result_new (NULL, on_screenshot_written, (gpointer)screenshot_data, shell_screenshot_screenshot_window);
  g_simple_async_result_run_in_thread (result, write_screenshot_thread, G_PRIORITY_DEFAULT, NULL);
  g_object_unref (result);
}
Exemplo n.º 25
0
static void hev_serial_port_read_async_handler(GObject *source_object,
			GAsyncResult *res, gpointer user_data)
{
	HevSerialPort *self = HEV_SERIAL_PORT(source_object);
	HevSerialPortPrivate *priv = HEV_SERIAL_PORT_GET_PRIVATE(self);
	GSimpleAsyncResult *simple = user_data;
	HevSerialPortQueueCommandData *data = NULL;
	gssize size = 0;
	GError *error = NULL;

	g_debug("%s:%d[%s]", __FILE__, __LINE__, __FUNCTION__);

	data = g_simple_async_result_get_op_res_gpointer(simple);
	size = hev_serial_port_read_finish(self, res, &error);
	if(-1 == size)
	{
		g_simple_async_result_take_error(simple, error);
		g_simple_async_result_set_op_res_gpointer(simple, NULL, NULL);
		g_simple_async_result_complete_in_idle(simple);
		g_object_unref(simple);

		if(data->read_buffer)
		  g_free(data->read_buffer);
		g_free(data);

		return;
	}

	/* Get read size */
	size = data->read_callback(data->read_buffer, data->read_size,
				data->user_data);
	if(0 < size)
	{
		gpointer old_buffer = data->read_buffer;
		gsize new_size = data->read_size+size;

		data->read_buffer = g_malloc0(new_size);
		if(data->read_buffer)
		{
			g_memmove(data->read_buffer, old_buffer, data->read_size);

			/* Read data */
			hev_serial_port_read_async(self, data->read_buffer+data->read_size, size,
						data->cancellable, hev_serial_port_read_async_handler,simple);

			data->read_size = new_size;
		}
		else
		{
			g_simple_async_result_set_error(simple, g_quark_from_static_string("Memory"),
						0, "Memory not enough!");
			g_simple_async_result_set_op_res_gpointer(simple, NULL, NULL);
			g_simple_async_result_complete_in_idle(simple);
			g_object_unref(simple);

			g_free(data);
		}

		g_free(old_buffer);
	}
	else
	{
		GByteArray *rdata = NULL;

		rdata = g_byte_array_new();
		g_byte_array_append(rdata, data->read_buffer, data->read_size);
		g_simple_async_result_set_op_res_gpointer(simple, rdata, NULL);
		g_simple_async_result_complete(simple);
		g_object_unref(simple);

		if(data->read_buffer)
		  g_free(data->read_buffer);
		g_free(data);
	}
}
Exemplo n.º 26
0
static void
read_async_cb (GObject *source,
               GAsyncResult *res,
               gpointer user_data)
{
  GSimpleAsyncResult *result = G_SIMPLE_ASYNC_RESULT (user_data);
  struct request_res *rr = g_simple_async_result_get_op_res_gpointer (result);;

  GError *error = NULL;
  gssize s = g_input_stream_read_finish (G_INPUT_STREAM (source), res, &error);

  gsize to_read;

  if (s > 0) {
    /* Continue reading */
    rr->offset += s;
    to_read = rr->length - rr->offset;

    if (!to_read) {
      /* Buffer is not enough; we need to assign more space */
      rr->length *= 2;
      rr->buffer = g_renew (gchar, rr->buffer, rr->length);
      to_read = rr->length - rr->offset;
    }

    g_input_stream_read_async (G_INPUT_STREAM (source),
                               rr->buffer + rr->offset,
                               to_read,
                               G_PRIORITY_DEFAULT,
                               NULL,
                               read_async_cb,
                               user_data);
    return;
  }

  /* Put the end of string */
  rr->buffer[rr->offset] = '\0';

  g_input_stream_close (G_INPUT_STREAM (source), NULL, NULL);

  if (error) {
    if (error->code == G_IO_ERROR_CANCELLED) {
      g_simple_async_result_set_error (result, GRL_NET_WC_ERROR,
                                       GRL_NET_WC_ERROR_CANCELLED,
                                       _("Operation was cancelled"));
    } else {
      g_simple_async_result_set_error (result, GRL_NET_WC_ERROR,
                                       GRL_NET_WC_ERROR_UNAVAILABLE,
                                       _("Data not available"));
    }

    g_error_free (error);

    g_simple_async_result_complete (result);
    g_object_unref (result);
    return;
  }

  {
    SoupMessage *msg =
      soup_request_http_get_message (SOUP_REQUEST_HTTP (rr->request));

    if (msg && msg->status_code != SOUP_STATUS_OK) {
        parse_error (msg->status_code,
                     msg->reason_phrase,
                     msg->response_body->data,
                     G_SIMPLE_ASYNC_RESULT (user_data));
        g_object_unref (msg);
    }
  }

  g_simple_async_result_complete (result);
  g_object_unref (result);
}
Exemplo n.º 27
0
static void
gabble_server_sasl_channel_accept_sasl (
    TpSvcChannelInterfaceSASLAuthentication *channel,
    DBusGMethodInvocation *context)
{
  GabbleServerSaslChannel *self = GABBLE_SERVER_SASL_CHANNEL (channel);
  GSimpleAsyncResult *r = self->priv->result;
  const gchar *message = NULL;


  switch (self->priv->sasl_status)
    {
    case TP_SASL_STATUS_NOT_STARTED:
      message = "Authentication has not yet begun (Not_Started)";
      break;

    case TP_SASL_STATUS_IN_PROGRESS:
      /* In this state, the only valid time to call this method is in response
       * to a challenge, to indicate that, actually, that challenge was
       * additional data for a successful authentication. */
      if (r == NULL)
        {
          message = "In_Progress, but you already responded to the last "
            "challenge";
        }
      else
        {
          DEBUG ("client says the last challenge was actually final data "
              "and has accepted it");
          g_assert (g_simple_async_result_is_valid (G_ASYNC_RESULT (r),
                G_OBJECT (self), gabble_server_sasl_channel_challenge_async));
          change_current_state (self, TP_SASL_STATUS_CLIENT_ACCEPTED, NULL,
              NULL);
        }
      break;

    case TP_SASL_STATUS_SERVER_SUCCEEDED:
      /* The server has already said yes, and the caller is waiting for
       * success_async(), i.e. waiting for the UI to check whether it's
       * happy too. AcceptSASL means that it is. */
      DEBUG ("client has accepted server's success");
      g_assert (g_simple_async_result_is_valid (G_ASYNC_RESULT (r),
            G_OBJECT (self), gabble_server_sasl_channel_success_async));
      change_current_state (self, TP_SASL_STATUS_SUCCEEDED, NULL, NULL);
      break;

    case TP_SASL_STATUS_CLIENT_ACCEPTED:
      message = "Client already accepted authentication (Client_Accepted)";
      break;

    case TP_SASL_STATUS_SUCCEEDED:
      message = "Authentication already succeeded (Succeeded)";
      break;

    case TP_SASL_STATUS_SERVER_FAILED:
      message = "Authentication has already failed (Server_Failed)";
      break;

    case TP_SASL_STATUS_CLIENT_FAILED:
      message = "Authentication has already been aborted (Client_Failed)";
      break;

    default:
      g_assert_not_reached ();
    }

  if (message != NULL)
    {
      DEBUG ("cannot accept SASL: %s", message);
      gabble_server_sasl_channel_raise (context, TP_ERROR_NOT_AVAILABLE,
          "%s", message);
      return;
    }

  if (r != NULL)
    {
      /* This is a bit weird - this code is run for two different async
       * results. In the In_Progress case, this code results in
       * success with the GSimpleAsyncResult's op_res left as NULL, which
       * is what Wocky wants for an empty response. In the Server_Succeeded
       * response, the async result is just success or error - we succeed. */
      self->priv->result = NULL;

      /* We want want to complete not in an idle because if we do we
       * will hit fd.o#32278. This is safe because we're being called
       * from dbus-glib in the main loop. */
      g_simple_async_result_complete (r);
      g_object_unref (r);
    }

  tp_svc_channel_interface_sasl_authentication_return_from_accept_sasl (
      context);
}
static gboolean rotation_plugin_store_state_co (RotationPluginStoreStateData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	g_object_get ((PeasActivatable*) _data_->self, "object", &_data_->_tmp0_, NULL);
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->t = G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp1_, totem_object_get_type (), TotemObject);
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = _data_->t;
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = totem_object_get_current_mrl (_data_->_tmp2_);
	_data_->mrl = _data_->_tmp3_;
	_data_->_tmp4_ = NULL;
	_data_->_tmp4_ = _data_->mrl;
	if (_data_->_tmp4_ == NULL) {
		_g_free0 (_data_->mrl);
		_g_object_unref0 (_data_->t);
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp5_ = NULL;
	_data_->_tmp5_ = _data_->mrl;
	_data_->_tmp6_ = NULL;
	_data_->_tmp6_ = g_file_new_for_uri (_data_->_tmp5_);
	_data_->file = _data_->_tmp6_;
	{
		_data_->_tmp7_ = NULL;
		_data_->_tmp7_ = _data_->file;
		_data_->_state_ = 1;
		g_file_query_info_async (_data_->_tmp7_, GIO_ROTATION_FILE_ATTRIBUTE, G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, NULL, rotation_plugin_store_state_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp8_ = NULL;
		_data_->_tmp8_ = g_file_query_info_finish (_data_->_tmp7_, _data_->_res_, &_data_->_inner_error_);
		_data_->file_info = _data_->_tmp8_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			if (g_error_matches (_data_->_inner_error_, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED)) {
				goto __catch0_g_io_error_not_supported;
			}
			goto __catch0_g_error;
		}
		_data_->_tmp9_ = NULL;
		_data_->_tmp9_ = g_strdup ("");
		_data_->state_str = _data_->_tmp9_;
		_data_->_tmp10_ = NULL;
		_data_->_tmp10_ = _data_->self->priv->bvw;
		_data_->_tmp11_ = 0;
		_data_->_tmp11_ = bacon_video_widget_get_rotation (_data_->_tmp10_);
		_data_->rotation = _data_->_tmp11_;
		_data_->_tmp12_ = 0;
		_data_->_tmp12_ = _data_->rotation;
		if (_data_->_tmp12_ != BVW_ROTATION_R_ZERO) {
			_data_->_tmp13_ = 0;
			_data_->_tmp13_ = _data_->rotation;
			_data_->_tmp14_ = NULL;
			_data_->_tmp14_ = g_strdup_printf ("%u", (guint) _data_->_tmp13_);
			_g_free0 (_data_->state_str);
			_data_->state_str = _data_->_tmp14_;
		}
		_data_->_tmp15_ = NULL;
		_data_->_tmp15_ = _data_->file_info;
		_data_->_tmp16_ = NULL;
		_data_->_tmp16_ = _data_->state_str;
		g_file_info_set_attribute_string (_data_->_tmp15_, GIO_ROTATION_FILE_ATTRIBUTE, _data_->_tmp16_);
		_data_->_tmp17_ = NULL;
		_data_->_tmp17_ = _data_->file;
		_data_->_tmp18_ = NULL;
		_data_->_tmp18_ = _data_->file_info;
		_data_->_state_ = 2;
		g_file_set_attributes_async (_data_->_tmp17_, _data_->_tmp18_, G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, NULL, rotation_plugin_store_state_ready, _data_);
		return FALSE;
		_state_2:
		g_file_set_attributes_finish (_data_->_tmp17_, _data_->_res_, NULL, &_data_->_inner_error_);
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			_g_free0 (_data_->state_str);
			_g_object_unref0 (_data_->file_info);
			if (g_error_matches (_data_->_inner_error_, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED)) {
				goto __catch0_g_io_error_not_supported;
			}
			goto __catch0_g_error;
		}
		_g_free0 (_data_->state_str);
		_g_object_unref0 (_data_->file_info);
	}
	goto __finally0;
	__catch0_g_io_error_not_supported:
	{
		_data_->e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_g_error_free0 (_data_->e);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->_vala1_e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp19_ = NULL;
		_data_->_tmp19_ = _data_->_vala1_e;
		_data_->_tmp20_ = NULL;
		_data_->_tmp20_ = _data_->_tmp19_->message;
		g_warning ("totem-rotation-plugin.vala:156: Could not store file attribute: %s", _data_->_tmp20_);
		_g_error_free0 (_data_->_vala1_e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		_g_object_unref0 (_data_->file);
		_g_free0 (_data_->mrl);
		_g_object_unref0 (_data_->t);
		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_object_unref0 (_data_->file);
	_g_free0 (_data_->mrl);
	_g_object_unref0 (_data_->t);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}
Exemplo n.º 29
0
static gboolean gtm601_at_call_list_calls_real_run_co (Gtm601AtCallListCallsRunData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->poll_again = FALSE;
	{
		_data_->_tmp0_ = TRUE;
		while (TRUE) {
			_data_->_tmp1_ = _data_->_tmp0_;
			if (!_data_->_tmp1_) {
				_data_->_tmp2_ = _data_->poll_again;
				if (!_data_->_tmp2_) {
					break;
				}
			}
			_data_->_tmp0_ = FALSE;
			_data_->poll_again = FALSE;
			_data_->_tmp3_ = fso_gsm_abstract_mediator_get_modem ((FsoGsmAbstractMediator*) _data_->self);
			_data_->_tmp4_ = _data_->_tmp3_;
			_data_->_tmp5_ = NULL;
			_data_->_tmp5_ = fso_gsm_modem_createAtCommand (_data_->_tmp4_, FSO_GSM_TYPE_PLUS_CLCC, (GBoxedCopyFunc) g_object_ref, g_object_unref, "+CLCC");
			_data_->cmd = (FsoGsmPlusCLCC*) _data_->_tmp5_;
			_data_->_tmp6_ = fso_gsm_abstract_mediator_get_modem ((FsoGsmAbstractMediator*) _data_->self);
			_data_->_tmp7_ = _data_->_tmp6_;
			_data_->_tmp8_ = _data_->cmd;
			_data_->_tmp9_ = _data_->cmd;
			_data_->_tmp10_ = NULL;
			_data_->_tmp10_ = fso_gsm_plus_clcc_execute (_data_->_tmp9_);
			_data_->_tmp11_ = _data_->_tmp10_;
			_data_->_tmp12_ = 0;
			_data_->_state_ = 1;
			fso_gsm_modem_processAtCommandAsync (_data_->_tmp7_, (FsoGsmAtCommand*) _data_->_tmp8_, _data_->_tmp11_, FSO_GSM_MODEM_DEFAULT_RETRIES, 0, gtm601_at_call_list_calls_run_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp13_ = NULL;
			_data_->_tmp13_ = fso_gsm_modem_processAtCommandAsync_finish (_data_->_tmp7_, _data_->_res_, &_data_->_tmp12_);
			_data_->_tmp14_ = _data_->_tmp13_;
			_data_->_tmp14__length1 = _data_->_tmp12_;
			_g_free0 (_data_->_tmp11_);
			_data_->response = _data_->_tmp14_;
			_data_->response_length1 = _data_->_tmp14__length1;
			_data_->_response_size_ = _data_->response_length1;
			_data_->_tmp15_ = _data_->cmd;
			_data_->_tmp16_ = _data_->response;
			_data_->_tmp16__length1 = _data_->response_length1;
			_data_->_tmp17_ = 0;
			_data_->_tmp17_ = fso_gsm_abstract_at_command_validateMulti ((FsoGsmAbstractAtCommand*) _data_->_tmp15_, _data_->_tmp16_, _data_->_tmp16__length1);
			_data_->code = _data_->_tmp17_;
			_data_->_tmp18_ = _data_->code;
			if (_data_->_tmp18_ == FSO_GSM_CONSTANTS_AT_RESPONSE_VALID) {
				_data_->_tmp19_ = _data_->cmd;
				_data_->_tmp20_ = _data_->_tmp19_->calls;
				_data_->_tmp20__length1 = _data_->_tmp19_->calls_length1;
				fso_gsm_call_list_calls_set_calls ((FsoGsmCallListCalls*) _data_->self, _data_->_tmp20_, _data_->_tmp20__length1);
			} else {
				_data_->_tmp21_ = _data_->code;
				if (_data_->_tmp21_ == FSO_GSM_CONSTANTS_AT_RESPONSE_CME_ERROR_100_UNKNOWN_ERROR) {
					_data_->poll_again = TRUE;
				} else {
					_data_->_tmp22_ = _data_->code;
					_data_->_tmp23_ = _data_->response;
					_data_->_tmp23__length1 = _data_->response_length1;
					_data_->_tmp24_ = _data_->response;
					_data_->_tmp24__length1 = _data_->response_length1;
					_data_->_tmp25_ = _data_->_tmp23_[_data_->_tmp24__length1 - 1];
					_data_->_tmp26_ = NULL;
					_data_->_tmp26_ = fso_gsm_constants_atResponseCodeToError (_data_->_tmp22_, _data_->_tmp25_);
					_data_->_inner_error_ = _data_->_tmp26_;
					if ((_data_->_inner_error_->domain == FREE_SMARTPHONE_GSM_ERROR) || (_data_->_inner_error_->domain == FREE_SMARTPHONE_ERROR)) {
						g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
						g_error_free (_data_->_inner_error_);
						_data_->response = (_vala_array_free (_data_->response, _data_->response_length1, (GDestroyNotify) g_free), NULL);
						_g_object_unref0 (_data_->cmd);
						if (_data_->_state_ == 0) {
							g_simple_async_result_complete_in_idle (_data_->_async_result);
						} else {
							g_simple_async_result_complete (_data_->_async_result);
						}
						g_object_unref (_data_->_async_result);
						return FALSE;
					} else {
						_data_->response = (_vala_array_free (_data_->response, _data_->response_length1, (GDestroyNotify) g_free), NULL);
						_g_object_unref0 (_data_->cmd);
						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;
					}
				}
			}
			_data_->response = (_vala_array_free (_data_->response, _data_->response_length1, (GDestroyNotify) g_free), NULL);
			_g_object_unref0 (_data_->cmd);
		}
	}
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}
Exemplo n.º 30
0
static gboolean gtm601_sms_handler_real_configureMessageIndications_co (gtm601_sms_handler_configureMessageIndicationsData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = fso_gsm_abstract_sms_handler_get_modem ((FsoGsmAbstractSmsHandler*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = fso_gsm_modem_createAtCommand (_data_->_tmp1_, FSO_GSM_TYPE_PLUS_CNMI, (GBoxedCopyFunc) g_object_ref, g_object_unref, "+CNMI");
	_data_->cnmi = (FsoGsmPlusCNMI*) _data_->_tmp2_;
	_data_->_tmp4_ = fso_gsm_abstract_sms_handler_get_modem ((FsoGsmAbstractSmsHandler*) _data_->self);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = NULL;
	_data_->_tmp6_ = fso_gsm_modem_data (_data_->_tmp5_);
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = _data_->_tmp7_->simBuffersSms;
	_data_->_tmp9_ = _data_->_tmp8_;
	_g_object_unref0 (_data_->_tmp7_);
	if (_data_->_tmp9_) {
		_data_->_tmp3_ = "+CNMI=2,1,2,1,1";
	} else {
		_data_->_tmp3_ = "+CNMI=2,2,2,1,1";
	}
	_data_->_tmp10_ = fso_gsm_abstract_sms_handler_get_modem ((FsoGsmAbstractSmsHandler*) _data_->self);
	_data_->_tmp11_ = _data_->_tmp10_;
	_data_->_tmp12_ = _data_->cnmi;
	_data_->_tmp13_ = _data_->_tmp3_;
	_data_->_tmp14_ = 0;
	_data_->_state_ = 1;
	fso_gsm_modem_processAtCommandAsync (_data_->_tmp11_, (FsoGsmAtCommand*) _data_->_tmp12_, _data_->_tmp13_, FSO_GSM_MODEM_DEFAULT_RETRIES, 0, gtm601_sms_handler_configureMessageIndications_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp15_ = NULL;
	_data_->_tmp15_ = fso_gsm_modem_processAtCommandAsync_finish (_data_->_tmp11_, _data_->_res_, &_data_->_tmp14_);
	_data_->response = _data_->_tmp15_;
	_data_->response_length1 = _data_->_tmp14_;
	_data_->_response_size_ = _data_->response_length1;
	_data_->_tmp16_ = _data_->cnmi;
	_data_->_tmp17_ = _data_->response;
	_data_->_tmp17__length1 = _data_->response_length1;
	_data_->_tmp18_ = 0;
	_data_->_tmp18_ = fso_gsm_abstract_at_command_validateOk ((FsoGsmAbstractAtCommand*) _data_->_tmp16_, _data_->_tmp17_, _data_->_tmp17__length1);
	if (_data_->_tmp18_ != FSO_GSM_CONSTANTS_AT_RESPONSE_OK) {
		_data_->result = FALSE;
		_data_->response = (_vala_array_free (_data_->response, _data_->response_length1, (GDestroyNotify) g_free), NULL);
		_g_object_unref0 (_data_->cnmi);
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = TRUE;
	_data_->response = (_vala_array_free (_data_->response, _data_->response_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (_data_->cnmi);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	_data_->response = (_vala_array_free (_data_->response, _data_->response_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (_data_->cnmi);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}