~ubuntu-branches/debian/sid/glib2.0/sid

« back to all changes in this revision

Viewing changes to gio/gsocketaddressenumerator.c

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2013-05-08 06:25:57 UTC
  • mfrom: (1.27.14) (3.1.181 experimental)
  • Revision ID: package-import@ubuntu.com-20130508062557-i7gbku66mls70gi2
Tags: 2.36.1-2
Merge experimental branch, upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "gsocketaddressenumerator.h"
23
23
#include "glibintl.h"
24
24
 
25
 
#include "gsimpleasyncresult.h"
 
25
#include "gtask.h"
26
26
 
27
27
 
28
28
G_DEFINE_ABSTRACT_TYPE (GSocketAddressEnumerator, g_socket_address_enumerator, G_TYPE_OBJECT);
95
95
                                             GAsyncReadyCallback       callback,
96
96
                                             gpointer                  user_data)
97
97
{
98
 
  GSimpleAsyncResult *result;
 
98
  GTask *task;
99
99
  GSocketAddress *address;
100
100
  GError *error = NULL;
101
101
 
102
 
  result = g_simple_async_result_new (G_OBJECT (enumerator),
103
 
                                      callback, user_data,
104
 
                                      g_socket_address_enumerator_real_next_async);
 
102
  task = g_task_new (enumerator, NULL, callback, user_data);
 
103
 
105
104
  address = g_socket_address_enumerator_next (enumerator, cancellable, &error);
106
 
  if (address)
107
 
    g_simple_async_result_set_op_res_gpointer (result, address, NULL);
108
 
  else if (error)
109
 
    g_simple_async_result_take_error (result, error);
 
105
  if (error)
 
106
    g_task_return_error (task, error);
 
107
  else
 
108
    g_task_return_pointer (task, address, g_object_unref);
110
109
 
111
 
  g_simple_async_result_complete_in_idle (result);
112
 
  g_object_unref (result);
 
110
  g_object_unref (task);
113
111
}
114
112
 
115
113
/**
144
142
                                              GAsyncResult              *result,
145
143
                                              GError                   **error)
146
144
{
147
 
  GSimpleAsyncResult *simple;
148
 
 
149
 
  g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), NULL);
150
 
  simple = G_SIMPLE_ASYNC_RESULT (result);
151
 
  g_return_val_if_fail (g_simple_async_result_get_source_tag (simple) == g_socket_address_enumerator_real_next_async, NULL);
152
 
 
153
 
  if (g_simple_async_result_propagate_error (simple, error))
154
 
    return NULL;
155
 
  else
156
 
    return g_simple_async_result_get_op_res_gpointer (simple);
 
145
  g_return_val_if_fail (g_task_is_valid (result, enumerator), NULL);
 
146
 
 
147
  return g_task_propagate_pointer (G_TASK (result), error);
157
148
}
158
149
 
159
150
/**