Home > Xfce > XFC: Xfce Gets C++ Language BindingsXFC: Xfce Gets C++ Language Bindings Submitted by Erik Harrison Eugenia Loli 2005-03-02 Xfce 33 CommentsThe Xfce Foundation Classes, a lightweight C++ binding for Xfce and GTK has made its first development release, with plans for a stable release around the time of Xfce 4.4. About The Author Eugenia LoliEx-programmer, ex-editor in chief at OSNews.com, now a visual artist/filmmaker.Follow me on Twitter @EugeniaLoli 33 Comments 2005-03-02 10:52 pm Perhaps XFCE will suceed where gnome doesn’t? Gnome guys seems to hate C++ – that’s OK, C++ is not the best language out there, but so is C. If you use C++ properly there’s not any reason for not using it, just like C, except that C is even more limited for desktop-like apps. Seriously, this is a great step. With C++ on the table and people decided to use it, they could evolve much faster than gnome does. How can people do things like writing evolution in C? It’s painful and the one way to face it is throwing people and money on it. They seem to use mono quite a lot these days but not in the core, I wish they’d rewrite the core of gnome 3.0 in C++ or Obj-c and then write the apps in c++/objc/mono/java. 2005-03-02 11:07 pm there is already gtkmm which is an STL style GTK C++ binding, if you know the STL, then the ways it does things will already be familiar. XFCE will not suceed where gnome doesn’t for 1 reason. it is building on all the gnome architecture which is moving more and more into gtk and its dependancies. without gnome driving gtk xfce wouldn’t have anything to work from. 2005-03-02 11:41 pm I’ll prefer that they use Objective-C, it’s only a object oriented extension to C, easier than C++ and much more C compatible (actually it’s C with OO features provided mostly by a runtime system) so they can rewrite GTK+ parts in Objective-C as needed. 2005-03-02 11:42 pm xfce = Gnome done right 2005-03-02 11:56 pm “there is already gtkmm which is an STL style GTK C++ binding”Yes, but Gnome developers hate C++. If xfce developers start using it they can do big things. C++ it’s there, it has good compilers, and they’ve the oportunity of building a good desktop using all the major features (composite, DBUS). 2005-03-03 12:06 am C++, as complex as it is when looking at the whole language, does offer powerful features that make application development easier than C, such as the STL, namespaces, and exception handling. The programmer just has to use the bits of C++ that make sense for a particular situation, and not try to grasp or implement C++ in it’s entirety.GTK+ is a really good GUI library. But application development with pure C is a big task, and the object system is awkward (since OOP is not supported natively in C).Thus, it makes sense to have C++ wrappers around the GTK+ library. This will accelerate application development for Xfce.I’ve written programs in both GTK+/Gnome and QT/KDE, and QT, a C++ widget library, is much much easier. Rapid application development with QT/QMake/QT Designer is a piece of cake. I can see, by looking at the XFC website, that Xfce Foundation Classes have the same potential.Now perhaps they can come out with an XFC binding to Glade, or some visual IDE, then XFC will be really rolling.GTKmm seems pretty powerful, but it seems the Gnome devs aren’t embracing it as much as they should. They seem to stick to pure C or go with Mono (or Python). Nothing wrong with that, but C++ wrappers have the potential to give the speed and low memory imprint of C programs, with the ease of development of higher level languages like C#/Mono or Python. QT definetly accomplishes this. XFC seems to have the same potential. 2005-03-03 12:47 am Traditionally many Unix programmers have shyed away from C++ for various reasons. In fact, besides the licensing problems that QT had and still has, de Icaza has stated that he’s no fan of C++. There wasn’t even a standard until, what, ’98 or so?Many Gnome people are jumping over C++ altogether and doing stuff in C# or Python, which makes sense for most GUI stuff. 2005-03-03 1:05 am “If you use C++ properly there’s not any reason for not using it, just like C, except that C is even more limited for desktop-like apps. Seriously, this is a great step. With C++ on the table and people decided to use it, they could evolve much faster than gnome does. How can people do things like writing evolution in C? It’s painful and the one way to face it is throwing people and money on it. They seem to use mono quite a lot these days but not in the core, I wish they’d rewrite the core of gnome 3.0 in C++ or Obj-c and then write the apps in c++/objc/mono/java.”I agre with you 100%. Hell, the KDE camp has shown the Unix world that C++ does the job quite well. I’m looking forward to future releases of XFCE. 2005-03-03 1:09 am What’s up with the ugly underscore naming thing? 2005-03-03 1:21 am Uhmm, gtk+ uses Pascal notation for types and the underscore for methods. I don’t know how anybody could call it “ugly” when it’s more readable than camel/pascal notation for methods. 2005-03-03 2:21 am When it comes to standards, python is far worse than C++. It’s constantly changing (decorators), has superfluous features (like generators, lambda functions and such). They can be useful, but IMO they just litter the language. You know, they say the more ways you accomplish one thing, the worse.Which is a pity, because I liked the simplicity combined with flexibility. Now the simplicity is going away. Sure you don’t have to use those features if you don’t want to, but you’ll have to live with other people’s code making use of them. And you constantly have to update the interpreter in order to stay up to date with modern code.IMO they should focus on improving the interpreter, making it thread safe, equipping it with a real garbage collector. They should also decide which features are necessary, which aren’t and create a standardized version of the language. 2005-03-03 2:37 am You should take a look at PEP 3000 (Python 3000). A major emphasis is on simplication and weeding out redundancy.http://www.python.org/peps/pep-3000.html 2005-03-03 3:34 am Except that nobody writes GUIs in pure C, yes even the GNOME developers don’t. Have a look at Glib and the Gobject system sometime, okay? 2005-03-03 3:35 am I fild MyMethod() more readable than my_method(); 2005-03-03 3:41 am I find my_really_obnoxiously_long_method() easier to read than MyReallyObnoxiouslyLongMethod(). 2005-03-03 4:15 am This is a good thing, there are a lot of C++ libraries out there and now you can use it with GTK+. Hopefully it will be preinstalled, and then it will all be up to the documentation. If these requirements are met, than I’m satisfied. The libraries will develop over time, there’s a lot of standard C++ code out there. 2005-03-03 4:17 am Ofcourse C++ is for people who have a mind of their own, and are not helplessly dependant upon vendors and advertising. 2005-03-03 5:49 am Take a look at FLTK. http://fltk.org It really is a sleeper C++ gui toolkit. So much attention on GTK+, Qt. GTK+, as metioned, does not use C++ and Qt is an application framework that is a proprietary superset of C++ with all the bloat that goes along with it. Neither uses pure C++. FLTK’s binaries are statically linked and SMALL. Some have previously said FLTK is ugly but I’m sure they haven’t seen the latest plastic theme. Take a look.http://fltk.org/images/fltk-widgets-plastic.pngPlus it’s so easy to code OOP style gui’s that I’ve written a tutorial http://fltk.org/links.php?V19 and I’m not an expert.BTW I use XFCE as my DE. 2005-03-03 7:58 am fltk is a good toolkit if you are planning to writea hello_word application.Try to use it to handle a full threaded socket based x11 compliant application, and all the fltk magic will disappear asap.dave 2005-03-03 8:43 am Stroustrup told me that he will write an application in C++ and than after that he will consider which GUI toolkit to use, and than do a very basic GUI. He has used QT in the past and said that it was a good library, but than again the GUI interface is the last thing on his mind when he writes software. We should be able to write software that is mostly GUI independant, not in the sense of write once run everywhere, but that the GUI code should be isolated and interchangable. 2005-03-03 9:19 am Everybody knows that you write methods and functions thisWay(), Pascal notation is ForClassesOnly(). Underscores are_for_variables, and dot get me started on CONSTANTS. 2005-03-03 9:55 am One of the greatest problems with gcc/c++ has to be the ever changing ABI (If i have understood it correctly). 2005-03-03 10:30 am Did they have to ruin one of the few lightweight yet ratherfeatureful desktops for *nix.🙁 2005-03-03 11:04 am Dude, they are NOT going to rewrite anything in C++. XFC is there to make it possible to write apps for XFCE in C++ and in C. XFCE won’t include apps in the base distribution anyway, so why worry? 2005-03-03 11:12 am I have to say this is an incredibly impressive toolkit. Apparently it was based on Havoc Pennington’s old Inti project, which I thought had died out.What’s really impressive, though, is the incredible volume of clear, in-depth documentation. I could see this becoming very popular in the near future.With regard to language wars, C is a better designed language than C++, however proper inheritance and OOP make large application design easier, which gives the edge to C++. The trick is to adopt a programming style which avoids the nasty pitfalls C++ has on offer. This library seems to do just that. 2005-03-03 11:45 am Why should a C++ app be heavyweight ?IMHO, I think it’s good to have a C++ binding for XFCE. Developers who prefer C can still use C.More choices => more apps (I hope) 2005-03-03 1:27 pm Does the string class play nicely with STL? The two big downchecks for Qt for me are the MOC and the non-use of the standard library (at least in earlier versions).I grasp that Qt predates the C++ standard, and is to be commended for being ahead of its time. I’m just arguing that learning non-standard things is a distraction. 2005-03-03 3:33 pm gtkmm and wxGTK already exist. What is the point of creating yet another GTK based of C++ classes? Why not cooperate with an existing project? 2005-03-03 3:35 pm GTK-based set of C++ classes I wanted to say. 2005-03-03 3:44 pm It’s not a duplicated effort. C++ is a complex multi-paradigm language and there are many ways of programming in it.GTKMM uses the STL style of OOP programming. XFC uses the Java style of OOP programming. The latter is by far the most popular and is arguably easier to program in.Futher wxWidgets is a COMPLETELY different library which just happens to bind to GTK+ (it can also bind to Motif). It does not allow you to perform Glib style programming, XFC does.This is not a duplicated effort. It is in fact quite promising. Speaking as a Qt and Java fan, I can tell you that this API is quite similar in style and scope. It’s equivalent to Mono in terms making GUI programming easy. 2005-03-03 3:50 pm Thanks Bryan.It did clarify some things. I really like XFCE (and use it daily) and wish them the best both in their desktop environment effort and with the XFC. 2005-03-04 8:40 am “XFCE will not suceed where gnome doesn’t for 1 reason. it is building on all the gnome architecture which is moving more and more into gtk and its dependancies. without gnome driving gtk xfce wouldn’t have anything to work from.”Please, if you are going to make ill-informed comments like this at least include your name Mr. Anonymous, so we can all laugh at you.Xfce does not use the GNOME architecture, it uses the GTK+ architecture only! 2005-03-04 2:17 pm They’re just introducing C++ bindings now?*sigh*Writing GUI code in C is flat-out braindead.Finding out that XFCE was written in C made me lose a massive amount of respect for the developers. The use of C is one of the many reasons I despise GNOME, and I had previously considered XFCE to be a more tolerable alternative to GNOME.