static void
on_gclue_manager_ready (GObject *source_object,
                        GAsyncResult *res,
                        gpointer user_data)
{
  CcPrivacyPanel *self;
  GDBusProxy *proxy;
  GError *error = NULL;

  proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
  if (proxy == NULL)
    {
      if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
        g_warning ("Failed to connect to Geoclue: %s", error->message);
      g_error_free (error);

      return;
    }
  self = user_data;
  self->priv->gclue_manager = proxy;

  g_signal_connect (self->priv->gclue_manager,
                    "g-properties-changed",
                    G_CALLBACK (on_gclue_manager_props_changed),
                    self);

  update_location_label (self);
}
Пример #2
0
static void
service_proxy_new_cb (GObject      *source_object,
                      GAsyncResult *res,
                      gpointer     user_data)
{
        GUPnPConnmanManager *manager;
        GDBusProxy          *service_proxy;
        GError              *error = NULL;
        CMService           *cm_service;
        const gchar         *path;

        service_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);

        if (error != NULL) {
                if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
                        g_warning ("Failed to create D-Bus proxy: %s", error->message);
                g_error_free (error);

                return;
        }

        manager = GUPNP_CONNMAN_MANAGER (user_data);
        path = g_dbus_proxy_get_object_path (service_proxy);
        cm_service = g_hash_table_lookup (manager->priv->cm_services, path);

        if (cm_service == NULL) {
		g_object_unref (service_proxy);

                return;
	}

        cm_service->proxy = service_proxy;
        cm_service_use (manager, cm_service);
}
static void
proxy_new_cb (GObject *source,
              GAsyncResult *result,
              gpointer user_data)
{
    EmpathyWebcredentialsMonitor *self;
    TpWeakRef *wr = user_data;
    GError *error = NULL;

    self = tp_weak_ref_dup_object (wr);
    if (self == NULL)
        goto out;

    self->priv->proxy = g_dbus_proxy_new_for_bus_finish (result, &error);
    if (self->priv->proxy == NULL)
    {
        g_debug ("Failed to create webcredentials proxy: %s", error->message);
        g_error_free (error);
        goto out;
    }

    update_failures (self);

    g_signal_connect (self->priv->proxy, "g-properties-changed",
                      G_CALLBACK (properties_changed_cb), self);

out:
    tp_weak_ref_destroy (wr);
    g_clear_object (&self);
}
Пример #4
0
static void
_connman_proxy_new_for_bus_cb (GObject               *object,
                               GAsyncResult          *res,
                               CarrickConnmanManager *self)
{
  GError *err = NULL;

  if (self->priv->cm) {
    g_signal_handlers_disconnect_by_func (self->priv->cm,
                                          G_CALLBACK (_connman_signal_cb),
                                          self);
    g_object_unref (self->priv->cm);
  }

  self->priv->cm = g_dbus_proxy_new_for_bus_finish (res, &err);
  if (err) {
    g_warning ("No connman proxy: %s", err->message);
    g_error_free (err);
    return;
  }

  g_signal_connect (self->priv->cm, "g-signal",
                    G_CALLBACK (_connman_signal_cb), self);

  g_dbus_proxy_call (self->priv->cm,
                     "GetProperties",
                     NULL,
                     G_DBUS_CALL_FLAGS_NONE,
                     -1,
                     NULL,
                     (GAsyncReadyCallback)_connman_get_properties_cb,
                     self);
}
Пример #5
0
static void
pkg_kit_proxy_new_cb (GObject *source,
    GAsyncResult *result,
    gpointer user_data)
{
  ClientCtx *ctx = user_data;
  GError *error = NULL;
  GDBusProxy *proxy;

  proxy = g_dbus_proxy_new_for_bus_finish (result, &error);
  if (proxy == NULL)
    {
      ctx_failed (ctx, error);
      return;
    }

  if (ctx->type == OP_TYPE_INSTALL)
      g_dbus_proxy_call (proxy, "InstallPackageNames",
          g_variant_new ("(u^a&ss)", 0, ctx->packages, ctx->options),
          G_DBUS_CALL_FLAGS_NONE, G_MAXINT, NULL, install_package_names_cb, ctx);
  else
      check_for_packages (proxy, ctx);

  g_object_unref (proxy);
}
static void
device_proxy_new_cb (GObject      *source_object,
                     GAsyncResult *res,
                     gpointer      user_data) {
        GUPnPNetworkManager *manager;
        GDBusProxy *device_proxy;
        NMDevice *nm_device = NULL;
        NMDeviceType type;
        GVariant *value;
        GError *error;

        error = NULL;

        device_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
        if (G_UNLIKELY (error != NULL)) {
                if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
                        g_message ("Failed to create D-Bus proxy: %s", error->message);
                g_error_free (error);

                goto done;
        }

        manager = GUPNP_NETWORK_MANAGER (user_data);

        value = g_dbus_proxy_get_cached_property (device_proxy, "DeviceType");
        if (G_UNLIKELY (value == NULL)) {
                goto done;
        }

        if (G_UNLIKELY (!g_variant_is_of_type (value, G_VARIANT_TYPE_UINT32))) {
                g_variant_unref (value);

                goto done;
        }

        type = g_variant_get_uint32 (value);
        g_variant_unref (value);

        nm_device = nm_device_new (manager, device_proxy);

        if (type == NM_DEVICE_TYPE_WIFI) {
                const char *path;

                path = g_dbus_proxy_get_object_path (nm_device->proxy);
                g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
                                          G_DBUS_PROXY_FLAGS_NONE,
                                          NULL,
                                          DBUS_SERVICE_NM,
                                          path,
                                          WIFI_INTERFACE,
                                          manager->priv->cancellable,
                                          wifi_proxy_new_cb,
                                          nm_device_ref (nm_device));
        } else
                use_new_device (manager, nm_device);

