[gedit-plugins] Use the introspected GLib



commit 0f5600d50f6c4c7e55a41a75ae058cffb7bebbc7
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Mon Aug 15 21:21:22 2011 +0200

    Use the introspected GLib

 plugins/commander/commander/__init__.py          |    5 ++---
 plugins/commander/commander/commands/__init__.py |    1 -
 plugins/commander/commander/entry.py             |    5 ++---
 plugins/sessionsaver/store.py                    |    5 ++---
 plugins/synctex/synctex/evince_dbus.py           |    7 ++++---
 5 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/plugins/commander/commander/__init__.py b/plugins/commander/commander/__init__.py
index 07abd0f..badc7d2 100644
--- a/plugins/commander/commander/__init__.py
+++ b/plugins/commander/commander/__init__.py
@@ -29,8 +29,7 @@ if not path in sys.path:
 
 from windowactivatable import WindowActivatable
 import commander.commands as commands
-from gi.repository import GObject, Gedit
-import glib
+from gi.repository import GObject, GLib, Gedit
 
 class CommanderPlugin(GObject.Object, Gedit.AppActivatable):
 	__gtype_name__ = "CommanderPlugin"
@@ -47,7 +46,7 @@ class CommanderPlugin(GObject.Object, Gedit.AppActivatable):
 			sys.path.insert(0, self._path)
 
 		commands.Commands().set_dirs([
-			os.path.join(glib.get_user_config_dir(), 'gedit/commander/modules'),
+			os.path.join(GLib.get_user_config_dir(), 'gedit/commander/modules'),
 			os.path.join(self.plugin_info.get_data_dir(), 'modules')
 		])
 
diff --git a/plugins/commander/commander/commands/__init__.py b/plugins/commander/commander/commands/__init__.py
index c933318..d30ca0f 100644
--- a/plugins/commander/commander/commands/__init__.py
+++ b/plugins/commander/commander/commands/__init__.py
@@ -25,7 +25,6 @@ import sys
 import bisect
 import types
 import shlex
-import glib
 import re
 import os
 
diff --git a/plugins/commander/commander/entry.py b/plugins/commander/commander/entry.py
index adc9feb..b1fedae 100644
--- a/plugins/commander/commander/entry.py
+++ b/plugins/commander/commander/entry.py
@@ -19,9 +19,8 @@
 #  Foundation, Inc., 59 Temple Place, Suite 330,
 #  Boston, MA 02111-1307, USA.
 
-from gi.repository import GObject, Gdk, Gtk
+from gi.repository import GObject, GLib, Gdk, Gtk
 import cairo
-import glib
 import os
 import re
 import inspect
@@ -87,7 +86,7 @@ GtkEntry#gedit-commander-entry {
 		self._entry.connect('focus-out-event', self.on_entry_focus_out)
 		self._entry.connect('key-press-event', self.on_entry_key_press)
 
-		self._history = History(os.path.join(glib.get_user_config_dir(), 'gedit/commander/history'))
+		self._history = History(os.path.join(GLib.get_user_config_dir(), 'gedit/commander/history'))
 		self._prompt = None
 
 		self._accel_group = None
diff --git a/plugins/sessionsaver/store.py b/plugins/sessionsaver/store.py
index 900f84e..11c8771 100644
--- a/plugins/sessionsaver/store.py
+++ b/plugins/sessionsaver/store.py
@@ -22,8 +22,7 @@
 
 import os.path
 from xml.parsers import expat
-from gi.repository import GObject, Gio
-import glib
+from gi.repository import GObject, GLib, Gio
 
 class Session(object):
     def __init__(self, name, files = None):
@@ -101,7 +100,7 @@ class SessionStore(GObject.Object):
 class XMLSessionStore(SessionStore):
     def __init__(self):
         super(XMLSessionStore, self).__init__()
-        self.filename = os.path.join(glib.get_user_config_dir(), 'gedit/saved-sessions.xml')
+        self.filename = os.path.join(GLib.get_user_config_dir(), 'gedit/saved-sessions.xml')
         self.load()
 
     def _escape(self, string):
diff --git a/plugins/synctex/synctex/evince_dbus.py b/plugins/synctex/synctex/evince_dbus.py
index bf47bc6..3c1957b 100755
--- a/plugins/synctex/synctex/evince_dbus.py
+++ b/plugins/synctex/synctex/evince_dbus.py
@@ -141,7 +141,8 @@ class EvinceWindowProxy:
 ## It should be easy to adapt to other editors. 
 ##  evince_dbus  pdf_file  line_source input_file
 if __name__ == '__main__':
-    import dbus.mainloop.glib, gobject, glib, sys, os, logging
+    import dbus.mainloop.glib, sys, os, logging
+    from gi.repository import GObject
 
     def print_usage():
         print '''
@@ -180,7 +181,7 @@ The usage is evince_dbus output_file line_number input_file from the directory o
     def sync_view(ev_window, path_input, line_number):
         ev_window.SyncView (path_input, (line_number, 1),0)
 
-    glib.timeout_add(400, sync_view, a, path_input, line_number)
-    loop = gobject.MainLoop()
+    GObject.timeout_add(400, sync_view, a, path_input, line_number)
+    loop = GObject.MainLoop()
     loop.run() 
 # ex:ts=4:et:



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