LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-21-2012, 02:46 PM   #1
DJ Shaji
Member
 
Registered: Dec 2004
Location: Yo Momma's house
Distribution: Fedora Rawhide, ArchLinux
Posts: 518
Blog Entries: 15

Rep: Reputation: 106Reputation: 106
Question Writing a new program: gtk2 or gtk3 ?


I'm going to start work on a new program, and I'm just wondering, should I use gtk+-2.0 or gtk+-3.0? I've worked with gtk2 before, but 3 is pretty much the same, only better ( so it seems to be to me, with things like running applications talking to each other ).

Here's what I think:
  • gtk2 would be unmaintained (soon).
  • but users would probably have gtk2 already installed (and maybe not 3)
  • however gtk3 would have newer features
  • still, gtk2 and gtk3 can be installed side by side, so even if a user doesn't have 3, they can install it easily without any issues

So, what do you think? In my opinion, gtk3 is the way to go. I'd like to hear some comments, though. What do you use?

I use native C, if that's relevant. I'd use Vala, but I'm going to use other C libraries too, so it's best to keep it simple, right?
 
Old 06-22-2012, 10:39 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Simple is (almost) always better, methinks.

You're right that most of the world is GTK+2 rather than 3 (today, anyway), and it might be better to go for 2... with embedded 3 while you're at it? An #ifdef or two might not be a bad idea.

There's a GNOME paper worth a look-see at http://developer.gnome.org/gtk3/3.5/...ng-2-to-3.html. Might find that useful.

Hope this helps some.
 
1 members found this post helpful.
Old 06-23-2012, 09:28 AM   #3
DJ Shaji
Member
 
Registered: Dec 2004
Location: Yo Momma's house
Distribution: Fedora Rawhide, ArchLinux
Posts: 518

Original Poster
Blog Entries: 15

Rep: Reputation: 106Reputation: 106
Quote:
Originally Posted by tronayne View Post
Simple is (almost) always better, methinks.

You're right that most of the world is GTK+2 rather than 3 (today, anyway), and it might be better to go for 2... with embedded 3 while you're at it? An #ifdef or two might not be a bad idea.

There's a GNOME paper worth a look-see at http://developer.gnome.org/gtk3/3.5/...ng-2-to-3.html. Might find that useful.

Hope this helps some.
I've read it, actually, and I think most changes in gtk3 are very welcome additions. I do really want to use gtk3, but the thing is that most people including me have gtk2 installed as the default toolkit, meaning that gtk2 applications will use themes and icons as per their default set up, and will blend in perfectly.

While I was initially leaning towards gtk3 at first, I think you're right: simple is the way to go. People still have (atleast easy access to) gtk1, so I think gtk2 will still stick around for quite a while.

I think the best thing to do is to keep the UI code separate from the core application and if a time comes when I have to switch from gtk2 to gtk3 (or something else entirely, maybe), it'll just be easier to do.
 
Old 06-23-2012, 09:53 AM   #4
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 647

Rep: Reputation: 189Reputation: 189
Quote:
Originally Posted by DJ Shaji View Post
I think the best thing to do is to keep the UI code separate from the core application and if a time comes when I have to switch from gtk2 to gtk3 (or something else entirely, maybe), it'll just be easier to do.
Well, this would be the way to go in every non-trivial application
 
Old 06-24-2012, 08:36 AM   #5
DJ Shaji
Member
 
Registered: Dec 2004
Location: Yo Momma's house
Distribution: Fedora Rawhide, ArchLinux
Posts: 518

Original Poster
Blog Entries: 15

Rep: Reputation: 106Reputation: 106
Quote:
Originally Posted by 414N View Post
Well, this would be the way to go in every non-trivial application
Yep, I agree. Initially, when I started coding, my aim was to get it to compile, using the shortest route possible. My first program was a hack of the GtkIconView tutorial into a file manager. Initially I just wanted to make it work, and so it turned out that everything was #included in main.c and a global GtkWindow* was used everywhere. But when it grew (e.g a xine media player was embedded, it had its own device management system) it became simply unmanageable. Ultimately it got to the point where the code was 13000+ lines all compiled at the same time, so that every time I changed it even a tiniest bit, it took over a minute to compile. Then I found out that to open a second window, a whole new instance had to be run. Then I decided that the thing had to be completely rewritten, which I tried to do for a while but then just gave up.

Now, for one, I've learnt the importance of system design. For example, this project would have a plugin architecture, so I'm going to try to keep the public and private api separate, keep the application core as generic as possible and let the individual modules do the rest. Plus, since most open source libraries are now cross platform, I'll try to keep the code cross compilable as well. I'm thinking that maybe I should write the basic structure of the program first, and then put it on sourceforge. Hopefully I will find some more help there.
 
  


Reply

Tags
comparison, gtk2, gtk3, programming



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
writing a program snoppy920 Red Hat 2 05-18-2012 09:49 AM
LXer: Build Spice-Gtk-0.6 (GTK2 & GTK3) on Ubuntu 11.10 (Oneiric) LXer Syndicated Linux News 0 06-28-2011 11:51 AM
Increase Font size in GTK2 C program arnie001 Programming 5 07-19-2010 05:18 AM
CD Writing program? Which is best? nro Linux - Software 14 09-01-2004 10:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration