Fedora Linux Support Community & Resources Center
Old 15th April 2011, 12:21 AM
silllykone Offline
Registered User
Join Date: Mar 2011
Posts: 11
Should I split up Gtk+ code?

I'm starting to do Gtk+ programming. One thing I find when doing a project is that my main() method (I'm using C++) is getting really bogged down--not necessarily with running time, but with code. Would it be good practice to set up the code in different functions like this:
*GtkWidget addMenubar()
// Create a menubar and return a pointer.

*GtkWidget addTextfield()
//Create a text field and return a pointer
int main()
  GtkWidget *menubar = addMenubar();
  GtkWidget *textField = addTextfield();
  //...Do some other stuff...
  // Add all the elements to the window and show.
Or would it not even be worth it?
Reply With Quote
Old 15th April 2011, 08:59 AM
giulix Offline
Join Date: Oct 2005
Location: CE(S)T
Posts: 3,242
Re: Should I split up Gtk+ code?

For OO languages, it is common practice to organize files by class, grouping classes that have a common purpose in namespaces (packages in Java). Your current approach looks as if you're planning to use standard GTK+ libs and a procedural approach. Look into gtkmm instead: That will guide you towards a more object-oriented approach...
Asus K55VD, i5 3230M - Productivity/Programming (F24)
Asus M32CD - i7-6700, Asus STRIX-GTX970-DC2OC-4GD, 1x8 GB Sk Hynix 2133 MHz DDR4 - Gaming (W10)
HP Proliant DL 360 G5 - Heavy lifting (CentOS 7.2)
Reply With Quote

code, gtk, split

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
zip and split cgourdet Programming & Packaging 1 11th December 2009 08:01 PM
how to split .zip file thisObject Using Fedora 4 12th May 2007 06:06 AM
Need to split Jongi Servers & Networking 0 3rd April 2007 09:40 PM
How to split files? tonytiger Using Fedora 5 29th May 2005 10:14 AM

Current GMT-time: 17:37 (Thursday, 21-09-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat