本文整理汇总了C++中G_DBUS_OBJECT_SKELETON函数的典型用法代码示例。如果您正苦于以下问题:C++ G_DBUS_OBJECT_SKELETON函数的具体用法?C++ G_DBUS_OBJECT_SKELETON怎么用?C++ G_DBUS_OBJECT_SKELETON使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_DBUS_OBJECT_SKELETON函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: create_monitor_skeleton
static void
create_monitor_skeleton (GDBusObjectManagerServer *manager,
MetaIdleMonitor *monitor,
const char *path)
{
MetaDBusIdleMonitor *skeleton;
MetaDBusObjectSkeleton *object;
skeleton = meta_dbus_idle_monitor_skeleton_new ();
g_signal_connect_object (skeleton, "handle-add-idle-watch",
G_CALLBACK (handle_add_idle_watch), monitor, 0);
g_signal_connect_object (skeleton, "handle-add-user-active-watch",
G_CALLBACK (handle_add_user_active_watch), monitor, 0);
g_signal_connect_object (skeleton, "handle-remove-watch",
G_CALLBACK (handle_remove_watch), monitor, 0);
g_signal_connect_object (skeleton, "handle-reset-idletime",
G_CALLBACK (handle_reset_idletime), monitor, 0);
g_signal_connect_object (skeleton, "handle-get-idletime",
G_CALLBACK (handle_get_idletime), monitor, 0);
object = meta_dbus_object_skeleton_new (path);
meta_dbus_object_skeleton_set_idle_monitor (object, skeleton);
g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object));
g_object_unref (skeleton);
g_object_unref (object);
}
示例3: hs_dbus_handler_bus_acquired
void
hs_dbus_handler_bus_acquired (GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
HsObjectSkeleton *object;
HsPower *power;
HsSession *session;
manager = g_dbus_object_manager_server_new ("/org/home/hsession/Manager");
object = hs_object_skeleton_new ("/org/home/hsession/Manager/Proxy");
power = hs_power_skeleton_new ();
session = hs_session_skeleton_new ();
hs_object_skeleton_set_power (object, power);
g_object_unref (power);
hs_object_skeleton_set_session (object, session);
g_object_unref (session);
g_signal_connect (session, "handle-logout", G_CALLBACK (_on_session_logout), user_data);
g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object));
g_object_unref (object);
g_dbus_object_manager_server_set_connection (manager, connection);
}
示例4: storaged_linux_block_object_constructed
static void
storaged_linux_block_object_constructed (GObject *_object)
{
StoragedLinuxBlockObject *object = STORAGED_LINUX_BLOCK_OBJECT (_object);
GString *str;
object->mount_monitor = storaged_daemon_get_mount_monitor (object->daemon);
g_signal_connect (object->mount_monitor,
"mount-added",
G_CALLBACK (on_mount_monitor_mount_added),
object);
g_signal_connect (object->mount_monitor,
"mount-removed",
G_CALLBACK (on_mount_monitor_mount_removed),
object);
/* initial coldplug */
storaged_linux_block_object_uevent (object, "add", NULL);
/* compute the object path */
str = g_string_new ("/org/storaged/Storaged/block_devices/");
storaged_safe_append_to_object_path (str, g_udev_device_get_name (object->device->udev_device));
g_dbus_object_skeleton_set_object_path (G_DBUS_OBJECT_SKELETON (object), str->str);
g_string_free (str, TRUE);
if (G_OBJECT_CLASS (storaged_linux_block_object_parent_class)->constructed != NULL)
G_OBJECT_CLASS (storaged_linux_block_object_parent_class)->constructed (_object);
}
示例5: terminal_app_dbus_register
static gboolean
terminal_app_dbus_register (GApplication *application,
GDBusConnection *connection,
const gchar *object_path,
GError **error)
{
TerminalApp *app = TERMINAL_APP (application);
gs_unref_object TerminalObjectSkeleton *object = NULL;
gs_unref_object TerminalFactory *factory = NULL;
if (!G_APPLICATION_CLASS (terminal_app_parent_class)->dbus_register (application,
connection,
object_path,
error))
return FALSE;
object = terminal_object_skeleton_new (TERMINAL_FACTORY_OBJECT_PATH);
factory = terminal_factory_impl_new ();
terminal_object_skeleton_set_factory (object, factory);
app->object_manager = g_dbus_object_manager_server_new (TERMINAL_OBJECT_PATH_PREFIX);
g_dbus_object_manager_server_export (app->object_manager, G_DBUS_OBJECT_SKELETON (object));
/* And export the object */
g_dbus_object_manager_server_set_connection (app->object_manager, connection);
return TRUE;
}
示例6: neardal_handoveragent_prv_manage
/*****************************************************************************
* neardal_handoveragent_prv_manage: create or release an agent and register
* or unregister it with neardal object manager and Neard
****************************************************************************/
errorCode_t neardal_handoveragent_prv_manage(
neardal_handover_agent_t agentData)
{
errorCode_t err = NEARDAL_SUCCESS;
neardalObjectSkeleton *objSkel;
neardalHandoverAgent *handoverAgent;
neardal_handover_agent_t *data;
NEARDAL_TRACEIN();
if (agentData.cb_oob_push_agent != NULL &&
agentData.cb_oob_req_agent != NULL) {
data = g_try_malloc0(sizeof(neardal_handover_agent_t));
if (data == NULL)
return NEARDAL_ERROR_NO_MEMORY;
memcpy(data, &agentData, sizeof(neardal_handover_agent_t));
data->objPath = g_strdup(agentData.objPath);
data->carrierType = g_strdup(agentData.carrierType);
NEARDAL_TRACEF("Create agent '%s'\n", data->objPath);
objSkel = neardal_object_skeleton_new (data->objPath);
handoverAgent = neardal_handover_agent_skeleton_new();
neardal_object_skeleton_set_handover_agent(objSkel,
handoverAgent);
/* Handle RequestOOB() D-Bus method invocations */
g_signal_connect( handoverAgent, "handle-request-oob"
, G_CALLBACK (on_RequestOOB)
, data);
/* Handle PushOOB() D-Bus method invocations */
g_signal_connect( handoverAgent, "handle-push-oob"
, G_CALLBACK (on_PushOOB)
, data);
/* Handle Release D-Bus method invocations */
g_signal_connect( handoverAgent, "handle-release"
, G_CALLBACK (on_Handover_Release), data);
g_signal_connect( neardalMgr.agentMgr, "object-removed"
, G_CALLBACK (on_handover_object_removed)
, data);
g_object_unref(handoverAgent);
/* Export the object */
g_dbus_object_manager_server_export(neardalMgr.agentMgr
, G_DBUS_OBJECT_SKELETON (objSkel));
g_object_unref (objSkel);
} else {
NEARDAL_TRACEF("Release agent '%s'\n", agentData.objPath);
if (neardal_agent_prv_remove(agentData.objPath) == TRUE)
err = NEARDAL_SUCCESS;
else
err = NEARDAL_ERROR_DBUS;
}
return err;
}
示例7: on_name_acquired
static void
on_name_acquired(GDBusConnection *connection,
const gchar *name,
gpointer object)
{
g_dbus_object_manager_server_export(manager, G_DBUS_OBJECT_SKELETON(object));
}
示例8: storage_daemon_unpublish
void
storage_daemon_unpublish (StorageDaemon *self,
const gchar *path,
gpointer thing)
{
GDBusObject *object;
gboolean unexport = FALSE;
GList *interfaces, *l;
g_return_if_fail (STORAGE_IS_DAEMON (self));
g_return_if_fail (path != NULL);
object = g_dbus_object_manager_get_object (G_DBUS_OBJECT_MANAGER (self->object_manager), path);
if (object == NULL)
return;
path = g_dbus_object_get_object_path (G_DBUS_OBJECT (object));
if (G_IS_DBUS_INTERFACE (thing))
{
g_debug ("unpublishing interface: %s %s", path,
g_dbus_interface_get_info(thing)->name);
unexport = TRUE;
interfaces = g_dbus_object_get_interfaces (object);
for (l = interfaces; l != NULL; l = g_list_next (l))
{
if (G_DBUS_INTERFACE (l->data) != G_DBUS_INTERFACE (thing))
unexport = FALSE;
}
g_list_free_full (interfaces, g_object_unref);
/*
* HACK: GDBusObjectManagerServer is broken ... and sends InterfaceRemoved
* too many times, if you remove all interfaces manually, and then unexport
* a GDBusObject. So only do it here if we're not unexporting the object.
*/
if (!unexport)
g_dbus_object_skeleton_remove_interface (G_DBUS_OBJECT_SKELETON (object), thing);
else
g_debug ("(unpublishing object, too)");
}
else if (thing == NULL)
{
unexport = TRUE;
}
else
{
g_critical ("Unsupported type to unpublish: %s", G_OBJECT_TYPE_NAME (thing));
}
if (unexport)
g_dbus_object_manager_server_unexport (self->object_manager, path);
g_object_unref (object);
}
示例9: storaged_linux_volume_group_object_constructed
static void
storaged_linux_volume_group_object_constructed (GObject *_object)
{
StoragedLinuxVolumeGroupObject *object = STORAGED_LINUX_VOLUME_GROUP_OBJECT (_object);
GString *s;
if (G_OBJECT_CLASS (storaged_linux_volume_group_object_parent_class)->constructed != NULL)
G_OBJECT_CLASS (storaged_linux_volume_group_object_parent_class)->constructed (_object);
object->logical_volumes = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
(GDestroyNotify) g_object_unref);
/* compute the object path */
s = g_string_new ("/org/storaged/Storaged/lvm/");
storaged_safe_append_to_object_path (s, object->name);
g_dbus_object_skeleton_set_object_path (G_DBUS_OBJECT_SKELETON (object), s->str);
g_string_free (s, TRUE);
/* create the DBus interface */
object->iface_volume_group = storaged_linux_volume_group_new ();
g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object),
G_DBUS_INTERFACE_SKELETON (object->iface_volume_group));
/* Watch fstab and crypttab for changes.
*/
g_signal_connect (storaged_daemon_get_fstab_monitor (object->daemon),
"entry-added",
G_CALLBACK (etctabs_changed),
object);
g_signal_connect (storaged_daemon_get_fstab_monitor (object->daemon),
"entry-removed",
G_CALLBACK (etctabs_changed),
object);
g_signal_connect (storaged_daemon_get_crypttab_monitor (object->daemon),
"entry-added",
G_CALLBACK (etctabs_changed),
object);
g_signal_connect (storaged_daemon_get_crypttab_monitor (object->daemon),
"entry-removed",
G_CALLBACK (etctabs_changed),
object);
}
示例10: on_bus_acquired
static void
on_bus_acquired (GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
ObjectSkeleton *object;
//g_print ("Acquired a message bus connection: %s\n",name);
cmdline *cmd = user_data;
if (cmd->argc < 2)
{
g_print("No objects created. Put object name(s) on command line\n");
return;
}
manager = g_dbus_object_manager_server_new (dbus_object_path);
int i=0;
gchar *s;
s = g_strdup_printf ("%s/%s",dbus_object_path,cmd->argv[1]);
object = object_skeleton_new (s);
g_free (s);
Button* button = button_skeleton_new ();
object_skeleton_set_button (object, button);
g_object_unref (button);
//define method callbacks
g_signal_connect (button,
"handle-is-on",
G_CALLBACK (on_is_on),
NULL); /* user_data */
g_signal_connect (button,
"handle-sim-button-press",
G_CALLBACK (on_button_press),
NULL); /* user_data */
/* Export the object (@manager takes its own reference to @object) */
g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object));
g_object_unref (object);
/* Export all objects */
g_dbus_object_manager_server_set_connection (manager, connection);
// get gpio device paths
int rc = GPIO_OK;
do {
rc = gpio_init(connection,&gpio_button);
if (rc != GPIO_OK) { break; }
rc = gpio_open_interrupt(&gpio_button,on_button_interrupt,object);
if (rc != GPIO_OK) { break; }
} while(0);
if (rc != GPIO_OK)
{
printf("ERROR PowerButton: GPIO setup (rc=%d)\n",rc);
}
}
示例11: storage_daemon_publish
void
storage_daemon_publish (StorageDaemon *self,
const gchar *path,
gboolean uniquely,
gpointer thing)
{
GDBusInterface *prev;
GDBusInterfaceInfo *info;
GDBusObjectSkeleton *object;
GQuark detail;
g_return_if_fail (STORAGE_IS_DAEMON (self));
g_return_if_fail (path != NULL);
if (G_IS_DBUS_INTERFACE (thing))
{
g_debug ("%spublishing iface: %s %s", uniquely ? "uniquely " : "", path,
g_dbus_interface_get_info(thing)->name);
object = G_DBUS_OBJECT_SKELETON (g_dbus_object_manager_get_object (G_DBUS_OBJECT_MANAGER (self->object_manager), path));
if (object != NULL)
{
if (uniquely)
{
info = g_dbus_interface_get_info (thing);
prev = g_dbus_object_get_interface (G_DBUS_OBJECT (object), info->name);
if (prev)
{
g_object_unref (prev);
g_object_unref (object);
object = NULL;
}
}
}
if (object == NULL)
object = g_dbus_object_skeleton_new (path);
g_dbus_object_skeleton_add_interface (object, thing);
}
else
{
g_critical ("Unsupported type to publish: %s", G_OBJECT_TYPE_NAME (thing));
return;
}
if (uniquely)
g_dbus_object_manager_server_export_uniquely (self->object_manager, object);
else
g_dbus_object_manager_server_export (self->object_manager, object);
detail = g_quark_from_static_string (G_OBJECT_TYPE_NAME (thing));
g_signal_emit (self, signals[PUBLISHED], detail, thing);
g_object_unref (object);
}
示例12: on_bus_acquired
static void
on_bus_acquired(GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
cmdline *cmd = user_data;
if(cmd->argc < 4)
{
g_print("flasher [flash name] [filename] [source object]\n");
g_main_loop_quit(cmd->loop);
return;
}
printf("Starting flasher: %s,%s,%s,\n",cmd->argv[1],cmd->argv[2],cmd->argv[3]);
ObjectSkeleton *object;
manager = g_dbus_object_manager_server_new(dbus_object_path);
gchar *s;
s = g_strdup_printf("%s/%s",dbus_object_path,cmd->argv[1]);
object = object_skeleton_new(s);
g_free(s);
FlashControl* flash_control = flash_control_skeleton_new();
object_skeleton_set_flash_control(object, flash_control);
g_object_unref(flash_control);
/* Export the object (@manager takes its own reference to @object) */
g_dbus_object_manager_server_export(manager, G_DBUS_OBJECT_SKELETON(object));
g_object_unref(object);
/* Export all objects */
g_dbus_object_manager_server_set_connection(manager, connection);
bool bmc_flash = false;
uint32_t address = 0;
if(strcmp(cmd->argv[1],"bmc")==0) {
bmc_flash = true;
}
if(strcmp(cmd->argv[1],"bmc_ramdisk")==0) {
bmc_flash = true;
address = 0x20300000;
}
if(strcmp(cmd->argv[1],"bmc_kernel")==0) {
bmc_flash = true;
address = 0x20080000;
}
int rc = flash(flash_control,bmc_flash,address,cmd->argv[2],cmd->argv[3]);
if(rc) {
flash_message(connection,cmd->argv[3],"error","Flash Error");
} else {
flash_message(connection,cmd->argv[3],"done","");
}
//Object exits when done flashing
g_main_loop_quit(cmd->loop);
}
示例13: goa_daemon_init
static void
goa_daemon_init (GoaDaemon *daemon)
{
static volatile GQuark goa_error_domain = 0;
GoaObjectSkeleton *object;
gchar *path;
/* this will force associating errors in the GOA_ERROR error domain
* with org.freedesktop.Goa.Error.* errors via g_dbus_error_register_error_domain().
*/
goa_error_domain = GOA_ERROR;
goa_error_domain; /* shut up -Wunused-but-set-variable */
notify_init ("goa-daemon");
/* TODO: maybe nicer to pass in a GDBusConnection* construct property */
daemon->connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
/* Create object manager */
daemon->object_manager = g_dbus_object_manager_server_new ("/org/gnome/OnlineAccounts");
/* Create and export Manager */
daemon->manager = goa_manager_skeleton_new ();
g_signal_connect (daemon->manager,
"handle-add-account",
G_CALLBACK (on_manager_handle_add_account),
daemon);
object = goa_object_skeleton_new ("/org/gnome/OnlineAccounts/Manager");
goa_object_skeleton_set_manager (object, daemon->manager);
g_dbus_object_manager_server_export (daemon->object_manager, G_DBUS_OBJECT_SKELETON (object));
g_object_unref (object);
/* create ~/.config/goa-1.0 directory */
path = g_strdup_printf ("%s/goa-1.0", g_get_user_config_dir ());
if (g_mkdir_with_parents (path, 0755) != 0)
{
goa_warning ("Error creating directory %s: %m", path);
}
g_free (path);
/* set up file monitoring */
path = g_strdup_printf ("%s/goa-1.0/accounts.conf", g_get_user_config_dir ());
daemon->home_conf_file_monitor = create_monitor (path, FALSE);
if (daemon->home_conf_file_monitor != NULL)
g_signal_connect (daemon->home_conf_file_monitor, "changed", G_CALLBACK (on_file_monitor_changed), daemon);
g_free (path);
/* prime the list of accounts */
goa_daemon_reload_configuration (daemon);
/* Export objects */
g_dbus_object_manager_server_set_connection (daemon->object_manager, daemon->connection);
}
示例14: get_iface
void
get_iface (GObject *object, GType skeleton, gpointer _pointer_to_iface)
{
GDBusInterface **pointer_to_iface = _pointer_to_iface;
if (*pointer_to_iface == NULL) {
*pointer_to_iface = g_object_new(skeleton, NULL);
}
g_dbus_object_skeleton_add_interface(G_DBUS_OBJECT_SKELETON (object),
G_DBUS_INTERFACE_SKELETON (*pointer_to_iface));
}
示例15: on_bus_acquired
static void
on_bus_acquired (GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
ObjectSkeleton *object;
//g_print ("Acquired a message bus connection: %s\n",name);
cmdline *cmd = user_data;
if (cmd->argc < 2)
{
g_print("No objects created. Put object name(s) on command line\n");
return;
}
manager = g_dbus_object_manager_server_new (dbus_object_path);
int i=0;
for (i=1;i<cmd->argc;i++)
{
gchar *s;
s = g_strdup_printf ("%s/%s",dbus_object_path,cmd->argv[i]);
object = object_skeleton_new (s);
g_free (s);
ControlHost* control_host = control_host_skeleton_new ();
object_skeleton_set_control_host (object, control_host);
g_object_unref (control_host);
Control* control = control_skeleton_new ();
object_skeleton_set_control (object, control);
g_object_unref (control);
//define method callbacks here
g_signal_connect (control_host,
"handle-boot",
G_CALLBACK (on_boot),
object); /* user_data */
g_signal_connect (control,
"handle-init",
G_CALLBACK (on_init),
NULL); /* user_data */
/* Export the object (@manager takes its own reference to @object) */
g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object));
g_object_unref (object);
}
/* Export all objects */
g_dbus_object_manager_server_set_connection (manager, connection);
gpio_init(connection,&fsi_data);
gpio_init(connection,&fsi_clk);
gpio_init(connection,&fsi_enable);
gpio_init(connection,&cronus_sel);
}