×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    34

    Switching windows after giving delay in Maemo

    Hello,
    I am using g_usleep in my 1st window. And after specified time interval I want to display 2nd window.

    My code is as follows:

    HildonWindow *window;

    static gboolean main_quit_handler(GtkWidget *image)
    {
    GtkWidget *win;
    GtkWidget *vbox;

    GtkWidget *label;

    /* Create the main window */
    win = hildon_stackable_window_new();
    gtk_window_set_title(GTK_WINDOW (win), "Display image ");

    /* Setting a label in the new window */
    label = gtk_label_new("Hello");
    gtk_container_add(GTK_CONTAINER (win), label);

    g_usleep(500);
    gtk_container_remove(GTK_CONTAINER (window), image);

    gtk_widget_show_all(win);
    gtk_container_add(GTK_CONTAINER (window), label);
    gtk_widget_show_all ( GTK_WIDGET ( window ) );
    }

    int main
    {
    --------
    GtkWidget *image;
    gboolean value;

    image = gtk_image_new_from_file("my_file_path");
    gtk_container_add(GTK_CONTAINER (window), image);
    gtk_widget_show_all ( GTK_WIDGET ( window ) );

    gtk_quit_add(0, main_quit_handler, image);

    gtk_main();

    return 0;
    }

    When i run the code I am able to see only 1st window. 2nd window isnt visible.
    Any help please?

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Switching windows after giving delay in Maemo

    What you should do to achieve your goal:
    1. Connect callback to delete-event of the first window
    http://library.gnome.org/devel/gtk/2...t-delete-event
    2. In this callback add timeout callback with g_timeout_add
    http://library.gnome.org/devel/glib/...#g-timeout-add
    3. Do in this callback what you currently do in main_quit_handler except of using g_usleep.

Similar Threads

  1. Replies: 15
    Last Post: 2009-02-09, 17:20
  2. Bluesoleil Software
    By kencooper in forum Bluetooth Technology
    Replies: 9
    Last Post: 2008-08-29, 19:46
  3. Infrared socket connection between Symbian device and Windows
    By vespe in forum Symbian Networking & Messaging (Closed)
    Replies: 15
    Last Post: 2003-10-10, 16:50
  4. TCP socket connection between Symbian device and Windows
    By raghucp in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2003-09-15, 10:15

Posting Permissions

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