summaryrefslogtreecommitdiffstats
path: root/caribou/import_from_gi.repository.patch
diff options
context:
space:
mode:
Diffstat (limited to 'caribou/import_from_gi.repository.patch')
-rw-r--r--caribou/import_from_gi.repository.patch293
1 files changed, 293 insertions, 0 deletions
diff --git a/caribou/import_from_gi.repository.patch b/caribou/import_from_gi.repository.patch
new file mode 100644
index 0000000..c9f04f6
--- /dev/null
+++ b/caribou/import_from_gi.repository.patch
@@ -0,0 +1,293 @@
+From 1857bd953dc02ac781991f0b97b488b4f300b01f Mon Sep 17 00:00:00 2001
+From: Alexandre Rostovtsev <tetromino@gmail.com>
+Date: Tue, 30 Aug 2011 03:05:11 +0000
+Subject: Use GLib, GObject from gi.repository instead of glib, gobject
+
+Use GLib and GObject from gi.repository instead of glib and gobject
+modules for compatibility with pygobject-3.0. Otherwise, when running on
+a system with pygobject-2.0 and pygobject-3.0 installed, caribou-preferences
+fails with
+
+ImportError: could not import gobject (error was: ImportError('When
+using gi.repository you must not import static modules like "gobject".
+Please change all occurrences of "import gobject" to "from gi.repository
+import GObject".',))
+
+https://bugzilla.gnome.org/show_bug.cgi?id=657666
+---
+diff --git a/bin/antler-keyboard.in b/bin/antler-keyboard.in
+index 1b0c450..ce64128 100755
+--- a/bin/antler-keyboard.in
++++ b/bin/antler-keyboard.in
+@@ -25,7 +25,7 @@ exec_prefix=@exec_prefix@
+
+ if [ $script_dir == "@libexecdir@" ]
+ then
+- datadir="$(@PYTHON@ -c "import glib; print ':'.join(glib.get_system_data_dirs())")"
++ datadir="$(@PYTHON@ -c "from gi.repository import GLib; print ':'.join(GLib.get_system_data_dirs())")"
+ export PYTHONPATH="${prefix}/lib/python@PYTHON_VERSION@/site-packages${PYTHONPATH:+:$PYTHONPATH}"
+ export GI_TYPELIB_PATH="@libdir@/girepository-1.0${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}"
+ export LD_LIBRARY_PATH="@libdir@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
+diff --git a/bin/caribou-preferences.in b/bin/caribou-preferences.in
+index 6aae29e..57772e7 100755
+--- a/bin/caribou-preferences.in
++++ b/bin/caribou-preferences.in
+@@ -25,7 +25,7 @@ exec_prefix=@exec_prefix@
+
+ if [ $script_dir == "@bindir@" ]
+ then
+- datadir="$(@PYTHON@ -c "import glib; print ':'.join(glib.get_system_data_dirs())")"
++ datadir="$(@PYTHON@ -c "from gi.repository import GLib; print ':'.join(GLib.get_system_data_dirs())")"
+ export PYTHONPATH="@prefix@/lib/python@PYTHON_VERSION@/site-packages${PYTHONPATH:+:$PYTHONPATH}"
+ export GI_TYPELIB_PATH="@libdir@/girepository-1.0${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}"
+ export LD_LIBRARY_PATH="@libdir@${LD_LIBRARY_PATH:+:LD_LIBRARY_PATH}"
+diff --git a/caribou/antler/keyboard_view.py b/caribou/antler/keyboard_view.py
+index 3e09d94..350be91 100644
+--- a/caribou/antler/keyboard_view.py
++++ b/caribou/antler/keyboard_view.py
+@@ -3,9 +3,9 @@ from caribou.settings import CaribouSettings
+ from antler_settings import AntlerSettings
+ from gi.repository import Gtk
+ from gi.repository import Gdk
++from gi.repository import GObject
++from gi.repository import GLib
+ from gi.repository import Caribou
+-import gobject
+-import glib
+ import os
+ from math import ceil
+
+@@ -30,7 +30,7 @@ PRETTY_LABELS = {
+
+ class AntlerKey(Gtk.Button):
+ def __init__(self, key, spacing=0):
+- gobject.GObject.__init__(self)
++ GObject.GObject.__init__(self)
+ self.caribou_key = key.weak_ref()
+ self.set_label(self._get_key_label())
+ self._spacing = spacing
+@@ -71,7 +71,7 @@ class AntlerKey(Gtk.Button):
+ if not unichar.isspace() and unichar != u'\x00':
+ label = unichar
+
+- return "<b>%s</b>" % glib.markup_escape_text(label.encode('utf-8'))
++ return "<b>%s</b>" % GLib.markup_escape_text(label.encode('utf-8'))
+
+ def _caribou_key_pressed (self, key, _key):
+ self.set_state_flags(Gtk.StateFlags.ACTIVE, False)
+@@ -106,7 +106,7 @@ class AntlerKey(Gtk.Button):
+
+ class AntlerSubLevel(Gtk.Window):
+ def __init__(self, key):
+- gobject.GObject.__init__(self, type=Gtk.WindowType.POPUP)
++ GObject.GObject.__init__(self, type=Gtk.WindowType.POPUP)
+
+ self.set_decorated(False)
+ self.set_resizable(False)
+@@ -138,7 +138,7 @@ class AntlerLayout(Gtk.Box):
+ KEY_SPAN = 4
+
+ def __init__(self, level=None, spacing=6):
+- gobject.GObject.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
++ GObject.GObject.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
+ self.set_spacing(12)
+ self._columns = []
+ self._keys_map = {}
+@@ -243,7 +243,7 @@ class AntlerLayout(Gtk.Box):
+
+ class AntlerKeyboardView(Gtk.Notebook):
+ def __init__(self, keyboard_type):
+- gobject.GObject.__init__(self)
++ GObject.GObject.__init__(self)
+ settings = AntlerSettings()
+ self.set_show_tabs(False)
+
+@@ -253,7 +253,7 @@ class AntlerKeyboardView(Gtk.Notebook):
+ self._app_css_provider = Gtk.CssProvider()
+ self._load_style(
+ self._app_css_provider, "style.css",
+- [glib.get_user_data_dir()] + list(glib.get_system_data_dirs()))
++ [GLib.get_user_data_dir()] + list(GLib.get_system_data_dirs()))
+
+ if not use_system.value:
+ Gtk.StyleContext.add_provider_for_screen(
+@@ -262,7 +262,7 @@ class AntlerKeyboardView(Gtk.Notebook):
+
+ self._user_css_provider = Gtk.CssProvider()
+ self._load_style(self._user_css_provider, "user-style.css",
+- [glib.get_user_data_dir()])
++ [GLib.get_user_data_dir()])
+ Gtk.StyleContext.add_provider_for_screen(
+ Gdk.Screen.get_default(), self._user_css_provider,
+ Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION + 1)
+diff --git a/caribou/antler/main.py b/caribou/antler/main.py
+index 6bd3932..fab1c60 100644
+--- a/caribou/antler/main.py
++++ b/caribou/antler/main.py
+@@ -1,17 +1,16 @@
+-from gi.repository import Caribou
++from gi.repository import Caribou, GObject
+ from window import AntlerWindowEntry
+ from keyboard_view import AntlerKeyboardView
+-import gobject
+ import sys
+
+ class AntlerKeyboardService(Caribou.KeyboardService):
+ def __init__(self):
+- gobject.GObject.__init__(self)
++ GObject.GObject.__init__(self)
+ self.register_keyboard("Antler")
+ self.window = AntlerWindowEntry(AntlerKeyboardView)
+
+ def run(self):
+- loop = gobject.MainLoop()
++ loop = GObject.MainLoop()
+ loop.run()
+
+ def do_show(self, timestamp):
+diff --git a/caribou/antler/window.py b/caribou/antler/window.py
+index a72203e..f7c5fa5 100644
+--- a/caribou/antler/window.py
++++ b/caribou/antler/window.py
+@@ -22,24 +22,24 @@
+
+ from gi.repository import Gtk
+ from gi.repository import Gdk
++from gi.repository import GObject
+ from gi.repository import Clutter
+ from antler_settings import AntlerSettings
+ from math import sqrt
+ import os
+ import sys
+-import gobject
+
+ Clutter.init("antler")
+
+
+ class AnimatedWindowBase(Gtk.Window, Clutter.Animatable):
+ __gproperties__ = {
+- 'antler-window-position' : (gobject.TYPE_PYOBJECT, 'Window position',
++ 'antler-window-position' : (GObject.TYPE_PYOBJECT, 'Window position',
+ 'Window position in X, Y coordinates',
+- gobject.PARAM_READWRITE)
++ GObject.PARAM_READWRITE)
+ }
+ def __init__(self):
+- gobject.GObject.__init__(self, type=Gtk.WindowType.POPUP)
++ GObject.GObject.__init__(self, type=Gtk.WindowType.POPUP)
+ # animation
+ self._stage = Clutter.Stage.get_default()
+ self._move_animation = None
+@@ -71,7 +71,7 @@ class AnimatedWindowBase(Gtk.Window, Clutter.Animatable):
+ return True
+ if prop_name == "opacity":
+ opacity = initial_value + ((final_value - initial_value) * progress)
+- gobject.idle_add(lambda: self.set_opacity(opacity))
++ GObject.idle_add(lambda: self.set_opacity(opacity))
+
+ return True
+ else:
+@@ -132,9 +132,9 @@ class ProximityWindowBase(AnimatedWindowBase):
+ self.min_alpha = min_alpha
+ if self.max_alpha != self.min_alpha:
+ if self._poll_tid == 0:
+- self._poll_tid = gobject.timeout_add(100, self._proximity_check)
++ self._poll_tid = GObject.timeout_add(100, self._proximity_check)
+ elif self._poll_tid != 0:
+- gobject.source_remove(self._poll_tid)
++ GObject.source_remove(self._poll_tid)
+
+ def _onmapped(self, obj, event, settings):
+ if self.is_composited():
+diff --git a/caribou/settings/preferences_window.py b/caribou/settings/preferences_window.py
+index 55f9fca..541ecb5 100644
+--- a/caribou/settings/preferences_window.py
++++ b/caribou/settings/preferences_window.py
+@@ -20,7 +20,7 @@
+
+ from caribou.settings.setting_types import *
+
+-import gobject
++from gi.repository import GObject
+ from gi.repository import Gdk
+ from gi.repository import Gtk
+
+@@ -230,7 +230,7 @@ class PreferencesDialog(Gtk.Dialog, AbstractPreferencesUI):
+ __gtype_name__ = "PreferencesDialog"
+
+ def __init__(self, settings_manager):
+- gobject.GObject.__init__(self)
++ GObject.GObject.__init__(self)
+ self.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
+ self.set_border_width(6)
+ self.set_title(settings_manager.groups.label)
+@@ -243,7 +243,7 @@ class PreferencesWindow(Gtk.Window, AbstractPreferencesUI):
+ __gtype_name__ = "PreferencesWindow"
+
+ def __init__(self, settings_manager):
+- gobject.GObject.__init__(self)
++ GObject.GObject.__init__(self)
+ self.set_border_width(6)
+ self.set_title(settings_manager.groups.label)
+
+diff --git a/caribou/settings/setting_types.py b/caribou/settings/setting_types.py
+index 66fb0f0..c4af2a6 100644
+--- a/caribou/settings/setting_types.py
++++ b/caribou/settings/setting_types.py
+@@ -1,5 +1,4 @@
+-import gobject
+-from gi.repository import GLib
++from gi.repository import GLib, GObject
+
+ ENTRY_DEFAULT=0
+ ENTRY_COMBO=1
+@@ -10,17 +9,17 @@ ENTRY_SLIDER=5
+ ENTRY_CHECKBOX=6
+ ENTRY_RADIO=7
+
+-class Setting(gobject.GObject):
++class Setting(GObject.GObject):
+ __gsignals__ = {'value-changed' :
+- (gobject.SIGNAL_RUN_FIRST,
+- gobject.TYPE_NONE,
+- (gobject.TYPE_PYOBJECT,)),
++ (GObject.SIGNAL_RUN_FIRST,
++ GObject.TYPE_NONE,
++ (GObject.TYPE_PYOBJECT,)),
+ 'sensitivity-changed' :
+- (gobject.SIGNAL_RUN_FIRST,
+- gobject.TYPE_NONE,
+- (gobject.TYPE_BOOLEAN,))}
++ (GObject.SIGNAL_RUN_FIRST,
++ GObject.TYPE_NONE,
++ (GObject.TYPE_BOOLEAN,))}
+ def __init__(self, name, label, children=[]):
+- gobject.GObject.__init__(self)
++ GObject.GObject.__init__(self)
+ self.name = name
+ self.label = label
+ self.children = children
+@@ -129,8 +128,8 @@ class IntegerSetting(ValueSetting):
+ variant_type = 'i'
+ entry_type = ENTRY_SPIN
+ def __init__(self, *args, **kwargs):
+- self.min = kwargs.pop('min', gobject.G_MININT)
+- self.max = kwargs.pop('max', gobject.G_MAXINT)
++ self.min = kwargs.pop('min', GObject.G_MININT)
++ self.max = kwargs.pop('max', GObject.G_MAXINT)
+ ValueSetting.__init__(self, *args, **kwargs)
+
+ def convert_value(self, val):
+@@ -140,8 +139,8 @@ class FloatSetting(ValueSetting):
+ variant_type = 'd'
+ entry_type = ENTRY_SPIN
+ def __init__(self, *args, **kwargs):
+- self.min = kwargs.pop('min', gobject.G_MINFLOAT)
+- self.max = kwargs.pop('max', gobject.G_MAXFLOAT)
++ self.min = kwargs.pop('min', GObject.G_MINFLOAT)
++ self.max = kwargs.pop('max', GObject.G_MAXFLOAT)
+ ValueSetting.__init__(self, *args, **kwargs)
+
+ def convert_value(self, val):
+--
+cgit v0.9.0.2