Ejemplo n.º 1
0
static void
on_bus_acquired (GDBusConnection *connection,
                 const gchar     *name,
                 gpointer         user_data)
{
  GError *error = NULL;

  g_debug ("Bus acquired, creating skeleton");

  helper = flatpak_system_helper_skeleton_new ();

  g_object_set_data_full (G_OBJECT(helper), "track-alive", GINT_TO_POINTER(42), skeleton_died_cb);

  g_dbus_interface_skeleton_set_flags (G_DBUS_INTERFACE_SKELETON (helper),
                                       G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD);

  g_signal_connect (helper, "handle-deploy", G_CALLBACK (handle_deploy), NULL);
  g_signal_connect (helper, "handle-deploy-appstream", G_CALLBACK (handle_deploy_appstream), NULL);
  g_signal_connect (helper, "handle-uninstall", G_CALLBACK (handle_uninstall), NULL);
  g_signal_connect (helper, "handle-install-bundle", G_CALLBACK (handle_install_bundle), NULL);
  g_signal_connect (helper, "handle-configure-remote", G_CALLBACK (handle_configure_remote), NULL);

  g_signal_connect (helper, "g-authorize-method",
                    G_CALLBACK (flatpak_authorize_method_handler),
                    NULL);

  if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (helper),
                                         connection,
                                         "/org/freedesktop/Flatpak/SystemHelper",
                                         &error))
    {
      g_warning ("error: %s\n", error->message);
      g_error_free (error);
    }
}
Ejemplo n.º 2
0
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);
}
Ejemplo n.º 3
0
static gboolean
update_iface (StoragedObject                     *object,
              const gchar                        *uevent_action,
              StoragedObjectHasInterfaceFunc      has_func,
              StoragedObjectConnectInterfaceFunc  connect_func,
              StoragedObjectUpdateInterfaceFunc   update_func,
              GType                               skeleton_type,
              gpointer                            _interface_pointer)
{
  gboolean ret = FALSE;
  gboolean has;
  gboolean add;
  GDBusInterface **interface_pointer = _interface_pointer;

  g_return_val_if_fail (object != NULL, FALSE);
  g_return_val_if_fail (has_func != NULL, FALSE);
  g_return_val_if_fail (update_func != NULL, FALSE);
  g_return_val_if_fail (g_type_is_a (skeleton_type, G_TYPE_OBJECT), FALSE);
  g_return_val_if_fail (g_type_is_a (skeleton_type, G_TYPE_DBUS_INTERFACE), FALSE);
  g_return_val_if_fail (interface_pointer != NULL, FALSE);
  g_return_val_if_fail (*interface_pointer == NULL || G_IS_DBUS_INTERFACE (*interface_pointer), FALSE);

  add = FALSE;
  has = has_func (object);
  if (*interface_pointer == NULL)
    {
      if (has)
        {
          *interface_pointer = g_object_new (skeleton_type, NULL);
          if (connect_func != NULL)
            connect_func (object);
          add = TRUE;
        }
    }
  else
    {
      if (!has)
        {
          g_dbus_object_skeleton_remove_interface (G_DBUS_OBJECT_SKELETON (object),
                                                   G_DBUS_INTERFACE_SKELETON (*interface_pointer));
          g_object_unref (*interface_pointer);
          *interface_pointer = NULL;
        }
    }

  if (*interface_pointer != NULL)
    {
      if (update_func (object, uevent_action, G_DBUS_INTERFACE (*interface_pointer)))
        ret = TRUE;
      if (add)
        g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object),
                                              G_DBUS_INTERFACE_SKELETON (*interface_pointer));
    }

  return ret;
}
void
gcal_shell_search_provider_dbus_unexport (GcalShellSearchProvider *search_provider,
                                          GDBusConnection         *connection,
                                          const gchar             *object_path)
{
  GcalShellSearchProviderPrivate *priv = GCAL_SHELL_SEARCH_PROVIDER (search_provider)->priv;

  if (g_dbus_interface_skeleton_has_connection (G_DBUS_INTERFACE_SKELETON (priv->skel), connection))
    g_dbus_interface_skeleton_unexport_from_connection (G_DBUS_INTERFACE_SKELETON (priv->skel), connection);
}
Ejemplo n.º 5
0
static void
ensure_credentials_cb (GoaProvider   *provider,
                       GAsyncResult  *res,
                       gpointer       user_data)
{
  EnsureData *data = user_data;
  gint expires_in;
  GError *error;

  error= NULL;
  if (!goa_provider_ensure_credentials_finish (provider, &expires_in, res, &error))
    {
      /* Set AttentionNeeded only if the error is an authorization error */
      if (is_authorization_error (error))
        {
          GoaAccount *account;
          account = goa_object_peek_account (data->object);
          if (!goa_account_get_attention_needed (account))
            {
              goa_account_set_attention_needed (account, TRUE);
              g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (account));
              g_message ("%s: Setting AttentionNeeded to TRUE because EnsureCredentials() failed with: %s (%s, %d)",
                         g_dbus_object_get_object_path (G_DBUS_OBJECT (data->object)),
                         error->message, g_quark_to_string (error->domain), error->code);
            }
        }
      g_dbus_method_invocation_return_gerror (data->invocation, error);
      g_error_free (error);
    }
  else
    {
      GoaAccount *account;
      account = goa_object_peek_account (data->object);

      /* Clear AttentionNeeded flag if set */
      if (goa_account_get_attention_needed (account))
        {
          goa_account_set_attention_needed (account, FALSE);
          g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (account));
          g_message ("%s: Setting AttentionNeeded to FALSE because EnsureCredentials() succeded\n",
                     g_dbus_object_get_object_path (G_DBUS_OBJECT (data->object)));
        }
      goa_account_complete_ensure_credentials (goa_object_peek_account (data->object),
                                               data->invocation,
                                               expires_in);
    }
  ensure_data_unref (data);
}
Ejemplo n.º 6
0
static gboolean
initable_init (GInitable *initable,
               GCancellable *cancellable,
               GError **error)
{
    MMManagerPrivate *priv = MM_MANAGER (initable)->priv;

    /* Create plugin manager */
    priv->plugin_manager = mm_plugin_manager_new (error);
    if (!priv->plugin_manager)
        return FALSE;

    /* Export the manager interface */
    if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (initable),
                                           priv->connection,
                                           MM_DBUS_PATH,
                                           error))
        return FALSE;

    /* Export the Object Manager interface */
    g_dbus_object_manager_server_set_connection (priv->object_manager,
                                                 priv->connection);

    /* All good */
    return TRUE;
}
Ejemplo n.º 7
0
gboolean
screenshot_init (GDBusConnection *bus,
                 GError **error)
{
  GDBusInterfaceSkeleton *helper;

  helper = G_DBUS_INTERFACE_SKELETON (xdp_impl_screenshot_skeleton_new ());

  g_signal_connect (helper, "handle-screenshot", G_CALLBACK (handle_screenshot), NULL);

  if (!g_dbus_interface_skeleton_export (helper,
                                         bus,
                                         DESKTOP_PORTAL_OBJECT_PATH,
                                         error))
    return FALSE;

  shell = org_gnome_shell_screenshot_proxy_new_sync (bus,
                                                     G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
                                                     "org.gnome.Shell.Screenshot",
                                                     "/org/gnome/Shell/Screenshot",
                                                     NULL,
                                                     error);
  if (shell == NULL)
    return FALSE;

  g_debug ("providing %s", g_dbus_interface_skeleton_get_info (helper)->name);

  return TRUE;
}
Ejemplo n.º 8
0
static void on_bus_acquired(GDBusConnection *bus,
                            const gchar *name,
                            gpointer user_data)
{
	LoginKitManager *interface;
	GError *error = NULL;

	interface = login_kit_manager_skeleton_new();
	g_signal_connect(interface,
	                 "handle-unlock-session",
	                 G_CALLBACK(on_handle_unlock_session),
	                 NULL);
	g_signal_connect(interface,
	                 "handle-list-seats",
	                 G_CALLBACK(on_handle_list_seats),
	                 NULL);
	g_signal_connect(interface,
	                 "handle-activate-session-on-seat",
	                 G_CALLBACK(on_handle_activate_session_on_seat),
	                 NULL);

	signals_subscribe(interface);

	if (!g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(interface),
	                                      bus,
	                                      "/org/freedesktop/login1",
	                                      &error)) {
		if (NULL != error)
			g_error_free(error);
	}
}
Ejemplo n.º 9
0
static gboolean
register_factory (GdmLocalDisplayFactory *factory)
{
        GError *error = NULL;

        error = NULL;
        factory->priv->connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
        if (factory->priv->connection == NULL) {
                g_critical ("error getting system bus: %s", error->message);
                g_error_free (error);
                exit (1);
        }

        factory->priv->skeleton = GDM_DBUS_LOCAL_DISPLAY_FACTORY (gdm_dbus_local_display_factory_skeleton_new ());

        g_signal_connect (factory->priv->skeleton,
                          "handle-create-transient-display",
                          G_CALLBACK (handle_create_transient_display),
                          factory);

        if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (factory->priv->skeleton),
                                               factory->priv->connection,
                                               GDM_LOCAL_DISPLAY_FACTORY_DBUS_PATH,
                                               &error)) {
                g_critical ("error exporting LocalDisplayFactory object: %s", error->message);
                g_error_free (error);
                exit (1);
        }

        return TRUE;
}
Ejemplo n.º 10
0
static void
on_bus_acquired (GDBusConnection *connection,
    const gchar *name,
    gpointer user_data)
{
  TcmmdDbus *self = user_data;
  GError *error = NULL;

  self->priv->connection = g_object_ref (connection);

  self->priv->iface = tcmmd_managed_connections_skeleton_new ();
  g_signal_connect (self->priv->iface, "handle-set-policy",
                    G_CALLBACK (handle_set_policy_cb), self);
  g_signal_connect (self->priv->iface, "handle-set-fixed-policy",
                    G_CALLBACK (handle_set_fixed_policy_cb), self);
  g_signal_connect (self->priv->iface, "handle-unset-policy",
                    G_CALLBACK (handle_unset_policy_cb), self);

  if (!g_dbus_interface_skeleton_export (
          G_DBUS_INTERFACE_SKELETON (self->priv->iface),
          self->priv->connection,
          "/org/tcmmd/ManagedConnections", &error))
    {
      g_critical ("Failed to export iface: %s", error->message);
      g_clear_error (&error);
    }
}
Ejemplo n.º 11
0
/**
 * @user_data: daemon itself
 */