done:
        g_clear_pointer (&nm_device, (GDestroyNotify) nm_device_unref);
        g_clear_object (&device_proxy);
}
static void
on_perm_store_ready (GObject *source_object,
                     GAsyncResult *res,
                     gpointer user_data)
{
  CcPrivacyPanel *self;
  GDBusProxy *proxy;
  GVariant *params;
  GError *error = NULL;

  proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
  if (proxy == NULL)
    {
      if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
          g_warning ("Failed to connect to xdg-app permission store: %s",
                     error->message);
      g_error_free (error);

      return;
    }
  self = user_data;
  self->priv->perm_store = proxy;

  params = g_variant_new ("(ss)",
                          APP_PERMISSIONS_TABLE,
                          APP_PERMISSIONS_ID);
  g_dbus_proxy_call (self->priv->perm_store,
                     "Lookup",
                     params,
                     G_DBUS_CALL_FLAGS_NONE,
                     -1,
                     self->priv->cancellable,
                     on_perm_store_lookup_done,
                     self);
}
Пример #8
0
static void
on_kerberos_proxy_ready (GObject *object,
                         GAsyncResult *res,
                         gpointer user_data)
{
  RealmData *data = (RealmData *)user_data;

  GError *error = NULL;
  GDBusProxy *proxy = g_dbus_proxy_new_for_bus_finish (res, &error);

  if (error)
    {
      g_warning ("Unable to create realmd KerberosMembership proxy: %s", error->message);
      g_error_free (error);
    }

  data->details = get_realm_details (data->realmd_object, proxy);
  g_variant_ref (data->details);
  g_clear_object (&proxy);

  update_realm_configured (data);

  data->valid = TRUE;
  mark_realm_ready (data);
}
Пример #9
0
static void
on_hostname_proxy_ready (GObject *source,
                         GAsyncResult *result,
                         gpointer user_data)
{
  Manager *self = MANAGER (user_data);
  GError *error = NULL;

  self->hostname1_proxy = g_dbus_proxy_new_for_bus_finish (result, &error);
  if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
    {
      /* nothing */
    }
  else if (self->hostname1_proxy == NULL)
    {
      g_warning ("Unable to create hostname1 proxy: %s (%s, %d)",
                 error->message, g_quark_to_string (error->domain), error->code);
    }
  else
    {
      update_hostname1 (self);
      g_signal_connect (self->hostname1_proxy,
                        "g-properties-changed",
                        G_CALLBACK (on_hostname1_properties_changed),
                        self);
    }

  g_object_unref (self);
}
static void
got_manager_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
	GDBusProxy *proxy_manager;
	GError *error = NULL;
	guint32 pid;
	GnomeSettingsSession *session = GNOME_SETTINGS_SESSION (user_data);

	proxy_manager = g_dbus_proxy_new_for_bus_finish (res, &error);
	if (proxy_manager == NULL) {
		g_warning ("cannot connect to ConsoleKit: %s",
			   error->message);
		g_error_free (error);
		return;
	}

	/* get the session we are running in */
	pid = getpid ();
	g_dbus_proxy_call (proxy_manager,
			   "GetSessionForUnixProcess",
			   g_variant_new ("(u)", pid),
			   G_DBUS_CALL_FLAGS_NONE,
			   -1, session->priv->cancellable,
			   got_session_path_cb,
			   session);
	g_object_unref (proxy_manager);
}
Пример #11
0
static void
on_proxy_acquired (GObject *object,
                   GAsyncResult *res,
                   NMBluez5Manager *self)
{
	NMBluez5ManagerPrivate *priv = NM_BLUEZ5_MANAGER_GET_PRIVATE (self);
	GError *error = NULL;

	priv->proxy = g_dbus_proxy_new_for_bus_finish (res, &error);

	if (!priv->proxy) {
		nm_log_warn (LOGD_BT, "Couldn't acquire object manager proxy: %s", error->message);
		g_clear_error (&error);
		return;
	}

	g_signal_connect (priv->proxy, "notify::g-name-owner",
	                  G_CALLBACK (name_owner_changed_cb), self);

	/* Get already managed devices. */
	g_dbus_proxy_call (priv->proxy, "GetManagedObjects",
	                   NULL,
	                   G_DBUS_CALL_FLAGS_NONE,
	                   -1,
	                   NULL,
	                   (GAsyncReadyCallback) get_managed_objects_cb,
	                   self);

	_nm_dbus_signal_connect (priv->proxy, "InterfacesAdded", G_VARIANT_TYPE ("(oa{sa{sv}})"),
	                         G_CALLBACK (object_manager_interfaces_added), self);
	_nm_dbus_signal_connect (priv->proxy, "InterfacesRemoved", G_VARIANT_TYPE ("(oas)"),
	                         G_CALLBACK (object_manager_interfaces_removed), self);
}
Пример #12
0
static void
on_unit_proxy_ready (GObject *object,
                     GAsyncResult *res,
                     gpointer user_data)
{
  Services *services = user_data;
  gs_unref_object GDBusProxy *unit = g_dbus_proxy_new_for_bus_finish (res, NULL);
  if (unit)
    {
      const gchar *name, *description, *load_state, *active_state, *sub_state, *file_state;
      gs_unref_variant GVariant *n = g_dbus_proxy_get_cached_property (unit, "Id");
      gs_unref_variant GVariant *d = g_dbus_proxy_get_cached_property (unit, "Description");
      gs_unref_variant GVariant *l = g_dbus_proxy_get_cached_property (unit, "LoadState");
      gs_unref_variant GVariant *a = g_dbus_proxy_get_cached_property (unit, "ActiveState");
      gs_unref_variant GVariant *s = g_dbus_proxy_get_cached_property (unit, "SubState");
      gs_unref_variant GVariant *f = g_dbus_proxy_get_cached_property (unit, "UnitFileState");
      g_variant_get (n, "&s", &name);
      g_variant_get (d, "&s", &description);
      g_variant_get (l, "&s", &load_state);
      g_variant_get (a, "&s", &active_state);
      g_variant_get (s, "&s", &sub_state);
      g_variant_get (f, "&s", &file_state);

      cockpit_services_emit_service_update (COCKPIT_SERVICES (services),
                                            g_variant_new ("(ssssss)",
                                                           name,
                                                           description,
                                                           load_state,
                                                           active_state,
                                                           sub_state,
                                                           file_state));
    }
}
Пример #13
0
static void
adapter5_on_acquired (GObject *object, GAsyncResult *res, NMBluezDevice *self)
{
	NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self);
	GError *error;
	GVariant *v;

	priv->adapter5 = g_dbus_proxy_new_for_bus_finish (res, &error);
	if (!priv->adapter5) {
		nm_log_warn (LOGD_BT, "bluez[%s] failed to acquire adapter proxy: %s.", priv->path, error->message);
		g_clear_error (&error);
		g_signal_emit (self, signals[INITIALIZED], 0, FALSE);
	} else {
		g_signal_connect (priv->adapter5, "g-properties-changed",
		                  G_CALLBACK (adapter5_on_properties_changed), self);

		/* Check adapter's powered state */
		v = g_dbus_proxy_get_cached_property (priv->adapter5, "Powered");
		priv->adapter_powered = VARIANT_IS_OF_TYPE_BOOLEAN (v) ? g_variant_get_boolean (v) : FALSE;
		if (v)
			g_variant_unref (v);

		priv->initialized = TRUE;
		g_signal_emit (self, signals[INITIALIZED], 0, TRUE);

		check_emit_usable (self);
	}

	g_object_unref (self);
}
Пример #14
0
static void
on_dbus_ready(GObject *object, GAsyncResult *res, gpointer user_data)
{
  IndicatorWorkrave *self = INDICATOR_WORKRAVE(user_data);
  IndicatorWorkravePrivate *priv = INDICATOR_WORKRAVE_GET_PRIVATE(self);

  GError *error = NULL;
  GDBusProxy *proxy = g_dbus_proxy_new_for_bus_finish(res, &error);

  if (priv->workrave_proxy_cancel != NULL)
    {
      g_object_unref(priv->workrave_proxy_cancel);
      priv->workrave_proxy_cancel = NULL;
    }

  if (error != NULL)
    {
      g_warning("Could not grab DBus proxy for %s: %s", WORKRAVE_INDICATOR_SERVICE_NAME, error->message);
      g_error_free(error);
    }
  else
    {
      g_signal_connect(proxy, "g-signal", G_CALLBACK(on_dbus_signal), self);
      priv->workrave_proxy = proxy;

      priv->watch_id = g_bus_watch_name(G_BUS_TYPE_SESSION,
                                        "org.workrave.Workrave",
                                        G_BUS_NAME_WATCHER_FLAGS_NONE,
                                        on_workrave_appeared,
                                        on_workrave_vanished,
                                        self,
                                        NULL);
    }
}
static void
got_session_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
	GError *error = NULL;
	GnomeSettingsSession *session = GNOME_SETTINGS_SESSION (user_data);

	/* connect to session */
	session->priv->proxy_session = g_dbus_proxy_new_for_bus_finish (res,
									&error);
	if (session->priv->proxy_session == NULL) {
		g_warning ("cannot connect to %s: %s",
			   session->priv->session_id,
			   error->message);
		g_error_free (error);
		return;
	}

	/* is our session active */
	g_dbus_proxy_call (session->priv->proxy_session,
			   "IsActive",
			   NULL,
			   G_DBUS_CALL_FLAGS_NONE,
			   -1,
			   session->priv->cancellable,
			   is_active_cb,
			   session);
}
Пример #16
0
static void
_fcitx_client_create_ic_phase2_finished(GObject *source_object,
                                        GAsyncResult *res,
                                        gpointer user_data)
{
    FcitxClient* self = (FcitxClient*) user_data;
    GError* error = NULL;
    if (self->priv->cancellable) {
        g_object_unref (self->priv->cancellable);
        self->priv->cancellable = NULL;
    }
    if (self->priv->icproxy)
        g_object_unref(self->priv->icproxy);
    self->priv->icproxy = g_dbus_proxy_new_for_bus_finish(res, &error);

    if (error) {
        g_error_free(error);
    }

    if (!self->priv->icproxy)
        return;

    gchar* owner_name = g_dbus_proxy_get_name_owner(self->priv->icproxy);

    if (!owner_name) {
        g_object_unref(self->priv->icproxy);
        self->priv->icproxy = NULL;
        return;
    }
    g_free(owner_name);

    g_signal_connect(self->priv->icproxy, "g-signal", G_CALLBACK(_fcitx_client_g_signal), self);
    g_signal_emit(user_data, signals[CONNTECTED_SIGNAL], 0);
}
Пример #17
0
static void
on_dbus_proxy_ready (GObject      *source_object,
                     GAsyncResult *res,
                     gpointer      user_data)
{
        GTask *task = G_TASK (user_data);
        gpointer *info = g_task_get_source_object (task);
        GClueClientInfoPrivate *priv = GCLUE_CLIENT_INFO (info)->priv;
        GError *error = NULL;

        priv->dbus_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
        if (priv->dbus_proxy == NULL) {
                g_task_return_error (task, error);
                g_object_unref (task);
                return;
        }

        g_dbus_proxy_call (priv->dbus_proxy,
                           "GetConnectionUnixUser",
                           g_variant_new ("(s)", priv->bus_name),
                           G_DBUS_CALL_FLAGS_NONE,
                           -1,
                           g_task_get_cancellable (task),
                           on_get_user_id_ready,
                           task);
}
static void
nemo_proxy_ready_cb (GObject *object,
                         GAsyncResult *res,
                         gpointer _unused)
{
        GDBusProxy *proxy = NULL;
        GError *error = NULL;

        proxy = g_dbus_proxy_new_for_bus_finish (res, &error);

        if (proxy == NULL) {
                g_warning ("Unable to create a proxy object for the Nemo DBus interface: %s",
                           error->message);
                g_error_free (error);

                return;
        }

        g_dbus_proxy_call (proxy,
                           "EmptyTrash",
                           NULL,
                           G_DBUS_CALL_FLAGS_NONE,
                           -1,
                           NULL,
                           nemo_empty_trash_cb,
                           NULL);
}
static void
wifi_proxy_new_cb (GObject      *source_object,
                   GAsyncResult *res,
                   gpointer      user_data) {
        NMDevice *nm_device;
        GError *error;

        nm_device = (NMDevice *) user_data;
        error = NULL;

        nm_device->wifi_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
        if (G_UNLIKELY (error != NULL)) {
                if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
                        g_message ("Failed to create D-Bus proxy: %s", error->message);
                else
                        nm_device->manager = NULL;
                g_error_free (error);
                goto done;
        }

        use_new_device (nm_device->manager, nm_device);

done:
        nm_device_unref (nm_device);
}
Пример #20
0
static void
on_client_proxy_ready (GObject      *source_object,
                       GAsyncResult *res,
                       gpointer      user_data)
{
        GDBusProxy *client;
        GError *error = NULL;

        client = g_dbus_proxy_new_for_bus_finish (res, &error);
        if (error != NULL) {
            g_critical ("Failed to connect to GeoClue2 service: %s", error->message);

            exit (-3);
        }

        g_signal_connect (client, "g-signal",
                          G_CALLBACK (on_client_signal), user_data);

        g_dbus_proxy_call (client,
                           "Start",
                           NULL,
                           G_DBUS_CALL_FLAGS_NONE,
                           -1,
                           NULL,
                           on_start_ready,
                           user_data);
}
Пример #21
0
static void
on_proxy_acquired (GObject *object, GAsyncResult *res, NMBluezDevice *self)
{
	NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self);
	GError *error = NULL;

	priv->proxy = g_dbus_proxy_new_for_bus_finish (res, &error);

	if (!priv->proxy) {
		nm_log_warn (LOGD_BT, "bluez[%s] failed to acquire device proxy: %s.", priv->path, error->message);
		g_clear_error (&error);
		g_signal_emit (self, signals[INITIALIZED], 0, FALSE);
	} else {
		g_signal_connect (priv->proxy, "g-properties-changed",
		                  G_CALLBACK (properties_changed), self);
		if (priv->bluez_version == 4) {
			/* Watch for custom Bluez4 PropertyChanged signals */
			g_signal_connect (priv->proxy, "g-signal",
			                  G_CALLBACK (bluez4_property_changed), self);
		}

		query_properties (self);
	}
	g_object_unref (self);
}
static void
got_power_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
  GError *error = NULL;
  CcScreenPanelPrivate *priv = CC_SCREEN_PANEL (user_data)->priv;

  priv->proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
  if (priv->proxy == NULL)
    {
      g_printerr ("Error creating proxy: %s\n", error->message);
      g_error_free (error);
      return;
    }

  /* we want to change the bar if the user presses brightness buttons */
  g_signal_connect (priv->proxy,
                    "g-signal",
                    G_CALLBACK (on_signal),
                    user_data);

  /* get the initial state */
  g_dbus_proxy_call (priv->proxy,
                     "GetPercentage",
                     NULL,
                     G_DBUS_CALL_FLAGS_NONE,
                     200, /* we don't want to randomly move the bar */
                     priv->cancellable,
                     get_brightness_cb,
                     user_data);
}
Пример #23
0
static void
on_dbus_core_ready(GObject *object, GAsyncResult *res, gpointer user_data)
{
  IndicatorWorkrave *self = INDICATOR_WORKRAVE(user_data);
  IndicatorWorkravePrivate *priv = INDICATOR_WORKRAVE_GET_PRIVATE(self);

  GError *error = NULL;
  GDBusProxy *proxy = g_dbus_proxy_new_for_bus_finish(res, &error);

  if (priv->workrave_core_proxy_cancel != NULL)
    {
      g_object_unref(priv->workrave_core_proxy_cancel);
      priv->workrave_core_proxy_cancel = NULL;
    }

  if (error != NULL)
    {
      g_warning("Could not grab DBus proxy for %s: %s", WORKRAVE_INDICATOR_CORE_NAME, error->message);
      g_error_free(error);
    }
  else
    {
      g_signal_connect(proxy, "g-signal", G_CALLBACK(on_dbus_signal), self);
      priv->workrave_core_proxy = proxy;
    }

  indicator_workrave_check(self);
}
Пример #24
0
void DBusScreenSaverInterface::finishProxyDBusDaemonNew(GObject*,  // source_object
							GAsyncResult *res)
{
    GError* error = NULL;
    proxyDBusDaemon = g_dbus_proxy_new_for_bus_finish(res, &error);
    if (proxyDBusDaemon)
    {
	TRACE_DEBUG(<< "ok");
	screenSaver = &kdeScreenSaver;
	sendDBusDaemonGetNameOwner();
    }
    else
    {
static void
screensaver_dbus_proxy_new_cb (GObject * source,
    GAsyncResult * result, gpointer user_data)
{
  ScreenSaver *screensaver = (ScreenSaver *) user_data;

  screensaver->gs_proxy = g_dbus_proxy_new_for_bus_finish (result, NULL);
  if (!screensaver->gs_proxy)
    return;

  if (screensaver->disabled)
    screensaver_disable_dbus (screensaver);
}
Пример #26
0
static void
_fcitx_client_create_ic_phase1_finished(GObject *source_object,
                                        GAsyncResult *res,
                                        gpointer user_data)
{
    FcitxClient* self = (FcitxClient*) user_data;
    GError* error = NULL;
    if (self->priv->cancellable) {
        g_object_unref (self->priv->cancellable);
        self->priv->cancellable = NULL;
    }
    if (self->priv->improxy)
        g_object_unref(self->priv->improxy);
    self->priv->improxy = g_dbus_proxy_new_for_bus_finish(res, &error);
    if (error) {
        g_warning ("Create fcitx input method proxy failed: %s.", error->message);
        g_error_free(error);
    }
    if (!self->priv->improxy)
        return;

    gchar* owner_name = g_dbus_proxy_get_name_owner(self->priv->improxy);

    if (!owner_name) {
        g_object_unref(self->priv->improxy);
        self->priv->improxy = NULL;
        return;
    }
    g_free(owner_name);

    self->priv->cancellable = g_cancellable_new ();
    char* appname = fcitx_utils_get_process_name();
    int pid = getpid();
    g_dbus_proxy_call(
        self->priv->improxy,
        "CreateICv3",
        g_variant_new("(si)", appname, pid),
        G_DBUS_CALL_FLAGS_NONE,
        -1,           /* timeout */
        self->priv->cancellable,
        _fcitx_client_create_ic_cb,
        self
    );
    free(appname);

}
static void
on_wpas_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data)
{
	NMSupplicantInterface *self;
	NMSupplicantInterfacePrivate *priv;
	gs_free_error GError *error = NULL;
	GDBusProxy *wpas_proxy;
	GVariantBuilder props;

	wpas_proxy = g_dbus_proxy_new_for_bus_finish (result, &error);
	if (!wpas_proxy) {
		if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
			nm_log_warn (LOGD_SUPPLICANT, "Failed to acquire wpa_supplicant proxy: (%s)",
			             error ? error->message : "unknown");
			set_state (NM_SUPPLICANT_INTERFACE (user_data), NM_SUPPLICANT_INTERFACE_STATE_DOWN);
		}
		return;
	}

	self = NM_SUPPLICANT_INTERFACE (user_data);
	priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self);

	priv->wpas_proxy = wpas_proxy;

	/* Try to add the interface to the supplicant.  If the supplicant isn't
	 * running, this will start it via D-Bus activation and return the response
	 * when the supplicant has started.
	 */

	g_variant_builder_init (&props, G_VARIANT_TYPE_VARDICT);
	g_variant_builder_add (&props, "{sv}",
	                       "Driver",
	                       g_variant_new_string (priv->is_wireless ? DEFAULT_WIFI_DRIVER : "wired"));
	g_variant_builder_add (&props, "{sv}",
	                       "Ifname",
	                       g_variant_new_string (priv->dev));

	g_dbus_proxy_call (priv->wpas_proxy,
	                   "CreateInterface",
	                   g_variant_new ("(a{sv})", &props),
	                   G_DBUS_CALL_FLAGS_NONE,
	                   -1,
	                   priv->init_cancellable,
	                   (GAsyncReadyCallback) interface_add_cb,
	                   self);
}
Пример #28
0
static void
wifi_proxy_new_cb (GObject      *source_object,
                   GAsyncResult *res,
                   gpointer      user_data) {
        NMDevice *nm_device;
        GError *error;

        nm_device = (NMDevice *) user_data;
        error = NULL;

        nm_device->wifi_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
        if (G_UNLIKELY (error != NULL)) {
                g_message ("Failed to create D-Bus proxy: %s", error->message);
                g_error_free (error);
        }

        use_new_device (nm_device->manager, nm_device);
}
Пример #29
0
static void
on_realm_proxy_ready (GObject *object,
                      GAsyncResult *res,
                      gpointer user_data)
{
  RealmData *data = (RealmData *)user_data;

  GError *error = NULL;
  GDBusProxy *proxy = g_dbus_proxy_new_for_bus_finish (res, &error);

  if (error)
    {
      g_warning ("Unable to create realmd proxy: %s", error->message);
      g_error_free (error);
      mark_realm_ready (data);
      return;
    }

  g_signal_connect (proxy,
                    "g-properties-changed",
                    G_CALLBACK (on_realm_properties_changed),
                    data);

  data->realmd_object = proxy;

  gs_unref_variant GVariant *n = g_dbus_proxy_get_cached_property (proxy, "Name");

  if (n && g_variant_is_of_type (n, G_VARIANT_TYPE ("s")))
    {
      g_variant_get (n, "s", &data->name);

      g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
                                0,
                                NULL,
                                "org.freedesktop.realmd",
                                g_dbus_proxy_get_object_path (data->realmd_object),
                                "org.freedesktop.realmd.KerberosMembership",
                                NULL,
                                on_kerberos_proxy_ready,
                                data);
    }
  else
    mark_realm_ready (data);
}
static void
got_client_proxy (GObject *object,
                  GAsyncResult *res,
                  gpointer user_data)
{
        GDBusProxy *client_proxy;
        GError *error = NULL;

        client_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);

        if (error != NULL) {
                g_debug ("Unable to get the session client proxy: %s", error->message);
                g_error_free (error);
                return;
        }

        g_signal_connect (client_proxy, "g-signal",
                          G_CALLBACK (client_proxy_signal_cb), manager);
}