[maemo-developers] [maemo-developers] hildon wizard dialog

From: Laszlo T. tlacix at gmail.com
Date: Fri Aug 25 00:59:48 EEST 2006

The wizard does not work without gtk_widget_show_all.
I quickly wrote a program for demonstrate this problem.


CFLAGS=`pkg-config --cflags --libs hildon-libs gtk+-2.0`
    $(CC) wizard.c -o wizard $(CFLAGS) $(LDFLAGS)


#include <hildon-widgets/hildon-wizard-dialog.h>
#include <hildon-widgets/hildon-program.h>
#include <gtk/gtk.h>

void on_button_clicked(GtkButton *button,
        HildonWindow *window)
  GtkWidget *notebook1;
  GtkWidget *label4;
  GtkWidget *label1;
  GtkWidget *label5;
  GtkWidget *label2;
  notebook1 = gtk_notebook_new ();
  gtk_widget_show (notebook1);

  label4 = gtk_label_new ("first page");
  gtk_widget_show (label4);
  gtk_container_add (GTK_CONTAINER (notebook1), label4);

  label1 = gtk_label_new ("label1");
  gtk_widget_show (label1);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1),
      gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label1);

  label5 = gtk_label_new ("second page");
  gtk_widget_show (label5);
  gtk_container_add (GTK_CONTAINER (notebook1), label5);

  label2 = gtk_label_new ("label2");
  gtk_widget_show (label2);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1),
      gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label2);

  HildonWizardDialog *wizard = HILDON_WIZARD_DIALOG(
    hildon_wizard_dialog_new( GTK_WINDOW(window),
    "wizard", GTK_NOTEBOOK(notebook1) ) );

//  gtk_widget_show_all( GTK_WIDGET(wizard) );
  gtk_dialog_run( GTK_DIALOG(wizard) );
  gtk_widget_destroy( GTK_WIDGET(wizard) );

int main(int argc, char *argv[])
    /* Create needed variables */
    HildonProgram *program;
    HildonWindow *window;
    GtkWidget *button;

    /* Initialize the GTK. */
    gtk_init(&argc, &argv);

    /* Create the hildon program and setup the title */
    program = HILDON_PROGRAM(hildon_program_get_instance());
    g_set_application_name("Hello maemo!");

    /* Create HildonWindow and set it to HildonProgram */
    window = HILDON_WINDOW(hildon_window_new());
    hildon_program_add_window(program, window);

    /* Create button and add it to main view */
    button = gtk_button_new_with_label("wizard");
    gtk_container_add(GTK_CONTAINER(window), button);

    g_signal_connect(G_OBJECT(button), "clicked",
      G_CALLBACK(on_button_clicked), window);

    /* Connect signal to X in the upper corner */
    g_signal_connect(G_OBJECT(window), "delete_event",
      G_CALLBACK(gtk_main_quit), NULL);

    /* Begin the main application */

    /* Exit */
    return 0;

"Why do you want to change it programmatically?"

For example there is a problem in the second page (for example a device is
not connectable) and I want go to first page (to again inform the user how
can activate the device).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maemo.org/pipermail/maemo-developers/attachments/20060824/729557c9/attachment.htm 
More information about the maemo-developers mailing list