GNOME Bugzilla – Bug 96834
Remove notebook->focus_tab
Last modified: 2018-05-02 13:46:21 UTC
The focus_tab field in GtkNotebook is now obsolete because the focus tab is now always identical to the current page. A lot of code in gtknotebook.c could be removed because of this simplification.
See bug 82108 for information about the change making focus_tab unneccesary.
Created attachment 240742 [details] [review] Patch to remove notebook->focus_tab I played around with this the last few days and I've come up with the attached patch. Basically, I did not remove focus_tab but rather cur_page and replace focus_tab with cur_tab. I'm not particularly happy about the _GTK_NOTEBOOK_PAGE define(it only exists because calling ->data obv. fails if cur_tab is NULL). I removed gtk_notebook_switch_focus_tab and gtk_notebook_switch_page now takes a GList* instead of a GtkNotebookPage*, which removed a few g_list_find calls. I tested it by manually launching tests/testnotebookdnd and comparing the behavior to the testnotebookdnd from master, fixed a few bugs but now I *think* they are the same. I don't think the removed 30 lines are really what was meant with the "lot of code", so I'd be happy to hear what else can be removed.
The patch above probably does not apply anymore and it's very likely wrong, but if anyone wants to fix this gnome-love bug: you can use it as a base and fix it up. Or just do it on your own of course.
Created attachment 313068 [details] [review] Proposed patch v2 The end result is pretty much the same, although my use of the GTK_NOTEBOOK_PAGE() macro is more liberal. I also replaced the macro entirely with one that has a null check. There seem to be no noticable regressions on my end.
Created attachment 313071 [details] [review] Proposed patch v2.1
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/223.