Time Widgets

Time Widgets — How to migrate Time Widgets

Migrating Time Widgets

A HildonTimeButton is the way to replace the time picker and time editor widgets (deprecated since Hildon version 2.2).

A time picker and time editor are shown in the examples bellow.

Example 39. A Typical Time Picker


GtkDialog *dialog = GTK_DIALOG (hildon_time_picker_new (NULL));

gtk_widget_show_all (GTK_WIDGET (dialog));
gtk_dialog_run (dialog);

        

Example 40. A Typical Time Editor


GtkDialog *dialog = GTK_DIALOG (gtk_dialog_new ());
HildonTimeEditor *time_editor = HILDON_TIME_EDITOR (hildon_time_editor_new ());

gtk_box_pack_start (GTK_BOX (dialog->vbox), GTK_WIDGET (time_editor), FALSE, FALSE, 0);
gtk_dialog_add_button (dialog, "Close", GTK_RESPONSE_CANCEL);

gtk_widget_show_all (GTK_WIDGET (dialog));
gtk_dialog_run (dialog);

        

The same functionality can be achieved as the following example shows.

Example 41. A Replacement for the Time Picker


GtkDialog *dialog = GTK_DIALOG (gtk_dialog_new ());
HildonTimeButton *time_button = HILDON_TIME_BUTTON (hildon_time_button_new (
            HILDON_SIZE_THUMB_HEIGHT, HILDON_BUTTON_ARRANGEMENT_VERTICAL));
gtk_box_pack_end (GTK_BOX (dialog->vbox), GTK_WIDGET (time_button), FALSE, FALSE, 0);
gtk_widget_show_all (GTK_WIDGET (dialog));
gtk_dialog_run (dialog);