#!/usr/bin/env python

## Copyright (C) 2012 ABRT team <abrt-devel-list@redhat.com>
## Copyright (C) 2001-2005 Red Hat, Inc.

## 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, Suite 500, Boston, MA  02110-1335  USA

import dbus
import dbus.service

GNOME_ABRT_APPLICATION_ID = 'org.freedesktop.GnomeAbrt'
GNOME_ABRT_INTERFACE = 'org.freedesktop.GnomeAbrt'
GNOME_ABRT_OBJECT_PATH = '/org/freedesktop/GnomeAbrt'

class FakeService(dbus.service.Object):

    def __init__(self):
        bus_name = dbus.service.BusName(GNOME_ABRT_APPLICATION_ID, dbus.SessionBus())
        dbus.service.Object.__init__(self, bus_name, GNOME_ABRT_OBJECT_PATH)

    @dbus.service.method(dbus_interface=GNOME_ABRT_INTERFACE,
                         in_signature='as', out_signature='')
    def command_line(self, argv):
        raise dbus.exceptions.DBusException("Fake Service. HA! HA!")


if __name__ == "__main__":
    import gobject
    from dbus.mainloop.glib import DBusGMainLoop

    DBusGMainLoop(set_as_default=True)
    service = FakeService()
    loop = gobject.MainLoop()
    loop.run()
