Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hamster activation #1121

Merged
Merged
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
11 changes: 9 additions & 2 deletions GTG/plugins/hamster/hamster.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------

import logging
import datetime
import os
import time
Expand All @@ -28,6 +29,7 @@
from GTG.core.tasks import Task
from GTG.plugins.hamster.helper import FactBuilder

log = logging.getLogger(__name__)

class HamsterPlugin():
PLUGIN_NAMESPACE = 'hamster-plugin'
Expand Down Expand Up @@ -150,8 +152,13 @@ def on_task_modified(self, task_id, path):
# Plugin api methods ###
def activate(self, plugin_api):
self.plugin_api = plugin_api
self.hamster = dbus.SessionBus().get_object('org.gnome.Hamster',
'/org/gnome/Hamster')

try:
self.hamster = dbus.SessionBus().get_object('org.gnome.Hamster',
'/org/gnome/Hamster')
except dbus.exceptions.DBusException:
log.error('Hamster plugin failed to activate. Is Hamster installed?')
return

# add button
if plugin_api.is_browser():
Expand Down