217066fca3
Adde handling for Manager and drives git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@94 cac9541e-1b8d-4bfa-827e-589bba606050
108 lines
2.7 KiB
C++
108 lines
2.7 KiB
C++
/* qlscribe - Qt based application to print lightScribe discs
|
|
|
|
Copyright (C) 2009 Vyacheslav Kononenko <vyacheslav@kononenko.net>
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
$Id$ */
|
|
|
|
#include "dbuscpp.h"
|
|
|
|
using namespace DBusCpp;
|
|
|
|
dbus_uint32_t Connection::send( const Message &msg )
|
|
{
|
|
dbus_uint32_t rez;
|
|
dbus_connection_send( m_connection, msg.m_message, &rez );
|
|
return rez;
|
|
}
|
|
|
|
MessageIter::MessageIter( const MessageIter &an )
|
|
: m_iter( an.m_iter ), m_container( an.m_container )
|
|
{
|
|
if( m_container )
|
|
const_cast< MessageIter & >( an ).m_container = 0;
|
|
}
|
|
|
|
MessageIter::~MessageIter()
|
|
{
|
|
if( m_container )
|
|
dbus_message_iter_close_container( m_container, &m_iter );
|
|
}
|
|
|
|
MessageIter MessageIter::openContainer( int elemType, const char *signature )
|
|
{
|
|
MessageIter rez;
|
|
dbus_message_iter_open_container( &m_iter, elemType, signature, &rez.m_iter );
|
|
rez.m_container = &m_iter;
|
|
|
|
return rez;
|
|
}
|
|
|
|
void MessageIter::append( const char *str )
|
|
{
|
|
dbus_message_iter_append_basic( &m_iter, DBUS_TYPE_STRING, &str );
|
|
}
|
|
|
|
Message::Message( int type )
|
|
{
|
|
m_message = dbus_message_new( type );
|
|
}
|
|
|
|
Message::Message( const Message &msg )
|
|
: m_message( msg.m_message )
|
|
{
|
|
dbus_message_ref( m_message );
|
|
}
|
|
|
|
Message::Message( DBusMessage *msg, bool ownership )
|
|
: m_message( msg )
|
|
{
|
|
if( !ownership )
|
|
dbus_message_ref( m_message );
|
|
}
|
|
|
|
Message Message::newMethodReturn()
|
|
{
|
|
return Message( dbus_message_new_method_return( m_message ), true );
|
|
}
|
|
|
|
Message Message::newError( const char *error, const char *message )
|
|
{
|
|
return Message( dbus_message_new_error( m_message, error, message ), true );
|
|
}
|
|
|
|
MessageIter Message::appendIter()
|
|
{
|
|
MessageIter rez;
|
|
dbus_message_iter_init_append( m_message, &rez.m_iter );
|
|
return rez;
|
|
}
|
|
|
|
void Message::append( const char *str )
|
|
{
|
|
dbus_message_append_args( m_message, DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID );
|
|
}
|
|
|
|
const char *Message::path()
|
|
{
|
|
return dbus_message_get_path( m_message );
|
|
}
|
|
|
|
Message::~Message()
|
|
{
|
|
dbus_message_unref( m_message );
|
|
}
|