diff options
| -rw-r--r-- | ChangeLog | 12 | ||||
| -rw-r--r-- | gio/giomodule.c | 2 | ||||
| -rw-r--r-- | gobject/gobjectmodule.c | 19 |
3 files changed, 27 insertions, 6 deletions
@@ -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; |
