Friday, May 25, 2012

Starting dev on ubuntu 12.04 LTS : GTK (part 01)

After few reading and googling I choose to use glade and GTK (see http://glade.gnome.org/  and http://www.gtk.org)

Before starting I do some installations :
apt-get install  glade

apt-get install gnome-core-devel build-essential


And I start with the tutorial.. (http://developer.gnome.org/gtk-tutorial/stable/c39.html)

and then I start building my own GUI :


After few reading I saw that there is a GTK+ 3 ... Then I install it :
sudo apt-get install libgtk-3-0 libgtk-3-0-dbg libgtk-3-bin libgtk-3-common libgtk-3-dev libgtk-3-doc


To see the version and the includes path use (more explanation could be found at : http://www.micahcarrick.com/gtk-glade-tutorial-part-3.html)
pkg-config --modversion gtk+-2.0

pkg-config --cflags gtk+-3.0

Now I want to run my app... so i need to
  • write a "launcher" (I chose to write it in C)
  • compile
The launcher :

#include <gtk/gtk.h>

void 
on_window_destroy (GObject *object, gpointer user_data)
{
        gtk_main_quit();
}

int
main (int argc, char *argv[])
{
        GtkBuilder              *builder;
        GtkWidget               *window;
        
        gtk_init (&argc, &argv);
        
        builder = gtk_builder_new ();
        gtk_builder_add_from_file (builder, "test.xml", NULL);

        window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
        gtk_builder_connect_signals (builder, NULL);          
        g_object_unref (G_OBJECT (builder));
        
        gtk_widget_show (window);       
        gtk_main ();
        
        return 0;
}

To  compile :

gcc -Wall -g -o testProg main.c -export-dynamic `pkg-config --cflags --libs gtk+-3.0`


The first running does not work...I have to 
  • change from GtkGrid to GtkTable
  • change from to 
  • change from to
  • change values attach to right_attach and bottom_attach
  • change from GtkPaned to GtkHPaned
At the end I saw :


Ok, I have something but it's not exactly what I want... 


Materials
  • gcc proxypass.c -o proxypass `pkg-config --cflags --libs gtk+-2.0`
  • http://www.micahcarrick.com/gtk-glade-tutorial-part-3.html
  • http://www.micahcarrick.com/gtk-glade-tutorial-part-1.html
  • http://www.gtk.org/documentation.php
  • sudo apt-get install libgtk2.0-dev sudo apt-get install libgtk2.0-doc devhelp

No comments:

Post a Comment