static void hev_dbus_object_test_notify_value_handler(GObject *obj,
			GParamSpec *pspec, gpointer user_data)
{
	HevDBusInterfaceTest *self = HEV_DBUS_INTERFACE_TEST(user_data);
	HevDBusInterfaceTestPrivate *priv = HEV_DBUS_INTERFACE_TEST_GET_PRIVATE(self);
	GDBusConnection *connection = NULL;
	const gchar *object_path = NULL;
	GVariantBuilder *builder = NULL;
	GVariant *variant = NULL;
	gchar *p = NULL;

	g_debug("%s:%d[%s]", __FILE__, __LINE__, __FUNCTION__);

	connection = g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(self));
	object_path = g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(self));

	builder = g_variant_builder_new(G_VARIANT_TYPE_VARDICT);
	g_object_get(obj, "value", &p, NULL);
	g_variant_builder_add(builder, "{sv}", "Value", g_variant_new_string(p));
	variant = g_variant_builder_end(builder);
	g_variant_builder_unref(builder);
	variant = g_variant_new("(@a{sv})", variant);
	g_free(p);

	g_dbus_connection_emit_signal(connection, NULL, object_path,
				"org.freedesktop.DBus.Properties", "PropertiesChanged",
				variant, NULL);

	g_variant_unref(variant);
}
Пример #2
0
static void
dbus_idle_callback (MetaIdleMonitor *monitor,
                    guint            watch_id,
                    gpointer         user_data)
{
  DBusWatch *watch = user_data;
  GDBusInterfaceSkeleton *skeleton = G_DBUS_INTERFACE_SKELETON (watch->dbus_monitor);

  g_dbus_connection_emit_signal (g_dbus_interface_skeleton_get_connection (skeleton),
                                 watch->dbus_name,
                                 g_dbus_interface_skeleton_get_object_path (skeleton),
                                 "org.gnome.Mutter.IdleMonitor",
                                 "WatchFired",
                                 g_variant_new ("(u)", watch_id),
                                 NULL);
}
static void
os_dispose (GObject *object)
{
  RpmostreedOSExperimental *self = RPMOSTREED_OSEXPERIMENTAL (object);
  const gchar *object_path;

  object_path = g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON(self));
  if (object_path != NULL)
    {
      rpmostreed_daemon_unpublish (rpmostreed_daemon_get (),
                                   object_path, object);
    }

  g_clear_object (&self->transaction_monitor);

  G_OBJECT_CLASS (rpmostreed_osexperimental_parent_class)->dispose (object);
}
static void
dispose (GObject *object)
{
	NMSstpPluginPrivate *priv = NM_SSTP_PLUGIN_GET_PRIVATE (object);
	GDBusInterfaceSkeleton *skeleton = NULL;

	if (priv->dbus_skeleton)
		skeleton = G_DBUS_INTERFACE_SKELETON (priv->dbus_skeleton);

	if (skeleton) {
		if (g_dbus_interface_skeleton_get_object_path (skeleton))
			g_dbus_interface_skeleton_unexport (skeleton);
		g_signal_handlers_disconnect_by_func (skeleton, handle_need_secrets, object);
		g_signal_handlers_disconnect_by_func (skeleton, handle_set_state, object);
		g_signal_handlers_disconnect_by_func (skeleton, handle_set_ip4_config, object);
	}

	if (priv->connection)
		g_object_unref (priv->connection);

	G_OBJECT_CLASS (nm_sstp_plugin_parent_class)->dispose (object);
}
static void hev_dbus_object_test_changed_handler(GObject *obj,
			const gchar *value, gpointer user_data)
{
	HevDBusInterfaceTest *self = HEV_DBUS_INTERFACE_TEST(user_data);
	HevDBusInterfaceTestPrivate *priv = HEV_DBUS_INTERFACE_TEST_GET_PRIVATE(self);
	GDBusConnection *connection = NULL;
	const gchar *object_path = NULL;
	GVariant *variant = NULL;

	g_debug("%s:%d[%s]", __FILE__, __LINE__, __FUNCTION__);

	connection = g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(self));
	object_path = g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(self));

	variant = g_variant_new("(s)", value);

	g_dbus_connection_emit_signal(connection, NULL, object_path,
				HEV_DBUS_INTERFACE_TEST_NAME, "Changed",
				variant, NULL);

	g_variant_unref(variant);
}
Пример #6
0
static gboolean
handle_get_os (RPMOSTreeSysroot *object,
               GDBusMethodInvocation *invocation,
               const char *arg_name)
{
  RpmostreedSysroot *self = RPMOSTREED_SYSROOT (object);
  glnx_unref_object GDBusInterfaceSkeleton *os_interface = NULL;

  if (arg_name[0] == '\0')
    {
      rpmostree_sysroot_complete_get_os (object,
                                         invocation,
                                         rpmostree_sysroot_dup_booted (object));
      goto out;
    }

  os_interface = g_hash_table_lookup (self->os_interfaces, arg_name);
  if (os_interface != NULL)
    g_object_ref (os_interface);

  if (os_interface != NULL)
    {
      const char *object_path;
      object_path = g_dbus_interface_skeleton_get_object_path (os_interface);
      rpmostree_sysroot_complete_get_os (object, invocation, object_path);
    }
  else
    {
      g_dbus_method_invocation_return_error (invocation,
                                             G_IO_ERROR,
                                             G_IO_ERROR_NOT_FOUND,
                                             "OS name \"%s\" not found",
                                             arg_name);
    }

out:
  return TRUE;
}
Пример #7
0
static bool CAPeripheralRegisterAdvertisements(
    CAPeripheralContext * context)
{
    bool success = false;

    /*
      Register the OIC LE advertisement service with each BlueZ
      LE Advertisement Manager.
    */

    ca_mutex_lock(context->lock);

    char const * const advertisement_path =
        g_dbus_interface_skeleton_get_object_path(
            G_DBUS_INTERFACE_SKELETON(
                context->advertisement.advertisement));

    GList * managers = context->advertisement.managers;

    for (GList * l = managers; l != NULL; )
    {
        GDBusProxy * const manager = G_DBUS_PROXY(l->data);

        /**
         * @c org.bluez.LEAdvertisingManager1.RegisterService()
         * accepts two parameters: the advertisement object path, and
         * an options dictionary.  No options are used so pass a NULL
         * pointer to reflect an empty dictionary.
         *
         *  @todo The parameters don't change between loop iterations.
         *        Ideally we should initialize this variable before
         *        the loop is executed, but g_dbus_proxy_call_sync()
         *        takes ownership of the variant.  Is there anyway to
         *        create a non-floating GVariant and pass it to that
         *        function?
         */
        GVariant * const parameters =
            g_variant_new("(oa{sv})", advertisement_path, NULL);

        GError * error = NULL;

        GVariant * const ret =
            g_dbus_proxy_call_sync(
                manager,
                "RegisterAdvertisement",
                parameters,
                G_DBUS_CALL_FLAGS_NONE,
                -1,    // timeout (default == -1),
                NULL,  // cancellable
                &error);

        if (ret == NULL)
        {
            OIC_LOG_V(WARNING,
                      TAG,
                      "LE advertisement registration on %s failed: %s",
                      g_dbus_proxy_get_object_path(manager),
                      error->message);

            g_error_free(error);

            // We can't use the LE advertising manager.  Drop it.
            g_object_unref(manager);

            GList * const tmp = l;
            l = l->next;
            managers = g_list_delete_link(managers, tmp);

            continue;
        }

        g_variant_unref(ret);

        /*
          Note that we can do this in the for-statement because of
          the similar code in the error case above.
        */
        l = l->next;
    }

    // Use the updated list of managers.
    context->advertisement.managers = managers;

    if (managers == NULL)   // Empty
    {
        OIC_LOG(ERROR,
                TAG,
                "LE advertisment registration failed for all "
                "Bluetooth adapters.");
    }
    else
    {

        success = true;
    }

    ca_mutex_unlock(context->lock);

    return success;
}
Пример #8
0
const gchar *
storage_volume_group_get_object_path (StorageVolumeGroup *self)
{
  g_return_val_if_fail (STORAGE_IS_VOLUME_GROUP (self), NULL);
  return g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (self));
}