本文整理汇总了C++中G_DBUS_INTERFACE_SKELETON函数的典型用法代码示例。如果您正苦于以下问题:C++ G_DBUS_INTERFACE_SKELETON函数的具体用法?C++ G_DBUS_INTERFACE_SKELETON怎么用?C++ G_DBUS_INTERFACE_SKELETON使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_DBUS_INTERFACE_SKELETON函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_bus_acquired
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);
}
}
示例2: hev_dbus_object_test_notify_value_handler
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);
}
示例3: update_iface
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;
}
示例4: gcal_shell_search_provider_dbus_unexport
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);
}
示例5: ensure_credentials_cb
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);
}
示例6: initable_init
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;
}
示例7: screenshot_init
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;
}
示例8: on_bus_acquired
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);
}
}
示例9: register_factory
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;
}
示例10: on_bus_acquired
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);
}
}
示例11: _on_bus_acquired
/**
* @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);
}
示例12: gkd_secret_objects_register_collection
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);
}
示例13: machines_init
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);
}
示例14: print_create
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);
}
示例15: gkd_secret_objects_register_item
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);
}