GNOME Bugzilla – Bug 651605
Replace gtk_misc_set/get_padding() api and use the new GtkWidget "margin" properties instead
Last modified: 2011-12-12 19:20:00 UTC
Created attachment 188967 [details] [review] Replace gtk_misc_set/get_padding() api Patch following
Review of attachment 188967 [details] [review]: ::: gtk/gtkaccellabel.c @@ +432,2 @@ if (direction == GTK_TEXT_DIR_RTL) + x = (margin_left + margin_right) / 2; This is not really the same thing, or is it ? I would expect to use margin_left/_right here, as appropriate ::: gtk/gtkarrow.c @@ +355,3 @@ + x = (margin_left + margin_right) / 2 + ((width - extent) * xalign); + y = (margin_top + margin_bottom) / 2 + ((height - extent) * yalign); Again here. Whats with all the averaging ? ::: gtk/gtklabel.c @@ +3967,3 @@ gtk_widget_get_allocation (widget, &allocation); + x = floor (allocation.x + (margin_right + margin_left) / 2 + xalign * (allocation.width - req_width) - logical.x); Here too, I would expect to use either left or right as appropriate, not their average.
You cannot use gtk_widget_get_margin_*() APIs in draw, size_allocate or get_preferred_*() functions. They work completely different. Margins are taken care of automatically already. That said, changing those functions would also stop gtk_misc_set_padding() from working, so it's an API break. If we wanted to replace it like that, we should make gtk_misc_set_padding() call gtk_widget_set_margin() and replace all gtk_misc_get_padding() calls with 0.
Created attachment 189074 [details] [review] Replace gtk_misc_set_padding() with GtkWidget:margin properties After talking with Benjamin, seems that we cannot replace misc_get_padding() with widget_get_margin(). We can only replace misc_get_padding() with 0 - but that breaks anybody using misc_set_padding, so seems we can only remove the misc_set() calls
Apart from me wondering if we should have a gtk_widget_set_margin() shorthand and using that instead of g_object_set(), the patch looks fine.
Comment on attachment 189074 [details] [review] Replace gtk_misc_set_padding() with GtkWidget:margin properties commit 32ef28bc8592e0983c5b31ae64a30847164b981e
(In reply to comment #4) > Apart from me wondering if we should have a gtk_widget_set_margin() shorthand > and using that instead of g_object_set(), Filled bug #651720