Porting panel plugins to Gtk3

Landry Breuil landry.breuil at gmail.com
Tue May 31 21:15:57 CEST 2016

harald judt (who was maintaining it so far) is fine with merging this
- if you want to be the new maintainer of that plugin, mail accounts
at xfce.org so that we can set you up your git account so that you can
merge/push things to git.xfce.org yourself :)



On Fri, May 27, 2016 at 1:28 AM, André Miranda <andreldm1989 at gmail.com> wrote:
> Hello there guys,
> Thanks to Landry's very descriptive commits, I was able to port Xfce Panel's
> single most important plugin: Xfce4-Eyes-Plugin!
> Jokes apart, I just wanted to try it out with a simple plugin before porting
> others.
> Here is code: https://github.com/andreldm/xfce4-eyes-plugin
> (how convenient a push request would be...)
> Cheers,
> André Miranda
> On Sun, May 1, 2016 at 9:02 AM, Landry Breuil <landry at xfce.org> wrote:
>> Hi,
>> so, if we want to have Xfce 4.14 with Gtk+3 in a foreseeable future, at
>> some point porting has to resume/restart.. in the past days, i've spent
>> some time porting *some* of the panel plugins i *somewhat* maintain, and
>> here are some tips and tricks:
>> * i'm targetting Gtk+3 only, bye-bye Gtk+2. Technically it would be
>>   doable to support both with some #ifdefs, but is there a point..
>> * i'm going for a feature-parity target first. No UI revamp, no
>>   revolution. Ideally, i'd like to move dialog construction to .ui files
>> / GtkBuilder, that might come next. Same thing, using cairo drawing
>> instead of abusing progressbars for monitors/meters might be nice,
>> maybe next.
>> * devhelp is your friend to browse the Gtk+3 doc, as is
>> https://developer.gnome.org/gtk3/stable/
>> * there's an ongoing discussion to know if we finally target 3.14 or
>>   3.20, as there are some 'breaking' changes wrt styling in >= 3.16 with
>> css providers (see
>> https://blogs.gnome.org/mclasen/2016/04/29/yet-another-gtk-update/)
>> * styling that worked in 3.14 is considered deprecated in 3.16/3.20, so
>>   has to be #ifdef'ed, see for example
>> http://git.xfce.org/panel-plugins/xfce4-systemload-plugin/tree/panel-plugin/systemload.c#n448
>> * most of the changes are mechanical, Replacing XfceHVBox /
>>   GtkHBox/GtkVBox by GtkBox, using GtkOrientable, replacing GtkTable by
>> GtkGrid, replacing GTK_STOCK* macros by their gtk equivalent names,
>> replacing GtkToggleButton/GtkCheckBox by GtkSwitch, replacing GdkColor
>> by GdkRGBA, usinc GtkCssProvider instead of setting bg/base colors.. all
>> this is documented in Gtk+3 doc when a widget is deprecated, and the
>> general migration doc is here :
>> https://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html
>> So far, i've ported over the following plugins (have a look at the
>> commits to see what changes are needed):
>> http://git.xfce.org/panel-plugins/xfce4-systemload-plugin/log/
>> http://git.xfce.org/panel-plugins/xfce4-mpc-plugin/log/
>> http://git.xfce.org/panel-plugins/xfce4-diskperf-plugin/log/
>> http://git.xfce.org/panel-plugins/xfce4-fsguard-plugin/log/
>> http://git.xfce.org/panel-plugins/xfce4-datetime-plugin/log/
>> http://git.xfce.org/panel-plugins/xfce4-smartbookmark-plugin/log/
>> Not everything is perfect, but things are moving nicely.
>> To 'compare' gtk2 and gtk3 version and have both in the same panel, i
>> use the following trick (for a 'foo' panel plugin):
>>   * in /usr/share/xfce4/panel/plugins/, copy foo.desktop to
>> foo-git.desktop
>>   * in foo-git.desktop, only keep untranslated Name/Comment and append
>> 'git' to Name to differentiate plugins
>>   * append X-XFCE-API=2.0 to foo-git.desktop
>>   * append '-git' to X-XFCE-Module line
>>   * symlink path/to/my/workdir/panel-plugin/.libs/libfoo.so to
>> /usr/lib/xfce4/panel/plugins/libfoo-git.so
>> xfce4-panel -a should allow you to load the git version of the plugin,
>> without overwriting the 'released' gtk2 version.
>> Mandatory screenshots using clearklooks theme, one with gtk3 versions
>> http://i.imgur.com/UwZEaGN.png (not all the checkbox are migrated to
>> gtkswitch, and i know systemload dialog is a bit huge...)
>> and the same thing with the last release of the same plugins
>> http://i.imgur.com/aS44yQV.png and the two panels with the same plugins
>> loaded using default config. Okay, progressbars dont look the same,
>> buttons might be a git bigger...
>> All that to say that it's an easy task for someone who wants to start
>> playing with gtk code and porting to gtk3 - all help on this is welcome!
>> If there's a plugin you use and care about, and that looks
>> abandoned/unmaintained, grab the git master, try to apply the same
>> changes, and post patches to bugzilla/the list.
>> Of course, feedback, criticism and testing are welcome! I've only tested
>> those changes on my OpenBSD desktop with Gtk 3.20.3..
>> Landry
>> _______________________________________________
>> Xfce4-dev mailing list
>> Xfce4-dev at xfce.org
>> https://mail.xfce.org/mailman/listinfo/xfce4-dev
> _______________________________________________
> Xfce4-dev mailing list
> Xfce4-dev at xfce.org
> https://mail.xfce.org/mailman/listinfo/xfce4-dev

More information about the Xfce4-dev mailing list