HildonSortDialog

HildonSortDialog — A widget for defining the sorting order of items.

Synopsis

                    HildonSortDialog;
GtkWidget*          hildon_sort_dialog_new              (GtkWindow *parent);
gint                hildon_sort_dialog_get_sort_key     (HildonSortDialog *dialog);
GtkSortType         hildon_sort_dialog_get_sort_order   (HildonSortDialog *dialog);
void                hildon_sort_dialog_set_sort_key     (HildonSortDialog *dialog,
                                                         int key);
void                hildon_sort_dialog_set_sort_order   (HildonSortDialog *dialog,
                                                         GtkSortType order);
gint                hildon_sort_dialog_add_sort_key     (HildonSortDialog *dialog,
                                                         const gchar *sort_key);
gint                hildon_sort_dialog_add_sort_key_reversed
                                                        (HildonSortDialog *dialog,
                                                         const gchar *sort_key);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkContainer
                           +----GtkBin
                                 +----GtkWindow
                                       +----GtkDialog
                                             +----HildonSortDialog

Implemented Interfaces

HildonSortDialog implements AtkImplementorIface and GtkBuildable.

Properties

  "sort-key"                 gint                  : Read / Write
  "sort-order"               GtkSortType           : Read / Write

Description

HildonSortDialog is used to define an order (ascending/descending) and a field by which items are sorted in a list. The combo boxes display the current value when the dialog is opened.

Example 25. An example for using HildonSortDialog

HildonSortDialog *sort_dialog = HILDON_SORT_DIALOG (hildon_sort_dialog_new (parent));

gint response_id, add_sort_index;

sort_by[0] = STR_SORT_BY_DATE;
sort_by[1] = STR_SORT_BY_NAME;
sort_by[2] = STR_SORT_BY_SIZE;
sort_by[3] = NULL;

sorting_order[0] = STR_SORTING_ORDER_ASCENDING;
sorting_order[1] = STR_SORTING_ORDER_DESCENDING;
sorting_order[2] = NULL;

add_sort_index = hildon_sort_dialog_add_sort_key (sort_dialog, STR_SORT_BY_DATE);

hildon_sort_dialog_add_sort_key (sort_dialog, STR_SORT_BY_NAME);

hildon_sort_dialog_add_sort_key (sort_dialog, STR_SORT_BY_SIZE);

if (dialog.first_time_clicked == TRUE)
{
	hildon_sort_dialog_set_sort_key (sort_dialog, add_sort_index);
}

if (dialog.first_time_clicked == FALSE)
{
	hildon_sort_dialog_set_sort_key (sort_dialog, dialog.sort_key);
	hildon_sort_dialog_set_sort_order (sort_dialog, dialog.sort_order);
}

gtk_widget_show (GTK_WIDGET (sort_dialog));

response_id = gtk_dialog_run (GTK_DIALOG (sort_dialog));

if (response_id == GTK_RESPONSE_OK)
{
	dialog.sort_key = hildon_sort_dialog_get_sort_key (sort_dialog);

	gtk_label_set_text (GTK_LABEL (dialog.label1), sort_by [dialog.sort_key]);

	dialog.sort_order = hildon_sort_dialog_get_sort_order (sort_dialog);

	gtk_label_set_text (GTK_LABEL (dialog.label2), sorting_order [dialog.sort_order]);

	dialog.first_time_clicked = FALSE;
}


Details

HildonSortDialog

typedef struct _HildonSortDialog HildonSortDialog;

Warning

HildonSortDialog is deprecated and should not be used in newly-written code.


hildon_sort_dialog_new ()

GtkWidget*          hildon_sort_dialog_new              (GtkWindow *parent);

Warning

hildon_sort_dialog_new is deprecated and should not be used in newly-written code.

HildonSortDialog contains two HildonCaptions with combo boxes.

parent : widget to be transient for, or NULL if none
Returns : pointer to a new HildonSortDialog widget

hildon_sort_dialog_get_sort_key ()

gint                hildon_sort_dialog_get_sort_key     (HildonSortDialog *dialog);

Warning

hildon_sort_dialog_get_sort_key is deprecated and should not be used in newly-written code.

Gets index to currently active sort key.

dialog : the HildonSortDialog widget
Returns : an integer which is the index value of the "Sort by" field

hildon_sort_dialog_get_sort_order ()

GtkSortType         hildon_sort_dialog_get_sort_order   (HildonSortDialog *dialog);

Warning

hildon_sort_dialog_get_sort_order is deprecated and should not be used in newly-written code.

Gets current sorting order from "Sort order" field.

dialog : the HildonSortDialog widget
Returns : current sorting order as GtkSortType

hildon_sort_dialog_set_sort_key ()

void                hildon_sort_dialog_set_sort_key     (HildonSortDialog *dialog,
                                                         int key);

Warning

hildon_sort_dialog_set_sort_key is deprecated and should not be used in newly-written code.

Sets the index value of the HildonSortDialog widget.

dialog : the HildonSortDialog widget
key : combo box's index value

hildon_sort_dialog_set_sort_order ()

void                hildon_sort_dialog_set_sort_order   (HildonSortDialog *dialog,
                                                         GtkSortType order);

Warning

hildon_sort_dialog_set_sort_order is deprecated and should not be used in newly-written code.

Sets the index value of the HildonSortDialog widget.

dialog : the HildonSortDialog widget
order : combo box's index value

hildon_sort_dialog_add_sort_key ()

gint                hildon_sort_dialog_add_sort_key     (HildonSortDialog *dialog,
                                                         const gchar *sort_key);

Warning

hildon_sort_dialog_add_sort_key is deprecated and should not be used in newly-written code.

Adds a new sort key and returns the respective index in sort key combobox.

dialog : the HildonSortDialog widget
sort_key : combo box's index value
Returns : an integer which is the index of the added combo box's item

hildon_sort_dialog_add_sort_key_reversed ()

gint                hildon_sort_dialog_add_sort_key_reversed
                                                        (HildonSortDialog *dialog,
                                                         const gchar *sort_key);

Warning

hildon_sort_dialog_add_sort_key_reversed is deprecated and should not be used in newly-written code.

Adds a new sort key and returns the respective index in sort key combobox. The default sort order for this key is reversed (Descending first).

dialog : the HildonSortDialog widget
sort_key : combo box's index value
Returns : an integer which is the index of the added combo box's item

Property Details

The "sort-key" property

  "sort-key"                 gint                  : Read / Write

The currently active sort key.

Default value: 0


The "sort-order" property

  "sort-order"               GtkSortType           : Read / Write

The sort order for the currently active sort key.

Default value: GTK_SORT_ASCENDING