Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion builds/arch/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pkgdesc='A Campfire desktop client'
arch=('i686' 'x86_64' 'ppc')
url='http://snakefire.org'
license=('MIT')
depends=('python2' 'python2-pyqt4' 'python2-keyring' 'python2-notify' 'python-pyfire>=0.3.4')
depends=('python2' 'python2-pyqt4' 'python2-keyring' 'python2-notify' 'python-pyfire>=0.3.4', 'python2-dbus')
optdepends=('python-gnomekeyring: For GNOME/XFCE/LXDE users that require notifications' 'python2-pyenchant: For spell checking support')
makedepends=('python2' 'python2-distribute')
source=(http://snakefire.org/downloads/$pkgname-$pkgver.tar.gz)
Expand Down
13 changes: 10 additions & 3 deletions snakefire/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os, resources, subprocess
import dbus, dbus.proxies

GNOME_ENABLED = os.getenv("GNOME_DESKTOP_SESSION_ID")
XFCE_ENABLED = os.getenv("XDG_SESSION_COOKIE")
NOTIFICATIONS_ENABLED = False
KDE_ENABLED = False

try:
Expand All @@ -10,10 +10,17 @@
except OSError:
pass

try:
dbus.proxies.ProxyObject(conn=dbus.SessionBus(),
bus_name="org.freedesktop.Notifications",
object_path="/org/freedesktop/Notifications")
NOTIFICATIONS_ENABLED = True
except dbus.exceptions.DBusException:
pass

if KDE_ENABLED:
from .mainframe import KSnakefire as Snakefire
elif GNOME_ENABLED or XFCE_ENABLED:
elif NOTIFICATIONS_ENABLED:
from .mainframe import GSnakefire as Snakefire
else:
from .mainframe import QSnakefire as Snakefire
6 changes: 3 additions & 3 deletions snakefire/mainframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import urllib2
import enchant

from snakefire import GNOME_ENABLED, KDE_ENABLED, XFCE_ENABLED
from snakefire import NOTIFICATIONS_ENABLED, KDE_ENABLED

from PyQt4 import Qt
from PyQt4 import QtGui
Expand All @@ -18,7 +18,7 @@
if KDE_ENABLED:
from PyKDE4 import kdecore
from PyKDE4 import kdeui
elif GNOME_ENABLED or XFCE_ENABLED:
elif NOTIFICATIONS_ENABLED:
import subprocess
import pynotify

Expand Down Expand Up @@ -1149,7 +1149,7 @@ def _notify(self, room, message, user):
kdeui.KNotification.CloseWhenWidgetActivated
)

if GNOME_ENABLED or XFCE_ENABLED:
if NOTIFICATIONS_ENABLED:
class GSnakefire(QSnakefire):
def __init__(self, parent=None):
super(GSnakefire, self).__init__(parent)
Expand Down