Find the answer to your Linux question:
Results 1 to 2 of 2
Hey I have a load of C code that I want to build front ends for. I started mucking around with glade and it seems like it will do what ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2006
    Posts
    42

    Glade and C, how?!!


    Hey

    I have a load of C code that I want to build front ends for. I started mucking around with glade and it seems like it will do what I want it to. I can bring boxes up with buttons and stuff on but this is about the point where I get lost

    Soooo, When you build a glade application it makes a load of .c and .h files in a dirrectorry called src or something. If I add code to main.c (which it says to do), such as:-

    printf("hello\n");

    this works, but there is nothing in the main.c about any of the buttons etc, these are all in interface.c. I want to run functions when buttons are clicked, how will I go about doing this?

    cheers

    Joe

  2. #2
    Just Joined!
    Join Date
    Mar 2006
    Posts
    13
    I have a tutorial here: http://www.micahcarrick.com/v2/content/section/1/20/

    Basically, when you use Glade, you have 2 choices. 1 is to (as you have discovered) generate c code, namely main.c and callbacks.c/h. This C code uses the GTK+ libraries. So glade is esentially a "shortcut" to the GUI side of using the GTK+ libraries. The second way, which is the current "proper" (by proper I mean the convetion that is used and promoted by people in the "industry") is to use libglade. libglade is a C library which rather parses the XML file that Glade generates to build the interface from at run-time. The advantage being separation from GUI and the program as well as not having to worry about what glade generates. I prefer this method and find it very conveneint.

    The link I pasted above has a tutorial on libglade/C/GTK+, but additionally, there are a couple of dialog box examples which may help you see some VERY basic GTK+ window/button examples.

    Good luck,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •