• Home
  • Raw
  • Download

Lines Matching full:client

78 } Client;  typedef
86 static Client *
87 client_ref (Client *client) in client_ref() argument
89 g_atomic_int_inc (&client->ref_count); in client_ref()
90 return client; in client_ref()
94 client_unref (Client *client) in client_unref() argument
96 if (g_atomic_int_dec_and_test (&client->ref_count)) in client_unref()
98 if (client->connection != NULL) in client_unref()
100 if (client->name_owner_changed_subscription_id > 0) in client_unref()
101 …g_dbus_connection_signal_unsubscribe (client->connection, client->name_owner_changed_subscription_… in client_unref()
102 if (client->disconnected_signal_handler_id > 0) in client_unref()
103 … g_signal_handler_disconnect (client->connection, client->disconnected_signal_handler_id); in client_unref()
104 g_object_unref (client->connection); in client_unref()
106 g_free (client->name); in client_unref()
107 g_free (client->name_owner); in client_unref()
108 g_main_context_unref (client->main_context); in client_unref()
109 if (client->user_data_free_func != NULL) in client_unref()
110 client->user_data_free_func (client->user_data); in client_unref()
111 g_free (client); in client_unref()
125 Client *client; member
127 /* keep this separate because client->connection may
144 client_unref (data->client); in call_handler_data_free()
149 actually_do_call (Client *client, GDBusConnection *connection, const gchar *name_owner, CallType ca… in actually_do_call() argument
151 /* The client might have been cancelled (g_bus_unwatch_name()) while we were in actually_do_call()
153 if (client->cancelled) in actually_do_call()
159 if (client->name_appeared_handler != NULL) in actually_do_call()
161 client->name_appeared_handler (connection, in actually_do_call()
162 client->name, in actually_do_call()
164 client->user_data); in actually_do_call()
169 if (client->name_vanished_handler != NULL) in actually_do_call()
171 client->name_vanished_handler (connection, in actually_do_call()
172 client->name, in actually_do_call()
173 client->user_data); in actually_do_call()
187 actually_do_call (data->client, data->connection, data->name_owner, data->call_type); in call_in_idle_cb()
192 schedule_call_in_idle (Client *client, CallType call_type) in schedule_call_in_idle() argument
198 data->client = client_ref (client); in schedule_call_in_idle()
199 data->connection = client->connection != NULL ? g_object_ref (client->connection) : NULL; in schedule_call_in_idle()
200 data->name_owner = g_strdup (client->name_owner); in schedule_call_in_idle()
210 g_source_attach (idle_source, client->main_context); in schedule_call_in_idle()
215 do_call (Client *client, CallType call_type) in do_call() argument
221 if (current_context != client->main_context) in do_call()
222 schedule_call_in_idle (client, call_type); in do_call()
224 actually_do_call (client, client->connection, client->name_owner, call_type); in do_call()
229 call_appeared_handler (Client *client) in call_appeared_handler() argument
231 if (client->previous_call != PREVIOUS_CALL_APPEARED) in call_appeared_handler()
233 client->previous_call = PREVIOUS_CALL_APPEARED; in call_appeared_handler()
234 if (!client->cancelled && client->name_appeared_handler != NULL) in call_appeared_handler()
236 do_call (client, CALL_TYPE_NAME_APPEARED); in call_appeared_handler()
242 call_vanished_handler (Client *client) in call_vanished_handler() argument
244 if (client->previous_call != PREVIOUS_CALL_VANISHED) in call_vanished_handler()
246 client->previous_call = PREVIOUS_CALL_VANISHED; in call_vanished_handler()
247 if (!client->cancelled && client->name_vanished_handler != NULL) in call_vanished_handler()
249 do_call (client, CALL_TYPE_NAME_VANISHED); in call_vanished_handler()
256 /* Return a reference to the #Client for @watcher_id, or %NULL if it’s been
258 static Client *
261 Client *client; in dup_client() local
268 client = g_hash_table_lookup (map_id_to_client, GUINT_TO_POINTER (watcher_id)); in dup_client()
270 if (client != NULL) in dup_client()
271 client_ref (client); in dup_client()
275 return client; in dup_client()
279 * has started finalising the #Client. Avoid that by looking up the #Client
288 Client *client = NULL; in on_connection_disconnected() local
290 client = dup_client (watcher_id); in on_connection_disconnected()
291 if (client == NULL) in on_connection_disconnected()
294 if (client->name_owner_changed_subscription_id > 0) in on_connection_disconnected()
295 …g_dbus_connection_signal_unsubscribe (client->connection, client->name_owner_changed_subscription_… in on_connection_disconnected()
296 if (client->disconnected_signal_handler_id > 0) in on_connection_disconnected()
297 g_signal_handler_disconnect (client->connection, client->disconnected_signal_handler_id); in on_connection_disconnected()
298 g_object_unref (client->connection); in on_connection_disconnected()
299 client->disconnected_signal_handler_id = 0; in on_connection_disconnected()
300 client->name_owner_changed_subscription_id = 0; in on_connection_disconnected()
301 client->connection = NULL; in on_connection_disconnected()
303 call_vanished_handler (client); in on_connection_disconnected()
305 client_unref (client); in on_connection_disconnected()
310 /* Will always be called from the thread which acquired client->main_context. */
321 Client *client = NULL; in on_name_owner_changed() local
326 client = dup_client (watcher_id); in on_name_owner_changed()
327 if (client == NULL) in on_name_owner_changed()
330 if (!client->initialized) in on_name_owner_changed()
345 if (g_strcmp0 (name, client->name) != 0) in on_name_owner_changed()
348 if ((old_owner != NULL && strlen (old_owner) > 0) && client->name_owner != NULL) in on_name_owner_changed()
350 g_free (client->name_owner); in on_name_owner_changed()
351 client->name_owner = NULL; in on_name_owner_changed()
352 call_vanished_handler (client); in on_name_owner_changed()
357 g_warn_if_fail (client->name_owner == NULL); in on_name_owner_changed()
358 g_free (client->name_owner); in on_name_owner_changed()
359 client->name_owner = g_strdup (new_owner); in on_name_owner_changed()
360 call_appeared_handler (client); in on_name_owner_changed()
364 client_unref (client); in on_name_owner_changed()
374 Client *client = user_data; in get_name_owner_cb() local
381 result = g_dbus_connection_call_finish (client->connection, in get_name_owner_cb()
391 g_warn_if_fail (client->name_owner == NULL); in get_name_owner_cb()
392 client->name_owner = g_strdup (name_owner); in get_name_owner_cb()
393 call_appeared_handler (client); in get_name_owner_cb()
397 call_vanished_handler (client); in get_name_owner_cb()
400 client->initialized = TRUE; in get_name_owner_cb()
404 client_unref (client); in get_name_owner_cb()
410 invoke_get_name_owner (Client *client) in invoke_get_name_owner() argument
412 g_dbus_connection_call (client->connection, in invoke_get_name_owner()
417 g_variant_new ("(s)", client->name), in invoke_get_name_owner()
423 client_ref (client)); in invoke_get_name_owner()
433 Client *client = user_data; in start_service_by_name_cb() local
438 result = g_dbus_connection_call_finish (client->connection, in start_service_by_name_cb()
448 invoke_get_name_owner (client); in start_service_by_name_cb()
452 invoke_get_name_owner (client); in start_service_by_name_cb()
457 call_vanished_handler (client); in start_service_by_name_cb()
458 client->initialized = TRUE; in start_service_by_name_cb()
472 invoke_get_name_owner (client); in start_service_by_name_cb()
477 client_unref (client); in start_service_by_name_cb()
483 has_connection (Client *client) in has_connection() argument
486 client->disconnected_signal_handler_id = g_signal_connect (client->connection, in has_connection()
489 GUINT_TO_POINTER (client->id)); in has_connection()
492client->name_owner_changed_subscription_id = g_dbus_connection_signal_subscribe (client->connectio… in has_connection()
497 client->name, in has_connection()
500 … GUINT_TO_POINTER (client->id), in has_connection()
503 if (client->flags & G_BUS_NAME_WATCHER_FLAGS_AUTO_START) in has_connection()
505 g_dbus_connection_call (client->connection, in has_connection()
510 g_variant_new ("(su)", client->name, 0), in has_connection()
516 client_ref (client)); in has_connection()
521 invoke_get_name_owner (client); in has_connection()
531 Client *client = user_data; in connection_get_cb() local
533 client->connection = g_bus_get_finish (res, NULL); in connection_get_cb()
534 if (client->connection == NULL) in connection_get_cb()
536 call_vanished_handler (client); in connection_get_cb()
540 has_connection (client); in connection_get_cb()
543 client_unref (client); in connection_get_cb()
602 Client *client; in g_bus_watch_name() local
608 client = g_new0 (Client, 1); in g_bus_watch_name()
609 client->ref_count = 1; in g_bus_watch_name()
610 client->id = (guint) g_atomic_int_add (&next_global_id, 1); /* TODO: uh oh, handle overflow */ in g_bus_watch_name()
611 client->name = g_strdup (name); in g_bus_watch_name()
612 client->flags = flags; in g_bus_watch_name()
613 client->name_appeared_handler = name_appeared_handler; in g_bus_watch_name()
614 client->name_vanished_handler = name_vanished_handler; in g_bus_watch_name()
615 client->user_data = user_data; in g_bus_watch_name()
616 client->user_data_free_func = user_data_free_func; in g_bus_watch_name()
617 client->main_context = g_main_context_ref_thread_default (); in g_bus_watch_name()
624 GUINT_TO_POINTER (client->id), in g_bus_watch_name()
625 client); in g_bus_watch_name()
630 client_ref (client)); in g_bus_watch_name()
634 return client->id; in g_bus_watch_name()
663 Client *client; in g_bus_watch_name_on_connection() local
670 client = g_new0 (Client, 1); in g_bus_watch_name_on_connection()
671 client->ref_count = 1; in g_bus_watch_name_on_connection()
672 client->id = (guint) g_atomic_int_add (&next_global_id, 1); /* TODO: uh oh, handle overflow */ in g_bus_watch_name_on_connection()
673 client->name = g_strdup (name); in g_bus_watch_name_on_connection()
674 client->flags = flags; in g_bus_watch_name_on_connection()
675 client->name_appeared_handler = name_appeared_handler; in g_bus_watch_name_on_connection()
676 client->name_vanished_handler = name_vanished_handler; in g_bus_watch_name_on_connection()
677 client->user_data = user_data; in g_bus_watch_name_on_connection()
678 client->user_data_free_func = user_data_free_func; in g_bus_watch_name_on_connection()
679 client->main_context = g_main_context_ref_thread_default (); in g_bus_watch_name_on_connection()
685 GUINT_TO_POINTER (client->id), in g_bus_watch_name_on_connection()
686 client); in g_bus_watch_name_on_connection()
688 client->connection = g_object_ref (connection); in g_bus_watch_name_on_connection()
691 has_connection (client); in g_bus_watch_name_on_connection()
693 return client->id; in g_bus_watch_name_on_connection()
873 Client *client; in g_bus_unwatch_name() local
877 client = NULL; in g_bus_unwatch_name()
882 (client = g_hash_table_lookup (map_id_to_client, GUINT_TO_POINTER (watcher_id))) == NULL) in g_bus_unwatch_name()
888 client->cancelled = TRUE; in g_bus_unwatch_name()
895 if (client != NULL) in g_bus_unwatch_name()
897 client_unref (client); in g_bus_unwatch_name()