![]() |
![]() |
![]() |
Hildon Reference Manual | ![]() |
---|
Sort DialogsSort Dialogs — How to migrate Sort Dialogs |
HildonSortDialog is deprecated since Hildon 2.2. The correct way to let the user sort contents is with menu filters.
The following example shows a typical NumberEditor.
Example 44. A Typical Number Editor
GtkDialog *dialog = GTK_DIALOG (hildon_sort_dialog_new (NULL)); hildon_sort_dialog_add_sort_key (HILDON_SORT_DIALOG (dialog), "First key"); hildon_sort_dialog_add_sort_key_reversed (HILDON_SORT_DIALOG (dialog), "Second, key");
The functionality of the example above is shown on the example bellow using by validating the HildonPickerButton's value every time it's changed. The choices given in the HildonTouchSelectorShould be the most common choices.
Example 45. A Replacement for the Number Editor
GtkRadioButton *filter; GtkWidget *window = hildon_stackable_window_new (); gtk_window_set_title (GTK_WINDOW (window), "Sort Example"); HildonAppMenu *menu = HILDON_APP_MENU (hildon_app_menu_new ()); filter = GTK_RADIO_BUTTON (hildon_gtk_radio_button_new ( HILDON_SIZE_THUMB_HEIGHT, NULL)); gtk_button_set_label (GTK_BUTTON (filter), "1st Key"); hildon_app_menu_add_filter (menu, GTK_BUTTON (filter)); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (filter), FALSE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (filter), TRUE); filter = GTK_RADIO_BUTTON (hildon_gtk_radio_button_new_from_widget ( HILDON_SIZE_FINGER_HEIGHT, filter)); gtk_button_set_label (GTK_BUTTON (filter), "2nd Key"); hildon_app_menu_add_filter (menu, GTK_BUTTON (filter)); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (filter), FALSE); filter = GTK_RADIO_BUTTON (hildon_gtk_radio_button_new ( HILDON_SIZE_THUMB_HEIGHT, NULL)); gtk_button_set_label (GTK_BUTTON (filter), "A-Z"); hildon_app_menu_add_filter (menu, GTK_BUTTON (filter)); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (filter), FALSE); filter = GTK_RADIO_BUTTON (hildon_gtk_radio_button_new_from_widget ( HILDON_SIZE_FINGER_HEIGHT, filter)); gtk_button_set_label (GTK_BUTTON (filter), "Z-A"); hildon_app_menu_add_filter (menu, GTK_BUTTON (filter)); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (filter), FALSE); hildon_stackable_window_set_main_menu (HILDON_STACKABLE_WINDOW (window), menu);