summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-07-17 09:51:19 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-07-17 09:51:19 +0000
commitfefcb864e35f595f82b6053a7a5857860eecbe69 (patch)
tree8176829598c900e5ad18b74a463ffdd0b04785c1
parent5150b46218e113795279f7708002ef156972eeb8 (diff)
downloadpygobject-fefcb864e35f595f82b6053a7a5857860eecbe69.tar.gz
pygobject-fefcb864e35f595f82b6053a7a5857860eecbe69.tar.xz
pygobject-fefcb864e35f595f82b6053a7a5857860eecbe69.zip
Use the prefix G_IO_ for stripping constants instead of just G_ Check so
2008-07-17 Johan Dahlin <johan@gnome.org> * gio/giomodule.c (init_gio): Use the prefix G_IO_ for stripping constants instead of just G_ * gobject/gobjectmodule.c (pyg_constant_strip_prefix): Check so the fist part of name and strip_prefix are the same, if they don't, just strip of the part of strip_prefix which matches. This removes the initial IO_* prefix for some constants in gio. Eg, gio.IO_ERROR_* -> gio.ERROR_* svn path=/trunk/; revision=817
-rw-r--r--ChangeLog12
-rw-r--r--gio/giomodule.c2
-rw-r--r--gobject/gobjectmodule.c19
3 files changed, 27 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 655cd1c..788bdf9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-07-17 Johan Dahlin <johan@gnome.org>
+
+ * gio/giomodule.c (init_gio):
+ Use the prefix G_IO_ for stripping constants instead of just G_
+ * gobject/gobjectmodule.c (pyg_constant_strip_prefix):
+ Check so the fist part of name and strip_prefix are the same,
+ if they don't, just strip of the part of strip_prefix which
+ matches.
+
+ This removes the initial IO_* prefix for some constants in gio.
+ Eg, gio.IO_ERROR_* -> gio.ERROR_*
+
2008-07-16 Johan Dahlin <johan@gnome.org>
* configure.ac: Post release version bump
diff --git a/gio/giomodule.c b/gio/giomodule.c
index 6024258..7a24744 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -47,7 +47,7 @@ init_gio(void)
init_pygobject();
pygio_register_classes(d);
- pygio_add_constants(m, "G_");
+ pygio_add_constants(m, "G_IO_");
}
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c
index 3bd5645..d9b22ed 100644
--- a/gobject/gobjectmodule.c
+++ b/gobject/gobjectmodule.c
@@ -2964,15 +2964,24 @@ const gchar *
pyg_constant_strip_prefix(const gchar *name, const gchar *strip_prefix)
{
gint prefix_len;
- guint j;
+ guint i;
prefix_len = strlen(strip_prefix);
-
+
+ /* Check so name starts with strip_prefix, if it doesn't:
+ * return the rest of the part which doesn't match
+ */
+ for (i = 0; i < prefix_len; i++) {
+ if (name[i] != strip_prefix[i] && name[i] != '_') {
+ return &name[i];
+ }
+ }
+
/* strip off prefix from value name, while keeping it a valid
* identifier */
- for (j = prefix_len; j >= 0; j--) {
- if (g_ascii_isalpha(name[j]) || name[j] == '_') {
- return &name[j];
+ for (i = prefix_len; i >= 0; i--) {
+ if (g_ascii_isalpha(name[i]) || name[i] == '_') {
+ return &name[i];
}
}
return name;