static void 
_on_bus_acquired (GDBusConnection *connection,
                  const gchar     *name,
                  gpointer         user_data)
{
    RatdbProxyEngine *skeleton;
    GError *error = NULL;
    RatdbDaemonPrivate *priv = RATDB_DAEMON (user_data)->priv;

    g_debug ("Bus acquired");

    /* /org/ratdb/Interface */
    skeleton = ratdb_proxy_engine_skeleton_new ();
    if (error)
    {
        g_error (_("Couldn't create a skeleton for clients: %s"), error->message);
        g_error_free (error);
    }

    g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (skeleton), 
                                      connection, "/org/ratdb/Interface", &error);
    if (error)
    {
        g_error (_("Failed to export symbols: %s"), error->message);
        g_error_free (error);
    }

    /* handle functions */
    RATDB_CONNECT_DBUS_IFACE (request, ratdb_dbus_handler, priv->client_list);
    RATDB_CONNECT_DBUS_IFACE (remove_client, ratdb_dbus_handler, user_data);
    RATDB_CONNECT_DBUS_IFACE (new_database, ratdb_dbus_handler, user_data);
    RATDB_CONNECT_DBUS_IFACE (new_table, ratdb_dbus_handler, user_data);
}
Ejemplo n.º 12
0
void
gkd_secret_objects_register_collection (GkdSecretObjects *self,
					const gchar *collection_path)
{
	GkdExportedCollection *skeleton;
	GError *error = NULL;

	skeleton = g_hash_table_lookup (self->collections_to_skeletons, collection_path);
	if (skeleton != NULL) {
		g_warning ("asked to register collection %s, but it's already registered", collection_path);
		return;
	}

	skeleton = gkd_secret_collection_skeleton_new (self);
	g_hash_table_insert (self->collections_to_skeletons, g_strdup (collection_path), skeleton);

	g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (skeleton),
					  gkd_secret_service_get_connection (self->service),
					  collection_path, &error);
	if (error != NULL) {
		g_warning ("could not register secret collection on session bus: %s", error->message);
		g_error_free (error);
	}

	g_signal_connect (skeleton, "handle-create-item",
			  G_CALLBACK (collection_method_create_item), self);
	g_signal_connect (skeleton, "handle-delete",
			  G_CALLBACK (collection_method_delete), self);
	g_signal_connect (skeleton, "handle-search-items",
			  G_CALLBACK (collection_method_search_items), self);

	gkd_secret_objects_init_collection_items (self, collection_path);
}
Ejemplo n.º 13
0
static void
machines_init (Machines *machines)
{
  g_dbus_interface_skeleton_set_flags (G_DBUS_INTERFACE_SKELETON (machines),
                                       G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD);
  g_mutex_init (&machines->lock);
}
Ejemplo n.º 14
0
GDBusInterfaceSkeleton *
print_create (GDBusConnection *connection,
              const char *dbus_name,
              gpointer lockdown_proxy)
{
  g_autoptr(GError) error = NULL;

  lockdown = lockdown_proxy;

  impl = xdp_impl_print_proxy_new_sync (connection,
                                        G_DBUS_PROXY_FLAGS_NONE,
                                        dbus_name,
                                        DESKTOP_PORTAL_OBJECT_PATH,
                                        NULL,
                                        &error);
  if (impl == NULL)
    {
      g_warning ("Failed to create print proxy: %s", error->message);
      return NULL;
    }

  g_dbus_proxy_set_default_timeout (G_DBUS_PROXY (impl), G_MAXINT);

  print = g_object_new (print_get_type (), NULL);

  return G_DBUS_INTERFACE_SKELETON (print);
}
Ejemplo n.º 15
0
static void
gkd_secret_objects_register_item (GkdSecretObjects *self,
				  const gchar *item_path)
{
	GkdExportedItem *skeleton;
	GError *error = NULL;

	skeleton = g_hash_table_lookup (self->items_to_skeletons, item_path);
	if (skeleton != NULL) {
		g_warning ("asked to register item %s, but it's already registered", item_path);
		return;
	}

	skeleton = gkd_secret_item_skeleton_new (self);
	g_hash_table_insert (self->items_to_skeletons, g_strdup (item_path), skeleton);

	g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (skeleton),
					  gkd_secret_service_get_connection (self->service),
					  item_path, &error);
	if (error != NULL) {
		g_warning ("could not register secret item on session bus: %s", error->message);
		g_error_free (error);
	}

	g_signal_connect (skeleton, "handle-delete",
			  G_CALLBACK (item_method_delete), self);
	g_signal_connect (skeleton, "handle-get-secret",
			  G_CALLBACK (item_method_get_secret), self);
	g_signal_connect (skeleton, "handle-set-secret",
			  G_CALLBACK (item_method_set_secret), self);
}
Ejemplo n.º 16
0
static void
gom_application_dbus_unregister (GApplication *application,
                                 GDBusConnection *connection,
                                 const gchar *object_path)
{
  GomApplication *self = GOM_APPLICATION (application);

  if (self->skeleton != NULL)
    {
      if (g_dbus_interface_skeleton_has_connection (G_DBUS_INTERFACE_SKELETON (self->skeleton), connection))
        g_dbus_interface_skeleton_unexport_from_connection (G_DBUS_INTERFACE_SKELETON (self->skeleton),
                                                            connection);
    }

  G_APPLICATION_CLASS (gom_application_parent_class)->dbus_unregister (application, connection, object_path);
}
Ejemplo n.º 17
0
static gboolean
gom_application_dbus_register (GApplication *application,
                               GDBusConnection *connection,
                               const gchar *object_path,
                               GError **error)
{
  GomApplication *self = GOM_APPLICATION (application);
  gboolean retval = FALSE;

  if (!G_APPLICATION_CLASS (gom_application_parent_class)->dbus_register (application,
                                                                          connection,
                                                                          object_path,
                                                                          error))
    goto out;

  if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (self->skeleton),
                                         connection,
                                         object_path,
                                         error))
    goto out;

  retval = TRUE;

 out:
  return retval;
}
Ejemplo n.º 18
0
void bus_acquired (GObject *object,
                   GAsyncResult * res,
                   gpointer user_data)
{
  //g_debug("bus acquired");
  GDBusConnection *bus;
  GError *error = NULL;
  bus = g_bus_get_finish (res, &error);
  if (!bus) {
    //g_warning ("unable to connect to the session bus: %s", error->message);
    g_error_free (error);
    return;
  }
  g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (autopilot_introspection),
                                    bus,
                                    AUTOPILOT_INTROSPECTION_OBJECT_PATH.c_str(),
                                    &error);
  if (error) {
    //g_warning ("unable to export autopilot introspection service on dbus: %s", error->message);
    g_error_free (error);
    return;
  }
  g_signal_connect (autopilot_introspection,
                    "handle-get-state",
                    G_CALLBACK(handle_get_state),
                    NULL);
  g_signal_connect (autopilot_introspection,
                    "handle-get-version",
                    G_CALLBACK(handle_get_version),
                    NULL);
  g_object_unref (bus);
}
Ejemplo n.º 19
0
GDBusInterfaceSkeleton *
file_chooser_create (GDBusConnection *connection,
                     const char      *dbus_name)
{
  g_autoptr(GError) error = NULL;

  request_by_handle = g_hash_table_new_full (g_str_hash, g_str_equal,
                                             g_free, g_object_unref);

  impl = xdp_impl_file_chooser_proxy_new_sync (connection,
                                               G_DBUS_PROXY_FLAGS_NONE,
                                               dbus_name,
                                               "/org/freedesktop/portal/desktop",
                                               NULL, &error);
  if (impl == NULL)
    {
      g_warning ("Failed to create file chooser proxy: %s\n", error->message);
      return NULL;
    }

  set_proxy_use_threads (G_DBUS_PROXY (impl));

  file_chooser = g_object_new (file_chooser_get_type (), NULL);

  g_signal_connect (impl, "open-file-response", (GCallback)handle_open_file_response, NULL);
  g_signal_connect (impl, "open-files-response", (GCallback)handle_open_files_response, NULL);
  g_signal_connect (impl, "save-file-response", (GCallback)handle_save_file_response, NULL);

  return G_DBUS_INTERFACE_SKELETON (file_chooser);
}
Ejemplo n.º 20
0
static void
synce_device_dispose (GObject *obj)
{
  SynceDevice *self = SYNCE_DEVICE (obj);
  SynceDevicePrivate *priv = SYNCE_DEVICE_GET_PRIVATE (self);

  if (priv->dispose_has_run)
    return;

  priv->dispose_has_run = TRUE;

#if USE_GDBUS
  if (priv->interface) {
    g_dbus_interface_skeleton_unexport(G_DBUS_INTERFACE_SKELETON(priv->interface));
    g_object_unref(priv->interface);
  }
#endif

  g_io_stream_close(G_IO_STREAM(priv->conn), NULL, NULL);
  g_object_unref(priv->conn);

#if HAVE_GUDEV
  g_object_unref(priv->gudev_client);
#endif

  g_hash_table_destroy (priv->requests);

  if (G_OBJECT_CLASS (synce_device_parent_class)->dispose)
    G_OBJECT_CLASS (synce_device_parent_class)->dispose (obj);
}
Ejemplo n.º 21
0
void
synce_device_dbus_uninit(SynceDevice *self)
{
  SynceDevicePrivate *priv = SYNCE_DEVICE_GET_PRIVATE (self);
  g_return_if_fail(priv->inited && !(priv->dispose_has_run));

#if !USE_GDBUS
  GError *error = NULL;
  DBusGConnection *system_bus = NULL;
#endif

  g_message ("%s: unregistering object path '%s'", G_STRFUNC, priv->obj_path);

#if USE_GDBUS
  g_dbus_interface_skeleton_unexport(G_DBUS_INTERFACE_SKELETON(priv->interface));
  g_object_unref(priv->interface);
  priv->interface = NULL;

#else
  system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
  if (system_bus == NULL) {
    g_critical("Failed to connect to system bus: %s", error->message);
    g_error_free(error);
    return;
  }

  dbus_g_connection_unregister_g_object(system_bus, G_OBJECT(self));

  dbus_g_connection_unref(system_bus);
#endif

  return;
}
Ejemplo n.º 22
0
static void
on_bus_acquired (GDBusConnection *connection,
                 const gchar     *name,
                 gpointer         user_data)
{
  XdpDbusContentPortal *helper;
  GError *error = NULL;

  helper = xdp_dbus_content_portal_skeleton_new ();

  g_signal_connect (helper, "handle-open",
                    G_CALLBACK (handle_open), NULL);

  g_signal_connect (helper, "handle-create",
                    G_CALLBACK (handle_create), NULL);

  xdp_connection_track_name_owners (connection);

  if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (helper),
                                         connection,
                                         "/org/freedesktop/portal/content",
                                         &error))
    {
      g_warning ("error: %s\n", error->message);
      g_error_free (error);
    }
}
Ejemplo n.º 23
0
static void
on_bus_acquired (GDBusConnection *connection,
                 const gchar     *name,
                 gpointer         user_data)
{
  XdpDbusDocuments *helper;
  GError *error = NULL;

  helper = xdp_dbus_documents_skeleton_new ();

  g_signal_connect_swapped (helper, "handle-get-mount-point", G_CALLBACK (handle_get_mount_point), NULL);
  g_signal_connect_swapped (helper, "handle-add", G_CALLBACK (handle_method), portal_add);
  g_signal_connect_swapped (helper, "handle-add-named", G_CALLBACK (handle_method), portal_add_named);
  g_signal_connect_swapped (helper, "handle-grant-permissions", G_CALLBACK (handle_method), portal_grant_permissions);
  g_signal_connect_swapped (helper, "handle-revoke-permissions", G_CALLBACK (handle_method), portal_revoke_permissions);
  g_signal_connect_swapped (helper, "handle-delete", G_CALLBACK (handle_method), portal_delete);

  xdg_app_connection_track_name_owners (connection);

  if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (helper),
                                         connection,
                                         "/org/freedesktop/portal/documents",
                                         &error))
    {
      g_warning ("error: %s", error->message);
      g_error_free (error);
    }
}
Ejemplo n.º 24
0
GDBusInterfaceSkeleton *
trash_create (GDBusConnection *connection)
{
  trash = g_object_new (trash_get_type (), NULL);

  return G_DBUS_INTERFACE_SKELETON (trash);
}
Ejemplo n.º 25
0
/**
 * bus_acquired_cb - handler to invoke when connected to the bus 
 *                   of type bus_type or NULL.
 *
 * @connection: The GDBusConnection to a message bus
 * @bus_name  : The name that is requested to be owned
 * @user_data :
 *
 * returns:
 *     void
 *
 */
