summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2011-09-20 15:35:56 -0400
committerBarry Warsaw <barry@python.org>2011-09-20 15:35:56 -0400
commit683c5219ac94513bbd22ee8e4cf1a11e127a78b9 (patch)
treebbfd85c7bfdc740e3a3fcbd92fe8b93c8dd29e30 /src
parent3140baa2b0a8786908d6b4d7dac6fba444200a03 (diff)
parentf736e33a1150009812930631449567634656cc38 (diff)
* Fix two crashes when using GI. Given by Martin Pitt.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/gtimelog/main.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gtimelog/main.py b/src/gtimelog/main.py
index fa0a27f..0c505ec 100755
--- a/src/gtimelog/main.py
+++ b/src/gtimelog/main.py
@@ -41,6 +41,7 @@ try:
new_app_indicator = None
except ImportError:
+ import gi
from gi.repository import GObject as gobject
from gi.repository import Gdk as gdk
from gi.repository import Gtk as gtk
@@ -48,7 +49,11 @@ except ImportError:
pygtk = None
# these are hacks until we fully switch to GI
- PANGO_ALIGN_LEFT = pango.TabAlign.TAB_LEFT
+ try:
+ PANGO_ALIGN_LEFT = pango.TabAlign.LEFT
+ except AttributeError:
+ # backwards compat for older Pango versions with broken GIR
+ PANGO_ALIGN_LEFT = pango.TabAlign.TAB_LEFT
GTK_RESPONSE_OK = gtk.ResponseType.OK
gtk_status_icon_new = gtk.StatusIcon.new_from_file
pango_tabarray_new = pango.TabArray.new