Пример #1
0
void
e_composer_load_snapshot (EShell *shell,
                          GFile *snapshot_file,
                          GCancellable *cancellable,
                          GAsyncReadyCallback callback,
                          gpointer user_data)
{
	GSimpleAsyncResult *simple;
	LoadContext *context;

	g_return_if_fail (E_IS_SHELL (shell));
	g_return_if_fail (G_IS_FILE (snapshot_file));

	context = g_slice_new0 (LoadContext);

	simple = g_simple_async_result_new (
		G_OBJECT (shell), callback, user_data,
		e_composer_load_snapshot);

	g_simple_async_result_set_check_cancellable (simple, cancellable);

	g_simple_async_result_set_op_res_gpointer (
		simple, context, (GDestroyNotify) load_context_free);

	g_file_load_contents_async (
		snapshot_file, cancellable, (GAsyncReadyCallback)
		load_snapshot_loaded_cb, simple);
}
Пример #2
0
static void
on_autorun_located (GObject      *source_object,
                    GAsyncResult *res,
                    gpointer      user_data)
{
  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
  GFile *autorun_path;
  GError *error;

  error = NULL;
  autorun_path = _g_find_file_insensitive_finish (G_FILE (source_object),
                                                  res,
                                                  &error);
  if (error != NULL)
    {
      g_simple_async_result_set_from_error (simple, error);
      g_simple_async_result_complete_in_idle (simple);
      g_object_unref (simple);
      g_error_free (error);
    }
  else
    {
      g_file_load_contents_async (autorun_path,
                                  g_object_get_data (G_OBJECT (simple), "cancellable"),
                                  on_autorun_loaded,
                                  simple);
      g_object_unref (autorun_path);
    }
}
Пример #3
0
NautilusThumbnailAsyncLoadHandle *
nautilus_thumbnail_load_image_async (const char *path,
				     guint base_size,
				     guint nominal_size,
				     gboolean force_nominal,
				     NautilusThumbnailAsyncLoadFunc load_func,
				     gpointer load_func_user_data)
{
	NautilusThumbnailAsyncLoadHandle *handle;
	GFile *location;


	handle = g_new (NautilusThumbnailAsyncLoadHandle, 1);
	handle->cancellable = g_cancellable_new ();
	handle->file_path = g_strdup (path);
	handle->base_size = base_size;
	handle->nominal_size = nominal_size;
	handle->force_nominal = force_nominal;
	handle->load_func = load_func;
	handle->load_func_user_data = load_func_user_data;


	location = g_file_new_for_path (path);
	g_file_load_contents_async (location, handle->cancellable,
				    async_thumbnail_read_image,
				    handle);
	g_object_unref (location);
	
	return handle;
}
void
_ide_back_forward_list_load_async (IdeBackForwardList  *self,
                                   GFile               *file,
                                   GCancellable        *cancellable,
                                   GAsyncReadyCallback  callback,
                                   gpointer             user_data)
{
  g_autoptr(GTask) task = NULL;

  g_assert (IDE_IS_BACK_FORWARD_LIST (self));
  g_assert (G_IS_FILE (file));
  g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));

#ifdef IDE_ENABLE_TRACE
  {
    g_autofree gchar *path = NULL;

    path = g_file_get_path (file);
    IDE_TRACE_MSG ("Loading %s", path);
  }
#endif

  task = g_task_new (self, cancellable, callback, user_data);

  g_file_load_contents_async (file,
                              cancellable,
                              ide_back_forward_list_load_cb,
                              g_object_ref (task));
}
Пример #5
0
static void
fm_ditem_page_create_begin (const char *uri,
                            GtkWidget *box)
{
    GFile *location;

    location = g_file_new_for_uri (uri);
    g_object_set_data_full (G_OBJECT (box), "uri", g_strdup (uri), g_free);
    g_file_load_contents_async (location, NULL, ditem_read_cb, g_object_ref (box));
    g_object_unref (location);
}
Пример #6
0
static void
process_gio (MexDownloadQueue *queue,
             DQTask           *task)
{
  task->gio.file = g_file_new_for_uri (task->any.uri);
  task->gio.cancellable = g_cancellable_new ();

  g_file_load_contents_async (task->gio.file,
                              task->gio.cancellable,
                              file_load_cb,
                              task);
}
void
hd_imageset_background_init_async (HDImagesetBackground *background,
                                   GCancellable         *cancellable,
                                   GAsyncReadyCallback   callback,
                                   gpointer              user_data)
{
  HDImagesetBackgroundPrivate *priv = background->priv;
  GSimpleAsyncResult *result;

  result = g_simple_async_result_new (G_OBJECT (background),
                                      callback,
                                      user_data,
                                      hd_imageset_background_init_async);

  g_file_load_contents_async (priv->desktop_file,
                              cancellable,
                              (GAsyncReadyCallback) load_desktop_file,
                              result);
}
Пример #8
0
void
g_vfs_mount_info_query_xdg_volume_info (GFile               *directory,
                                        GCancellable        *cancellable,
                                        GAsyncReadyCallback  callback,
                                        gpointer             user_data)
{
  GSimpleAsyncResult *simple;
  GFile *file;

  simple = g_simple_async_result_new (G_OBJECT (directory),
                                      callback,
                                      user_data,
                                      g_vfs_mount_info_query_xdg_volume_info);

  file = g_file_resolve_relative_path (directory, ".xdg-volume-info");
  g_file_load_contents_async (file,
                              cancellable,
                              on_xdg_volume_info_loaded,
                              simple);
  g_object_unref (file);
}