static void
bus_acquired_cb(GDBusConnection *connection,
                                const gchar     *bus_name,
                                gpointer        user_data)
{

  GError *pError = NULL;
  gchar *obj_path = user_data;

  INFO_LOG ("bus_acquired_cb ,Acquired session bus.\n");

  /** Second step: Try to get a connection to the given bus. */
  pSkeleton = gdbus_mcuinfo_skeleton_new();

  /** Third step: Attach to dbus signals. */
  (void) g_signal_connect(pSkeleton, "handle-send-mcuinfo", G_CALLBACK(method_send_mcuinfo), NULL);

  /** Fourth step: Export interface skeleton. */
  (void) g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(pSkeleton),
                                            connection,
                                            obj_path,//AUTOLINK_GDBUS_BUS_OBJECT_PATH,
                                            &pError);
  if(pError != NULL){
    ERR_LOG ("bus_acquired_cb: Failed to export object. Reason: %s.\n", pError->message);
    g_error_free(pError);
    g_main_loop_quit(mainloop);
  }

}
Ejemplo n.º 26
0
static gboolean
subprocess_backend_handle_create_cb (EDBusSubprocessBackend *proxy,
				     GDBusMethodInvocation *invocation,
				     const gchar *uid,
				     const gchar *backend_factory_type_name,
				     const gchar *module_filename,
				     ESubprocessBookFactory *subprocess_book_factory)
{
	gchar *object_path = NULL;
	GDBusConnection *connection;
	GError *error = NULL;

	connection = g_dbus_method_invocation_get_connection (invocation);

	object_path = e_subprocess_factory_open_backend (
		E_SUBPROCESS_FACTORY (subprocess_book_factory),
		connection,
		uid,
		backend_factory_type_name,
		module_filename,
		G_DBUS_INTERFACE_SKELETON (proxy),
		NULL,
		&error);

	if (object_path != NULL) {
		e_dbus_subprocess_backend_complete_create (proxy, invocation, object_path);
		g_free (object_path);
	} else {
		g_dbus_method_invocation_take_error (invocation, error);
	}

	return TRUE;
}
Ejemplo n.º 27
0
static void
nemo_dbus_manager_init (NemoDBusManager *self)
{
  GDBusConnection *connection;

  connection = g_application_get_dbus_connection (g_application_get_default ());

  self->object_manager = g_dbus_object_manager_server_new ("/org/Nemo");
  self->file_operations = nemo_dbus_file_operations_skeleton_new ();

  g_signal_connect (self->file_operations,
		    "handle-copy-uris",
		    G_CALLBACK (handle_copy_uris),
		    self);
  g_signal_connect (self->file_operations,
		    "handle-copy-file",
		    G_CALLBACK (handle_copy_file),
		    self);
  g_signal_connect (self->file_operations,
		    "handle-empty-trash",
		    G_CALLBACK (handle_empty_trash),
		    self);

  g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (self->file_operations), connection,
				    "/org/Nemo", NULL);

  g_dbus_object_manager_server_set_connection (self->object_manager, connection);
}
Ejemplo n.º 28
0
static void
storaged_linux_block_bcache_init (StoragedLinuxBlockBcache *self)
{
    g_dbus_interface_skeleton_set_flags (G_DBUS_INTERFACE_SKELETON (self),
                                         G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD);

}
Ejemplo n.º 29
0
static void
manager_init (Manager *manager)
{
  g_dbus_interface_skeleton_set_flags (G_DBUS_INTERFACE_SKELETON (manager),
                                       G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD);
  manager->cancellable = g_cancellable_new ();
}
Ejemplo n.º 30
0
static void bus_acquired_cb(GDBusConnection *connection, const gchar *name, gpointer user_data)
{
	GError *error = NULL;
	connman_agent_t *agent = user_data;

	agent->path = g_strdup(AGENT_DBUS_PATH);
	agent->interface = connman_interface_agent_skeleton_new();

	g_signal_connect(agent->interface, "handle-request-input", G_CALLBACK(request_input_cb), agent);
	g_signal_connect(agent->interface, "handle-report-error", G_CALLBACK(report_error_cb), agent);

	error = NULL;
	if (!g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(agent->interface), connection,
										  agent->path, &error))
	{
		g_error("Could not export agent object: %s", error->message);
		g_error_free(error);
	}

	if (agent->registered_cb != NULL) {
		agent->registered_cb(agent->registered_data);
	}

	g_message("Agent successfully exported");
}