Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#3847 closed Enhancement (fixed)

GTK+ 3 transition: Use accessor functions

Reported by: charles Owned by: charles
Priority: Normal Milestone: 2.20
Component: GTK+ Client Version: 2.13
Severity: Normal Keywords:
Cc:

Description

GTK+ 3.0 is making most GTK+ struct's fields private. Instead of using direct access, the fields must be read by accessor methods. More background information on this can be found at http://live.gnome.org/GnomeGoals/UseGseal

Change History (8)

comment:1 Changed 10 years ago by charles

r11567: use gtk_dialog_content_area() instead of GTK_DIALOG(w)->vbox

comment:2 Changed 10 years ago by charles

r11589: don't directly access GtkCellRenderer?.xpad, GtkCellRenderer?.ypad, or GtkWidget?.window.

comment:3 Changed 10 years ago by charles

  • Resolution set to fixed
  • Status changed from new to closed

comment:4 Changed 10 years ago by ijuxda

gtr_cell_renderer_get_padding( &cell->parent, &xpad, &ypad );

Shouldn't that be

gtr_cell_renderer_get_padding( GTK_CELL_RENDERER( cell ), &xpad, &ypad );

?

comment:5 Changed 10 years ago by charles

I don't see the benefit of adding redundant RTTI... by the time we reach that point in the code, we already know that cell is a valid TorrentCellRenderer? pointer.

comment:6 Changed 10 years ago by ijuxda

  1. The point of this ticket was to remove direct references to struct fields.
  2. There is no precedent for such an access style in all of gtk.
  3. The type macro expands to a pointer cast for release builds, not rtti.
  4. The type macro works even if the name of the embedded struct changes.
  5. The type macro works even if TorrentCellRenderer? does not directly derive from GtkCellRenderer?.

comment:7 Changed 10 years ago by charles

Those are good points. I agree.

Added to trunk in r11601.

comment:8 Changed 10 years ago by jordan

  • Summary changed from GTK+ 3 transition: Use accessor functions instead direct access to GTK+ 3 transition: Use accessor functions
Note: See TracTickets for help on using tickets.