static void
empathy_tube_dispatch_name_has_owner_cb (TpDBusDaemon *proxy,
  gboolean has_owner, const GError *error, gpointer user_data,
  GObject *object)
{
  EmpathyTubeDispatch *self = EMPATHY_TUBE_DISPATCH (object);
  EmpathyTubeDispatchPriv *priv = GET_PRIV (self);

  if (error != NULL)
    {
      empathy_tube_dispatch_set_ability (self,
        EMPATHY_TUBE_DISPATCHABILITY_IMPOSSIBLE);
      return;
    }

  if (has_owner)
    {
      empathy_tube_dispatch_set_ability (self,
        EMPATHY_TUBE_DISPATCHABILITY_POSSIBLE);
    }
  else
    {
      tp_cli_dbus_daemon_call_list_activatable_names (priv->dbus, -1,
        empathy_tube_dispatch_list_activatable_names_cb, NULL, NULL,
        G_OBJECT (self));
    }
}
Example #2
0
static void
empathy_tube_dispatch_name_has_owner_cb (TpDBusDaemon *proxy,
  gboolean has_owner, const GError *error, gpointer user_data,
  GObject *object)
{
  EmpathyTubeDispatch *self = EMPATHY_TUBE_DISPATCH (object);
  EmpathyTubeDispatchPriv *priv = GET_PRIV (self);

  if (error != NULL)
    {
      DEBUG ("NameHasOwner failed. Can't dispatch tube");
      empathy_tube_dispatch_set_ability (self,
        EMPATHY_TUBE_DISPATCHABILITY_IMPOSSIBLE);
      return;
    }

  if (has_owner)
    {
      DEBUG ("Tube handler is running. Can dispatch it");
      empathy_tube_dispatch_set_ability (self,
        EMPATHY_TUBE_DISPATCHABILITY_POSSIBLE);
    }
  else
    {
      DEBUG ("Tube handler is not running. Calling ListActivatableNames");
      tp_cli_dbus_daemon_call_list_activatable_names (priv->dbus, -1,
        empathy_tube_dispatch_list_activatable_names_cb, NULL, NULL,
        G_OBJECT (self));
    }
}
static void
mcd_client_registry_list_names_cb (TpDBusDaemon *proxy,
    const gchar **names,
    const GError *error,
    gpointer user_data,
    GObject *weak_object)
{
  McdClientRegistry *self = MCD_CLIENT_REGISTRY (weak_object);

  if (error != NULL)
    {
      DEBUG ("ListNames returned error, assuming none: %s %d: %s",
          g_quark_to_string (error->domain), error->code, error->message);
    }
  else if (names != NULL)
    {
      const gchar **iter = names;

      DEBUG ("ListNames returned");

      while (*iter != NULL)
        {
          _mcd_client_registry_found_name (self, *iter, NULL, FALSE);
          iter++;
        }
    }

  tp_cli_dbus_daemon_call_list_activatable_names (proxy, -1,
      mcd_client_registry_list_activatable_names_cb,
      NULL, NULL, weak_object);
  /* deliberately not calling _mcd_client_registry_dec_startup_lock here -
   * this function is "lock-neutral", similarly to list_names_cb (we would
   * take a lock for ListActivatableNames then release the one used for
   * ReloadConfig), so simplify by doing nothing */
}