[gedit] Fix python bindings to use GFile instead of uris.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Fix python bindings to use GFile instead of uris.
- Date: Tue, 27 Apr 2010 11:38:17 +0000 (UTC)
commit 0eef54b2e11fee988429010913d46b3fa61b0104
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Thu Apr 1 13:31:38 2010 +0200
Fix python bindings to use GFile instead of uris.
plugin-loaders/python/bindings/Makefile.am | 2 +
plugin-loaders/python/bindings/gedit.defs | 39 ++++----------
plugin-loaders/python/bindings/gedit.override | 1 +
plugin-loaders/python/bindings/geditcommands.defs | 12 ++--
.../python/bindings/geditcommands.override | 57 ++++++++++----------
plugin-loaders/python/bindings/geditutils.defs | 14 +++---
plugin-loaders/python/bindings/geditutils.override | 1 +
7 files changed, 57 insertions(+), 69 deletions(-)
---
diff --git a/plugin-loaders/python/bindings/Makefile.am b/plugin-loaders/python/bindings/Makefile.am
index 47183a5..9aefe66 100644
--- a/plugin-loaders/python/bindings/Makefile.am
+++ b/plugin-loaders/python/bindings/Makefile.am
@@ -45,6 +45,7 @@ gedit.c: gedit.defs gedit.override geditplugin.override geditmessage.override $(
geditutils.c: geditutils.defs geditutils.override
( cd $(srcdir) && $(PYGTK_CODEGEN) \
+ --register $(PYGOBJECT_DEFSDIR)/gio-types.defs \
--override $*.override \
--prefix py$* $(<F) ) > $@
@@ -52,6 +53,7 @@ geditcommands.c: geditcommands.defs geditcommands.override gedit.defs
( cd $(srcdir) && $(PYGTK_CODEGEN) \
--register gedit.defs \
--register $(PYGTK_DEFSDIR)/gtk-types.defs \
+ --register $(PYGOBJECT_DEFSDIR)/gio-types.defs \
--override $*.override \
--prefix py$* $(<F) ) > $@
diff --git a/plugin-loaders/python/bindings/gedit.defs b/plugin-loaders/python/bindings/gedit.defs
index 1b11639..83cde29 100644
--- a/plugin-loaders/python/bindings/gedit.defs
+++ b/plugin-loaders/python/bindings/gedit.defs
@@ -254,18 +254,12 @@
(return-type "GFile*")
)
-(define-method get_uri
+(define-method set_location
(of-object "GeditDocument")
- (c-name "gedit_document_get_uri")
- (return-type "gchar*")
-)
-
-(define-method set_uri
- (of-object "GeditDocument")
- (c-name "gedit_document_set_uri")
+ (c-name "gedit_document_set_location")
(return-type "none")
(parameters
- '("const-gchar*" "uri")
+ '("GFile*" "location")
)
)
@@ -304,24 +298,13 @@
(c-name "gedit_document_load")
(return-type "none")
(parameters
- '("const-gchar*" "uri")
+ '("GFile*" "location")
'("const-GeditEncoding*" "encoding")
'("gint" "line_pos")
'("gboolean" "create")
)
)
-(define-method insert_file
- (of-object "GeditDocument")
- (c-name "gedit_document_insert_file")
- (return-type "gboolean")
- (parameters
- '("GtkTextIter*" "iter")
- '("const-gchar*" "uri")
- '("const-GeditEncoding*" "encoding")
- )
-)
-
(define-method load_cancel
(of-object "GeditDocument")
(c-name "gedit_document_load_cancel")
@@ -342,7 +325,7 @@
(c-name "gedit_document_save_as")
(return-type "none")
(parameters
- '("const-gchar*" "uri")
+ '("GFile*" "location")
'("const-GeditEncoding*" "encoding")
'("GeditDocumentSaveFlags" "flags")
)
@@ -894,12 +877,12 @@
)
)
-(define-method create_tab_from_uri
+(define-method create_tab_from_location
(of-object "GeditWindow")
- (c-name "gedit_window_create_tab_from_uri")
+ (c-name "gedit_window_create_tab_from_location")
(return-type "GeditTab*")
(parameters
- '("const-gchar*" "uri")
+ '("GFile*" "location")
'("const-GeditEncoding*" "encoding" (null-ok))
'("gint" "line_pos")
'("gboolean" "create")
@@ -1018,12 +1001,12 @@
(return-type "GeditMessageBus*")
)
-(define-method get_tab_from_uri
+(define-method get_tab_from_location
(of-object "GeditWindow")
- (c-name "gedit_window_get_tab_from_uri")
+ (c-name "gedit_window_get_tab_from_location")
(return-type "GeditTab*")
(parameters
- '("const-gchar*" "uri")
+ '("GFile*" "location")
)
)
diff --git a/plugin-loaders/python/bindings/gedit.override b/plugin-loaders/python/bindings/gedit.override
index 52c492a..a989b60 100644
--- a/plugin-loaders/python/bindings/gedit.override
+++ b/plugin-loaders/python/bindings/gedit.override
@@ -69,6 +69,7 @@ modulename gedit
%%
import gtk.Widget as PyGtkWidget_Type
import gobject.GObject as PyGObject_Type
+import gio.File as PyGFile_Type
import gtk.gdk.Screen as PyGdkScreen_Type
import gtk.VBox as PyGtkVBox_Type
import gtk.Window as PyGtkWindow_Type
diff --git a/plugin-loaders/python/bindings/geditcommands.defs b/plugin-loaders/python/bindings/geditcommands.defs
index 3808fa4..530c83a 100644
--- a/plugin-loaders/python/bindings/geditcommands.defs
+++ b/plugin-loaders/python/bindings/geditcommands.defs
@@ -5,23 +5,23 @@
;; From ../../gedit/gedit-commands.h
-(define-function load_uri
- (c-name "gedit_commands_load_uri")
+(define-function load_location
+ (c-name "gedit_commands_load_location")
(return-type "none")
(parameters
'("GeditWindow*" "window")
- '("const-gchar*" "uri")
+ '("GFile*" "location")
'("const-GeditEncoding*" "encoding")
'("gint" "line_pos")
)
)
-(define-function load_uris
- (c-name "gedit_commands_load_uris")
+(define-function load_locations
+ (c-name "gedit_commands_load_locations")
(return-type "gint")
(parameters
'("GeditWindow*" "window")
- '("const-GSList*" "uris")
+ '("const-GSList*" "locations")
'("const-GeditEncoding*" "encoding")
'("gint" "line_pos")
)
diff --git a/plugin-loaders/python/bindings/geditcommands.override b/plugin-loaders/python/bindings/geditcommands.override
index a81f918..45157f7 100644
--- a/plugin-loaders/python/bindings/geditcommands.override
+++ b/plugin-loaders/python/bindings/geditcommands.override
@@ -16,52 +16,53 @@ modulename gedit.commands
%%
import gedit.Window as PyGeditWindow_Type
import gedit.Document as PyGeditDocument_Type
+import gio.File as PyGFile_Type
%%
ignore-glob
_*
%%
-override gedit_commands_load_uri kwargs
+override gedit_commands_load_location kwargs
static PyObject *
-_wrap_gedit_commands_load_uri (PyObject *self, PyObject *args, PyObject *kwargs)
+_wrap_gedit_commands_load_location (PyObject *self, PyObject *args, PyObject *kwargs)
{
- static char *kwlist[] = { "window", "uri", "encoding", "line_pos", NULL };
+ static char *kwlist[] = { "window", "location", "encoding", "line_pos", NULL };
PyGObject *window;
- char *uri;
+ PyGObject *location;
int line_pos = 0;
PyObject *py_encoding = NULL;
GeditEncoding *encoding = NULL;
- if (!PyArg_ParseTupleAndKeywords (args, kwargs, "O!s|Oi:load_uri",
- kwlist, &PyGeditWindow_Type,
- &window, &uri, &py_encoding,
- &line_pos))
+ if (!PyArg_ParseTupleAndKeywords (args, kwargs, "O!O!|Oi:load_location",
+ kwlist, &PyGeditWindow_Type,
+ &window, &PyGFile_Type, &location,
+ &py_encoding, &line_pos))
return NULL;
-
+
if (py_encoding != NULL && py_encoding != Py_None)
{
if (pyg_boxed_check (py_encoding, GEDIT_TYPE_ENCODING))
encoding = pyg_boxed_get (py_encoding, GeditEncoding);
else
{
- PyErr_SetString (PyExc_TypeError,
+ PyErr_SetString (PyExc_TypeError,
"encoding should be a GeditEncoding");
return NULL;
}
}
- gedit_commands_load_uri (GEDIT_WINDOW (window->obj), uri, encoding,
- line_pos);
+ gedit_commands_load_location (GEDIT_WINDOW (window->obj), G_FILE (location->obj),
+ encoding, line_pos);
Py_INCREF (Py_None);
return Py_None;
}
%%
-override gedit_commands_load_uris kwargs
+override gedit_commands_load_locations kwargs
static PyObject *
-_wrap_gedit_commands_load_uris (PyObject *self, PyObject *args, PyObject *kwargs)
+_wrap_gedit_commands_load_locations (PyObject *self, PyObject *args, PyObject *kwargs)
{
- static char *kwlist[] = { "window", "uris", "encoding", "line_pos", NULL };
+ static char *kwlist[] = { "window", "locations", "encoding", "line_pos", NULL };
PyGObject *window;
- GSList *uris = NULL;
+ GSList *locations = NULL;
int line_pos = 0;
PyObject *py_encoding = NULL;
PyObject *list;
@@ -70,12 +71,12 @@ _wrap_gedit_commands_load_uris (PyObject *self, PyObject *args, PyObject *kwargs
int len;
int i;
- if (!PyArg_ParseTupleAndKeywords (args, kwargs, "O!O|Oi:load_uri",
- kwlist, &PyGeditWindow_Type,
- &window, &list, &py_encoding,
+ if (!PyArg_ParseTupleAndKeywords (args, kwargs, "O!O|Oi:load_locations",
+ kwlist, &PyGeditWindow_Type,
+ &window, &list, &py_encoding,
&line_pos))
return NULL;
-
+
if (py_encoding != NULL && py_encoding != Py_None)
{
if (pyg_boxed_check (py_encoding, GEDIT_TYPE_ENCODING))
@@ -101,21 +102,21 @@ _wrap_gedit_commands_load_uris (PyObject *self, PyObject *args, PyObject *kwargs
item = PySequence_GetItem (list, i);
Py_DECREF (item);
- if (!PyString_Check (item))
+ if (!pygobject_check (item, &PyGFile_Type))
{
PyErr_SetString (PyExc_TypeError,
- "sequence item not a string");
- g_slist_free (uris);
+ "sequence item not a GFile");
+ g_slist_free (locations);
return NULL;
}
- uris = g_slist_prepend (uris, PyString_AsString (item));
+ locations = g_slist_prepend (locations, pygobject_get (item));
}
- uris = g_slist_reverse (uris);
- gedit_commands_load_uris (GEDIT_WINDOW (window->obj), uris,
- encoding, line_pos);
- g_slist_free (uris);
+ locations = g_slist_reverse (locations);
+ gedit_commands_load_locations (GEDIT_WINDOW (window->obj), locations,
+ encoding, line_pos);
+ g_slist_free (locations);
Py_INCREF (Py_None);
return Py_None;
diff --git a/plugin-loaders/python/bindings/geditutils.defs b/plugin-loaders/python/bindings/geditutils.defs
index 3482f21..2ec43fa 100644
--- a/plugin-loaders/python/bindings/geditutils.defs
+++ b/plugin-loaders/python/bindings/geditutils.defs
@@ -14,23 +14,23 @@
(c-name "gedit_utils_uri_has_file_scheme")
(return-type "gboolean")
(parameters
- '("const-gchar*" "uri")
+ '("GFile*" "location")
)
)
-(define-function uri_exists
- (c-name "gedit_utils_uri_exists")
+(define-function location_exists
+ (c-name "gedit_utils_location_exists")
(return-type "gboolean")
(parameters
- '("const-gchar*" "text_uri")
+ '("GFile*" "location")
)
)
-(define-function uri_is_valid
- (c-name "gedit_utils_is_valid_uri")
+(define-function location_is_valid
+ (c-name "gedit_utils_is_valid_location")
(return-type "gboolean")
(parameters
- '("const-gchar*" "uri")
+ '("GFile*" "location")
)
)
diff --git a/plugin-loaders/python/bindings/geditutils.override b/plugin-loaders/python/bindings/geditutils.override
index a7bf7fb..4d14554 100644
--- a/plugin-loaders/python/bindings/geditutils.override
+++ b/plugin-loaders/python/bindings/geditutils.override
@@ -16,6 +16,7 @@ modulename gedit.utils
import gtk.Widget as PyGtkWidget_Type
import gtk.TreeView as PyGtkTreeView_Type
import gtk.Menu as PyGtkMenu_Type
+import gio.File as PyGFile_Type
%%
ignore-glob
_*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]