jeremyletang / rgtk

GTK+ bindings and wrappers for Rust (DEPRECATED SEE https://github.com/rust-gnome )
GNU Lesser General Public License v3.0
121 stars 22 forks source link

Improve naming consistency #208

Closed oakes closed 9 years ago

oakes commented 9 years ago

This is a quick bulk rename I did to improve consistency. It renames some get_* functions to unwrap_* when they have an equivalent wrap_*, to show that they do the opposite. Specifically, it does the following:

  1. Renames get_pointer to unwrap_pointer in many places (note that src/gtk/widgets/value.rs already does this, since get_pointer conflicted with its own function of the same name).
  2. Renames FFIGObject::get_gobject to FFIGObject::unwrap_gobject.
  3. Renames FFIWidget::get_widget to FFIWidget::unwrap_widget and FFIWidget::wrap to FFIWidget::wrap_widget.

What do you think? It's mainly just scratching an itch, but I thought it cleaned things up. Another thing we can do in the future is replace all the explicit unwrap_pointer/wrap_pointer definitions with the impl_GObjectFunctions macro.

GuillaumeGomez commented 9 years ago

Perfect ! It's been a long time we wanted to do that ! Thanks a lot !

I just made impl_GObjectFunctions as a workaround. I didn't think further than that but it could actually be a good idea.

Anyway, thanks for this PR !

gkoz commented 9 years ago

Aren't you beating a dead horse? Even #197 would do away with FFIGObject and FFIWidget and I'm working on a further improved design as we speak.

oakes commented 9 years ago

@gkoz I haven't looked at your RFC yet but the rename only took a few minutes so it wasn't much work on my part.

GuillaumeGomez commented 9 years ago

@gkoz: I see this as an intermediate step. It would actually simplify your own RFC's implementation (from my point of view). But yes, it's only useful on short term.