Skip to content

Commit

Permalink
coala-dbus: Add new executable which uses dbus
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdealiLoKo committed Jun 11, 2015
1 parent fb651a8 commit 117b06c
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
21 changes: 21 additions & 0 deletions coala-dbus
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python3

# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by the
# Free Software Foundation, either version 3 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 Affero General Public License
# for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import sys

from coalib.coala_dbus import main

if __name__ == "__main__":
sys.exit(main())
21 changes: 21 additions & 0 deletions coala-dbus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python3

# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by the
# Free Software Foundation, either version 3 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 Affero General Public License
# for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import sys

from coalib.coala_dbus import main

if __name__ == "__main__":
sys.exit(main())
38 changes: 38 additions & 0 deletions coalib/coala_dbus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env python3

# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by the
# Free Software Foundation, either version 3 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 Affero General Public License
# for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import dbus
import sys
import dbus.mainloop.glib
from gi.repository import GLib

from coalib.output.dbus.DbusServer import DbusServer


def main():
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

session_bus = dbus.SessionBus()
# The BusName needs to be saved to a variable, if it is not saved - the
# Bus will be closed.
dbus_name = dbus.service.BusName("org.coala.v1", session_bus)
dbus_server = DbusServer(session_bus, '/org/coala/v1',
on_disconnected=lambda: GLib.idle_add(lambda: sys.exit(0)))

mainloop = GLib.MainLoop()
mainloop.run()

if __name__ == "__main__":
sys.exit(main())

1 comment on commit 117b06c

@AbdealiLoKo
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reack

Please sign in to comment.