Пример #1
0
void FileBrowser::collapse_to_level( int mLevelIndex )
{
	if (Debug) printf("FileBrowser::collapse_to_level( %d )\n", mLevelIndex );
	int size = levels.size();
	for (int i=size-1; i>=mLevelIndex; i--)
	{
		unregister_child( levels[i] );
		delete levels[i];
		levels.pop_back();		
	}
}
Пример #2
0
/**
 * seahorse_object_set_parent:
 * @self: the child
 * @value: the parent
 *
 * register @value as the parent of @self:
 */
void
seahorse_object_set_parent (SeahorseObject *self, SeahorseObject *value)
{
	g_return_if_fail (SEAHORSE_IS_OBJECT (self));
	g_return_if_fail (self->pv->parent != self);
	g_return_if_fail (value != self);
	
	if (value == self->pv->parent)
		return;
	
	/* Set the new parent/child relationship */
	if (self->pv->parent != NULL)
		unregister_child (self->pv->parent, self);

	if (value != NULL)
		register_child (value, self);
	
	g_assert (self->pv->parent == value);

	g_object_notify (G_OBJECT (self), "parent");
}
Пример #3
0
void
orphand_process_message(orphand_server *srv,
                        orphand_client *cli,
                        const orphand_message *msg)
{
    INFO("Sock: %d, Action=%d, Parent=%d, Child=%d",
          cli->sockfd,
          msg->action,
          msg->parent,
          msg->child);
    if (msg->action == ORPHAND_ACTION_REGISTER) {
        register_child(msg->parent, msg->child);
    } else if (msg->action == ORPHAND_ACTION_UNREGISTER) {
        unregister_child(msg->parent, msg->child);
    } else if (msg->action == ORPHAND_ACTION_PING) {

        uint32_t *reply =
                (uint32_t*)((char*)cli->sndbuf.buf + cli->sndbuf.used);
        if (cli->sndbuf.total - cli->sndbuf.used < 12) {
            ERROR("Too little space in send buffer..");
            return;
        }

        reply[0] = msg->parent;
        reply[1] = msg->child;
        reply[2] = msg->action;
        cli->sndbuf.used += 12;

    } else {
        ERROR("Received unknown code %d", msg->action);
        ERROR("A=%d,P=%d,C=%d",
              msg->action,
              msg->parent,
              msg->child);
    }
}