Part 7a

User Data

Creating the Glade

  1. Start a new Glade project and add a Toplevel Window and a Table with two rows and two columns. In the top row add a Button to each cell and in the bottom left cell add a Label.

    Your project should look like this now.

    images/glade-07-01.png
  2. Change the button labels to 1 and 2 and blank the label. Next change the Packing Right Attachment to 2. Change window1 Common, Width request to 200 and save the file.

    Your project should look like this now.

    images/glade-07-02.png
  3. Now add the on_button_clicked Handler to each button. Add button1 to the User Data for button1 and button2 to the user data for button2. Make sure you did not use 'on_button1_clicked or on_button2_clicked for the handler. Both buttons will use the same handler but pass different User Data to the function.

    Your project should look like this now.

    images/glade-07-03.png
  4. Now add the on_window1_destroy Handler to window1 GtkObject destroy signal and don’t forget to press the enter key so it is saved.

    Your project should look like this now.

    images/glade-07-04.png

Save the project as glade7.glade and we are done with the glade part.