本文整理汇总了C++中G_DBUS_OBJECT_SKELETON函数的典型用法代码示例。如果您正苦于以下问题:C++ G_DBUS_OBJECT_SKELETON函数的具体用法?C++ G_DBUS_OBJECT_SKELETON怎么用?C++ G_DBUS_OBJECT_SKELETON使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_DBUS_OBJECT_SKELETON函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:frankzhao,项目名称:storaged,代码行数:56,代码来源:dummyloopobject.c
示例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);
}
开发者ID:endlessm,项目名称:mutter,代码行数:28,代码来源:meta-idle-monitor-dbus.c
示例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);
}
开发者ID:ekd123,项目名称:ekode,代码行数:26,代码来源:hs-dbus-handler.c
示例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);
}
开发者ID:stefwalter,项目名称:storaged,代码行数:28,代码来源:storagedlinuxblockobject.c
示例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;
}
开发者ID:NitikaAgarwal,项目名称:gnome-terminal,代码行数:27,代码来源:terminal-app.c
示例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;
}
开发者ID:ABonnemains,项目名称:neardal,代码行数:64,代码来源:neardal_agent_mgr.c
示例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));
}
开发者ID:shenki,项目名称:skeleton,代码行数:7,代码来源:host_checkstop_obj.c
示例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);
}
开发者ID:mvollmer,项目名称:storaged,代码行数:58,代码来源:daemon.c
示例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);
}
开发者ID:carriercomm,项目名称:storaged,代码行数:44,代码来源:storagedlinuxvolumegroupobject.c
示例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);
}
}
开发者ID:jk-ozlabs,项目名称:skeleton,代码行数:56,代码来源:button_power_obj.c
示例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);
}
开发者ID:mvollmer,项目名称:storaged,代码行数:56,代码来源:daemon.c
示例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);
}
开发者ID:SteveLinCH,项目名称:skeleton,代码行数:55,代码来源:flasher_obj.c
示例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);
}
开发者ID:wvengen,项目名称:gnome-online-accounts,代码行数:53,代码来源:goadaemon.c
示例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));
}
开发者ID:bradfa,项目名称:gadgetd,代码行数:12,代码来源:gadgetd-common.c
示例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);
}
开发者ID:jk-ozlabs,项目名称:skeleton,代码行数:53,代码来源:control_host_obj.c
示例16: storaged_linux_drive_object_constructed
static void
storaged_linux_drive_object_constructed (GObject *_object)
{
StoragedLinuxDriveObject *object = STORAGED_LINUX_DRIVE_OBJECT (_object);
gchar *vendor;
gchar *model;
gchar *serial;
GString *str;
/* initial coldplug */
storaged_linux_drive_object_uevent (object, "add", object->devices->data);
/* compute the object path */
vendor = g_strdup (storaged_drive_get_vendor (object->iface_drive));
model = g_strdup (storaged_drive_get_model (object->iface_drive));
serial = g_strdup (storaged_drive_get_serial (object->iface_drive));
strip_and_replace_with_uscore (vendor);
strip_and_replace_with_uscore (model);
strip_and_replace_with_uscore (serial);
str = g_string_new ("/org/storaged/Storaged/drives/");
if (vendor == NULL && model == NULL && serial == NULL)
{
g_string_append (str, "drive");
}
else
{
/* <VENDOR>_<MODEL>_<SERIAL> */
if (vendor != NULL && strlen (vendor) > 0)
{
storaged_safe_append_to_object_path (str, vendor);
}
if (model != NULL && strlen (model) > 0)
{
if (str->str[str->len - 1] != '/')
g_string_append_c (str, '_');
storaged_safe_append_to_object_path (str, model);
}
if (serial != NULL && strlen (serial) > 0)
{
if (str->str[str->len - 1] != '/')
g_string_append_c (str, '_');
storaged_safe_append_to_object_path (str, serial);
}
}
g_free (vendor);
g_free (model);
g_free (serial);
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_drive_object_parent_class)->constructed != NULL)
G_OBJECT_CLASS (storaged_linux_drive_object_parent_class)->constructed (_object);
}
开发者ID:frankzhao,项目名称:storaged,代码行数:53,代码来源:storagedlinuxdriveobject.c
示例17: on_bus_acquired
static void
on_bus_acquired (GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
cmdline *cmd = user_data;
manager = g_dbus_object_manager_server_new (dbus_object_path);
gchar *s;
s = g_strdup_printf ("%s/%s",dbus_object_path,instance_name);
ObjectSkeleton *object = object_skeleton_new (s);
g_free (s);
Watchdog *wd = watchdog_skeleton_new ();
object_skeleton_set_watchdog (object, wd);
g_object_unref (wd);
ObjectMapper* mapper = object_mapper_skeleton_new ();
object_skeleton_set_object_mapper (object, mapper);
g_object_unref (mapper);
// set properties
watchdog_set_watchdog(wd,1);
//define method callbacks here
g_signal_connect (wd,
"handle-start",
G_CALLBACK (on_start),
object); /* user_data */
g_signal_connect (wd,
"handle-poke",
G_CALLBACK (on_poke),
object); /* user_data */
g_signal_connect (wd,
"handle-stop",
G_CALLBACK (on_stop),
object); /* user_data */
g_signal_connect (wd,
"handle-set",
G_CALLBACK (set_poll_interval),
object); /* 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);
emit_object_added((GDBusObjectManager*)manager);
}
开发者ID:agangidi,项目名称:skeleton,代码行数:52,代码来源:host_watchdog_obj.c
示例18: udisks_linux_logical_volume_object_constructed
static void
udisks_linux_logical_volume_object_constructed (GObject *_object)
{
UDisksLinuxLogicalVolumeObject *object = UDISKS_LINUX_LOGICAL_VOLUME_OBJECT (_object);
GString *s;
if (G_OBJECT_CLASS (udisks_linux_logical_volume_object_parent_class)->constructed != NULL)
G_OBJECT_CLASS (udisks_linux_logical_volume_object_parent_class)->constructed (_object);
/* compute the object path */
s = g_string_new (g_dbus_object_get_object_path (G_DBUS_OBJECT (object->volume_group)));
g_string_append_c (s, '/');
udisks_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_logical_volume = udisks_linux_logical_volume_new ();
g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object),
G_DBUS_INTERFACE_SKELETON (object->iface_logical_volume));
}
开发者ID:cathay4t,项目名称:storaged,代码行数:22,代码来源:udiskslinuxlogicalvolumeobject.c
示例19: hev_dbus_interface_skeleton_constructed
static void hev_dbus_interface_skeleton_constructed(GObject *obj)
{
GDBusObject *dbus_obj = NULL;
g_debug("%s:%d[%s]", __FILE__, __LINE__, __FUNCTION__);
G_OBJECT_CLASS(hev_dbus_interface_skeleton_parent_class)->constructed(obj);
g_object_get(obj, "object", &dbus_obj, NULL);
g_dbus_object_skeleton_add_interface(G_DBUS_OBJECT_SKELETON(dbus_obj),
G_DBUS_INTERFACE_SKELETON(obj));
g_object_unref(dbus_obj);
}
开发者ID:LiTianjue,项目名称:hev-idcard-reader,代码行数:13,代码来源:hev-dbus-interface-skeleton.c
示例20: dummy_loop_object_constructed
static void
dummy_loop_object_constructed (GObject *_object)
{
DummyLoopObject *object = DUMMY_LOOP_OBJECT (_object);
/* initial coldplug */
dummy_loop_object_process_uevent (STORAGED_MODULE_OBJECT (_object), "add", object->devices->data);
g_dbus_object_skeleton_set_object_path (G_DBUS_OBJECT_SKELETON (object), "/org/storaged/Storaged/dummy/loops");
if (G_OBJECT_CLASS (dummy_loop_object_parent_class)->constructed != NULL)
G_OBJECT_CLASS (dummy_loop_object_parent_class)->constructed (_object);
}
开发者ID:frankzhao,项目名称:storaged,代码行数:13,代码来源:dummyloopobject.c
注:本文中的G_DBUS_OBJECT_SKELETON函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论