[gedit-plugins] Remove use of glib (instead of GLib) in commander modules



commit c6ff94e7f919f37d26aa9996e12ab3cb3368df6f
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date:   Fri Aug 5 13:19:37 2011 +0200

    Remove use of glib (instead of GLib) in commander modules

 plugins/commander/modules/edit.py  |    4 ++--
 plugins/commander/modules/shell.py |   13 ++++++-------
 2 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/plugins/commander/modules/edit.py b/plugins/commander/modules/edit.py
index 959692b..c61674c 100644
--- a/plugins/commander/modules/edit.py
+++ b/plugins/commander/modules/edit.py
@@ -25,7 +25,7 @@ import sys
 import types
 import inspect
 
-from gi.repository import Gio, Gedit
+from gi.repository import GLib, Gio, Gedit
 
 import commander.commands as commands
 import commander.commands.completion
@@ -205,7 +205,7 @@ Use this to apply the cool new feature\"\"\"
 def new_command(view, entry, name):
     """Create a new commander command module: edit.new-command &lt;command&gt;"""
 
-    filename = os.path.join(glib.get_user_config_dir(), 'gedit/commander/modules/' + name + '.py')
+    filename = os.path.join(GLib.get_user_config_dir(), 'gedit/commander/modules/' + name + '.py')
 
     if os.path.isfile(filename):
         raise commander.commands.exceptions.Execute('Commander module `' + name + '\' already exists')
diff --git a/plugins/commander/modules/shell.py b/plugins/commander/modules/shell.py
index 6171551..fb47bb6 100644
--- a/plugins/commander/modules/shell.py
+++ b/plugins/commander/modules/shell.py
@@ -20,12 +20,11 @@
 #  Boston, MA 02111-1307, USA.
 
 import subprocess
-import glib
 import fcntl
 import os
 import tempfile
 import signal
-from gi.repository import GObject, Gio
+from gi.repository import GLib, GObject, Gio
 
 import commander.commands as commands
 import commander.commands.exceptions
@@ -47,9 +46,9 @@ class Process:
 
         if not background:
             fcntl.fcntl(stdout, fcntl.F_SETFL, os.O_NONBLOCK)
-            conditions = glib.IO_IN | glib.IO_PRI | glib.IO_ERR | glib.IO_HUP
+            conditions = GLib.IOCondition.IN | GLib.IOCondition.PRI | GLib.IOCondition.ERR | GLib.IOCondition.HUP
 
-            self.watch = glib.io_add_watch(stdout, conditions, self.collect_output)
+            self.watch = GLib.io_add_watch(stdout, conditions, self.collect_output)
             self._buffer = ''
         else:
             stdout.close()
@@ -63,13 +62,13 @@ class Process:
         self._buffer = parts[-1]
 
     def collect_output(self, fd, condition):
-        if condition & (glib.IO_IN | glib.IO_PRI):
+        if condition & (GLib.IOCondition.IN | GLib.IOCondition.PRI):
             try:
                 ret = fd.read()
 
                 # This seems to happen on OS X...
                 if ret == '':
-                    condition = condition | glib.IO_HUP
+                    condition = condition | GLib.IOConditiom.HUP
                 else:
                     self._buffer += ret
 
@@ -80,7 +79,7 @@ class Process:
                 self.stop()
                 return False
 
-        if condition & (glib.IO_ERR | glib.IO_HUP):
+        if condition & (GLib.IOCondition.ERR | GLib.IOCondition.HUP):
             if self.replace:
                 buf = self.entry.view().get_buffer()
                 buf.begin_user_action()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]