GNOME Bugzilla – Bug 647363
Port to gtk3
Last modified: 2013-09-22 16:41:19 UTC
Been doing some porting to Gtk3 the last days. Now that I've seen the compile-time check has been committed to banshee, I thought it would be useful my WIP patch in order to not duplicate efforts.
s/useful/useful to share/
Created attachment 185640 [details] WIP patch Pending things to do: - Wrap every change in a #ifGTK3 define. - Keep fixing stuff until it compiles (currently giving 86 errors).
Created attachment 185647 [details] [review] WIP patch v2 Down to 77 errors.
Created attachment 185661 [details] [review] WIP patch v3 Down to 46 errors.
Created attachment 185761 [details] [review] Patch v4 Down to 34 errors.
Created attachment 185976 [details] [review] Patch v5
Patch above makes it down to 13 errors, but having a patched gtk-sharp. I'll submit soon my patches to the latter.
Created attachment 186031 [details] Patch v6 No compilation errors. Beware: 1) Untested. 2) Some things to do are pending: 1.1: Commented out some stuff like the On_ events for scrolling adjustments, not sure if it works out of the box just by inheriting from ScrollableImplementor. 1.2: Commit some stuff to gtk-sharp upstream (the overload for gtk_show_uri). 1.3: I commented out some method OnWidgetDestroyed() that had a lot of old API usage. As it will happen on destroy, it's not my priority now (my priority is launching banshee with Gtk3, I will deal with problems or shutdown later). 1.4: Wrap every change around #if GTK_3. 1.5: Un-hardcode some things, like the absolute path to my cairo-sharp lib. 1.6: Determine some things: accessibility support, .pc file for cairo-sharp?
Awesome, good work Andrés. Are all the places you've touched but that need work documented at least with a FIXME? And ideally any more explanation you can give, unless you think you'll be the one to finish it and will remember... Re 1) you can test some of Hyena.Gui with `make hg` 1.4: Don't worry about wrapping in #if GTK3 for now -- we're considering ditching Gtk#2 entirely, plus that can be done at the last minute if needed 1.6: For a11y, shouldn't it work fine? We didn't use it with old Gtk#2 b/c of some API borkage, but we've been using it since 2.12.10 IIRC, and hopefully Gtk#3 is usable in the same way?
(In reply to comment #9) > Awesome, good work Andrés. Are all the places you've touched but that need Thanks! > work documented at least with a FIXME? And ideally any more explanation you > can give, unless you think you'll be the one to finish it and will remember... Ok, I'll add FIXMEs and update the patch, just in case I'm not the one who finishes this. > Re 1) you can test some of Hyena.Gui with `make hg` Cool, I'll test. > 1.4: Don't worry about wrapping in #if GTK3 for now -- we're considering > ditching Gtk#2 entirely, plus that can be done at the last minute if needed Ok. > 1.6: For a11y, shouldn't it work fine? We didn't use it with old Gtk#2 b/c of > some API borkage, but we've been using it since 2.12.10 IIRC, and hopefully > Gtk#3 is usable in the same way? Not sure. I just tried to build banshee with this hyena and I got: ./Hyena.Data.Gui/ListView/ListView_Accessible.cs(171,39): error CS0115: `Hyena.Data.Gui.ListViewAccessibleFactory<T>.OnCreateAccessible(GLib.Object)' is marked as an override but no suitable method found to override ./Hyena.Data.Gui/ListView/ListView_Accessible.cs(179,39): error CS0115: `Hyena.Data.Gui.ListViewAccessibleFactory<T>.OnGetAccessibleType()' is marked as an override but no suitable method found to override ./Hyena.Widgets/RatingEntry.cs(468,39): error CS0115: `Hyena.Widgets.RatingAccessibleFactory.OnCreateAccessible(GLib.Object)' is marked as an override but no suitable method found to override ./Hyena.Widgets/RatingEntry.cs(473,39): error CS0115: `Hyena.Widgets.RatingAccessibleFactory.OnGetAccessibleType()' is marked as an override but no suitable method found to override Compilation failed: 4 error(s), 0 warnings make[4]: *** [../../../bin/Hyena.Gui.dll] Error 1 make[3]: *** [all-recursive] Error 1 make[2]: *** [all-recursive] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 So there's some more stuff to do here.
Hey, I talk with gabaug yesterday because I am on holiday so have free time to help. SO I have try to build with your last patch and get the same error. I fix it with just use the 2 Delegate which replace this functions. But I face a lot of other error: ./Hyena.Data.Gui/Accessibility/ListViewAccessible.cs(40,26): error CS0535: `Hyena.Data.Gui.Accessibility.ListViewAccessible<T>' does not implement interface member `Atk.TableImplementor.GetSelectedColumns(out int)' /home/dufoli/opt/mono-2.10/lib/mono/gac/atk-sharp/3.0.0.0__35e10195dab3c99f/atk-sharp.dll (Location of the symbol related to previous error) ./Hyena.Data.Gui/Accessibility/ListViewAccessible.cs(40,26): error CS0535: `Hyena.Data.Gui.Accessibility.ListViewAccessible<T>' does not implement interface member `Atk.TableImplementor.GetSelectedRows(out int)' /home/dufoli/opt/mono-2.10/lib/mono/gac/atk-sharp/3.0.0.0__35e10195dab3c99f/atk-sharp.dll (Location of the symbol related to previous error) ./Hyena.Data.Gui/ColumnCellCheckBox.cs(62,46): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Data.Gui/ColumnCellCheckBox.cs(62,19): error CS0612: `Gtk.Style.PaintCheck(Gtk.Style, Cairo.Context, Gtk.StateType, Gtk.ShadowType, Gtk.Widget, string, int, int, int, int)' is obsolete ./Hyena.Data.Gui/ListView/ListView_Windowing.cs(161,17): error CS0037: Cannot convert null to `Gtk.Requisition' because it is a value type ./Hyena.Data.Gui/ListView/ListView_Header.cs(585,53): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Data.Gui/ListView/ListView_Header.cs(585,23): error CS0612: `Gtk.Widget.ModifyFg(Gtk.StateType, Gdk.Color)' is obsolete ./Hyena.Data.Gui/ListView/ListView_Header.cs(622,53): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Data.Gui/ListView/ListView_Header.cs(622,23): error CS0612: `Gtk.Widget.ModifyFg(Gtk.StateType, Gdk.Color)' is obsolete ./Hyena.Data.Gui/ListView/ListView_Accessible.cs(169,13): error CS0119: Expression denotes a `type', where a `variable', `value' or `method group' was expected ./Hyena.Data.Gui/ListView/ListView_Accessible.cs(175,13): error CS0119: Expression denotes a `type', where a `variable', `value' or `method group' was expected ./Hyena.Gui.Theming/GtkColors.cs(119,75): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Gui.Theming/GtkColors.cs(120,75): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Gui.Theming/GtkColors.cs(121,75): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Gui.Theming/GtkColors.cs(122,75): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Gui.Theming/GtkColors.cs(123,75): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Gui.Theming/GtkColors.cs(124,75): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Gui.Theming/GtkColors.cs(125,75): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Gui.Theming/GtkTheme.cs(46,83): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Gui.Theming/GtkTheme.cs(47,89): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Gui/BaseWidgetAccessible.cs(218,25): error CS1061: Type `Gtk.Widget' does not contain a definition for `IsTopLevel' and no extension method `IsTopLevel' of type `Gtk.Widget' could be found (are you missing a using directive or an assembly reference?) /home/dufoli/opt/mono-2.10/lib/mono/gac/gtk-sharp/3.0.0.0__35e10195dab3c99f/gtk-sharp.dll (Location of the symbol related to previous error) ./Hyena.Gui/BaseWidgetAccessible.cs(234,20): error CS1061: Type `Gtk.Widget' does not contain a definition for `SetUposition' and no extension method `SetUposition' of type `Gtk.Widget' could be found (are you missing a using directive or an assembly reference?) /home/dufoli/opt/mono-2.10/lib/mono/gac/gtk-sharp/3.0.0.0__35e10195dab3c99f/gtk-sharp.dll (Location of the symbol related to previous error) ./Hyena.Gui/BaseWidgetAccessible.cs(246,24): error CS1061: Type `Gtk.Widget' does not contain a definition for `IsTopLevel' and no extension method `IsTopLevel' of type `Gtk.Widget' could be found (are you missing a using directive or an assembly reference?) /home/dufoli/opt/mono-2.10/lib/mono/gac/gtk-sharp/3.0.0.0__35e10195dab3c99f/gtk-sharp.dll (Location of the symbol related to previous error) ./Hyena.Gui/GtkUtilities.cs(131,34): error CS0612: `Gtk.Rc.GetStyleByPaths(Gtk.Settings, string, string, GLib.GType)' is obsolete ./Hyena.Gui/GtkUtilities.cs(137,25): error CS0612: `Gtk.Widget.ModifyBase(Gtk.StateType, Gdk.Color)' is obsolete ./Hyena.Gui/GtkUtilities.cs(138,25): error CS0612: `Gtk.Widget.ModifyBg(Gtk.StateType, Gdk.Color)' is obsolete ./Hyena.Gui/GtkUtilities.cs(139,25): error CS0612: `Gtk.Widget.ModifyFg(Gtk.StateType, Gdk.Color)' is obsolete ./Hyena.Gui/GtkUtilities.cs(140,25): error CS0612: `Gtk.Widget.ModifyText(Gtk.StateType, Gdk.Color)' is obsolete ./Hyena.Gui/GtkUtilities.cs(180,20): error CS0618: `Hyena.Gui.GtkUtilities.ShowUri(Gdk.Screen, string, uint)' is obsolete: `Use Gtk.Global.ShowUri() from gtk# 3.x' ./Hyena.Widgets/AnimatedBox.cs(213,42): error CS0612: `Gtk.Widget.SizeRequest()' is obsolete ./Hyena.Widgets/AnimatedWidget.cs(129,36): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/AnimatedWidget.cs(130,19): error CS0612: `Gtk.Style.Attach(Gdk.Window)' is obsolete ./Hyena.Widgets/AnimatedWidget.cs(130,13): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/AnimatedWidget.cs(149,42): error CS0612: `Gtk.Widget.SizeRequest()' is obsolete ./Hyena.Widgets/ComplexMenuItem.cs(85,36): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/ComplexMenuItem.cs(85,27): error CS0612: `Gtk.Style.PaintBox(Gtk.Style, Cairo.Context, Gtk.StateType, Gtk.ShadowType, Gtk.Widget, string, int, int, int, int)' is obsolete ./Hyena.Widgets/ComplexMenuItem.cs(91,36): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/ComplexMenuItem.cs(110,36): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/ComplexMenuItem.cs(110,27): error CS0612: `Gtk.Style.PaintBox(Gtk.Style, Cairo.Context, Gtk.StateType, Gtk.ShadowType, Gtk.Widget, string, int, int, int, int)' is obsolete ./Hyena.Widgets/GrabHandle.cs(56,47): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/GrabHandle.cs(56,31): error CS0612: `Gtk.Style.PaintHandle(Gtk.Style, Cairo.Context, Gtk.StateType, Gtk.ShadowType, Gtk.Widget, string, int, int, int, int, Gtk.Orientation)' is obsolete ./Hyena.Widgets/MenuButton.cs(126,43): error CS0612: `Gtk.Widget.SizeRequest()' is obsolete ./Hyena.Widgets/MenuButton.cs(132,43): error CS0612: `Gtk.Widget.SizeRequest()' is obsolete ./Hyena.Widgets/MenuButton.cs(164,45): error CS0612: `Gtk.Widget.SizeRequest()' is obsolete ./Hyena.Widgets/MessageBar.cs(58,17): error CS0612: `Gtk.Widget.EnsureStyle()' is obsolete ./Hyena.Widgets/MessageBar.cs(60,29): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/MessageBar.cs(60,17): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/MessageBar.cs(102,13): error CS0612: `Gtk.Widget.EnsureStyle()' is obsolete ./Hyena.Widgets/MessageBar.cs(136,31): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/MessageBar.cs(150,25): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/MessageBar.cs(150,13): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/MessageBar.cs(151,27): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/MessageBar.cs(151,19): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/PulsingButton.cs(99,71): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/RatingEntry.cs(183,28): error CS0612: `Gtk.Rc.GetStyleByPaths(Gtk.Settings, string, string, GLib.GType)' is obsolete ./Hyena.Widgets/RatingEntry.cs(183,13): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/RatingEntry.cs(250,13): error CS0612: `Gtk.Widget.EnsureStyle()' is obsolete ./Hyena.Widgets/RatingEntry.cs(252,66): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/RatingEntry.cs(257,33): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/RatingEntry.cs(258,33): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/RatingEntry.cs(277,41): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/RatingEntry.cs(277,27): error CS0612: `Gtk.Style.PaintFlatBox(Gtk.Style, Cairo.Context, Gtk.StateType, Gtk.ShadowType, Gtk.Widget, string, int, int, int, int)' is obsolete ./Hyena.Widgets/RatingEntry.cs(279,40): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/RatingEntry.cs(279,27): error CS0612: `Gtk.Style.PaintShadow(Gtk.Style, Cairo.Context, Gtk.StateType, Gtk.ShadowType, Gtk.Widget, string, int, int, int, int)' is obsolete ./Hyena.Widgets/RatingEntry.cs(285,73): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/RatingEntry.cs(285,101): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/RatingEntry.cs(466,13): error CS0119: Expression denotes a `type', where a `variable', `value' or `method group' was expected ./Hyena.Widgets/RatingEntry.cs(469,13): error CS0119: Expression denotes a `type', where a `variable', `value' or `method group' was expected ./Hyena.Widgets/RatingEntry.cs(513,20): error CS0612: `Gtk.Widget.ModifyFont(Pango.FontDescription)' is obsolete ./Hyena.Widgets/RoundedFrame.cs(115,55): error CS0612: `Gtk.Widget.SizeRequest()' is obsolete ./Hyena.Widgets/SegmentedBar.cs(487,70): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/SegmentedBar.cs(630,31): error CS0612: `Gtk.Widget.SizeRequest()' is obsolete ./Hyena.Widgets/WrapLabel.cs(111,40): error CS0612: `Gtk.Widget.Style' is obsolete ./Hyena.Widgets/WrapLabel.cs(111,27): error CS0612: `Gtk.Style.PaintLayout(Gtk.Style, Cairo.Context, Gtk.StateType, bool, Gtk.Widget, string, int, int, Pango.Layout)' is obsolete Compilation failed: 74 error(s), 0 warnings make[4]: *** [../../../bin/Hyena.Gui.dll] Erreur 1 make[3]: *** [all-recursive] Erreur 1 make[2]: *** [all-recursive] Erreur 1 make[1]: *** [all-recursive] Erreur 1 make: *** [all] Erreur 2
(In reply to comment #11) > Hey, Hey olivier, thanks for your help, see my reply inline: > I talk with gabaug yesterday because I am on holiday so have free time to help. > SO I have try to build with your last patch and get the same error. > I fix it with just use the 2 Delegate which replace this functions. Cool, can you post your patch for the accessibility parts? > But I face a lot of other error: Don't worry, those seem warnings that may appears as errors because you're building hyena inside banshee (if you build hyena alone warnaserror is not enabled). I've been also lately committing some fixes to gtk-sharp 3.0 upstream so my last patch got a bit outdated. I'll post a new version soon (and my latest patch already fixes some of these warnings you mention BTW). Let's try to not overlap or otherwise we'll duplicate efforts! (I'm thinking that maybe we should open a branch so we work more comfortably?)
Created attachment 186410 [details] olivier patch gtk3.diff here is the full patch
Created attachment 186415 [details] [review] patch gtk3 Ok this patch replace the previous one and..... it compile!!!! WHHOOOOOHHOO
Created attachment 186419 [details] [review] Patch v7 Syncs with gtk-sharp master's API.
(In reply to comment #14) > Created an attachment (id=186415) [details] [review] > patch gtk3 > > Ok this patch replace the previous one and..... it compile!!!! > WHHOOOOOHHOO Hey olivier, cool, but now we have to merge our patches... I've pinged you on IRC but you're not there now. I've discussed on how can we coordinate better with Bertrand and he recommended me to fork on github, so here you go: https://github.com/knocte/hyena-gtk3 I'll commit my patch here, and later you can give me a pull request for yours.
We have merged the patches in the branch above, I'll mark these as obsolete...
do we need to wrap code between #if GTK3 / #endif to keep it gtk2 compatible ?
As I mentioned in comment #9, "Don't worry about wrapping in #if GTK3 for now -- we're considering ditching Gtk#2 entirely, plus that can be done at the last minute if needed".
I merged your gtk3/master branch with hyena master and pushed it to git.gnome.org as branch 'gtk3'. Please push further work there. Please be more careful with having tidy commits and not having typos in commit msgs (eg Olivier's [gt3] and [GTK3] prefixes; should be [gtk3]).
Created attachment 187720 [details] gdkColor new file Hey thisis not a patch. GtkColors and GTKUtilities are the remaining 2 class to migrate but it is a hard task. Best is to remove them. The trick for moment is to just mark some method as obsolete. I have try to migrate some code too but not sure about how gtk3 work with path. So here is first file, second will come after. Anyway, because I am not sure about this patch, I post my work to know if it is ok.
Created attachment 187721 [details] GtkUtilities file GtkUtilities now. Same thing as previous post. Need review/feedback.
Hyena in git master is now using GTK 3, so I'm closing this as fixed. New or remaining issues around that subject should be filled as separate bugs. Thanks everyone !