+ GtkWidget *parent = gtk_widget_get_ancestor (GTK_WIDGET (priv->mode_button),
+ GTK_TYPE_WINDOW);
+ gtk_widget_hide (parent);
+
+ g_assert (priv->mode_dialog == NULL);
+ priv->mode_dialog = gtk_dialog_new ();
+ gtk_window_set_modal (GTK_WINDOW (priv->mode_dialog), TRUE);
+ gtk_window_set_title (GTK_WINDOW (priv->mode_dialog),
+ dgettext (GETTEXT_DOM, "Select display blanking mode"));
+
+ GtkWidget *pan_area = hildon_pannable_area_new ();
+ g_assert (pan_area != NULL);
+
+ GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
+ g_assert (vbox != NULL);
+
+ hildon_pannable_area_add_with_viewport (HILDON_PANNABLE_AREA (pan_area),
+ vbox);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (priv->mode_dialog)->vbox),
+ pan_area, TRUE, TRUE, 0);
+
+ g_object_set (G_OBJECT (pan_area), "height-request",
+ MIN (350, BLANKING_MODES * 70), NULL);
+
+ gint mode = BLANKING_MODES;
+ for (int i = 0; i < BLANKING_MODES; i++) {
+ GtkWidget *button =
+ hildon_button_new_with_text (HILDON_SIZE_FINGER_HEIGHT,
+ HILDON_BUTTON_ARRANGEMENT_VERTICAL,
+ _DisplayBlankingDescription[i], NULL);
+ GtkWidget *icon = gtk_image_new_from_icon_name (mode_icon_name[i],
+ GTK_ICON_SIZE_DIALOG);
+ hildon_button_set_image (HILDON_BUTTON (button), icon);
+ gtk_button_set_alignment (GTK_BUTTON (button), 0.0f, 0.5f);
+ gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (on_mode_dialog_button_clicked), priv->mode_dialog);
+ }
+
+ gtk_widget_show_all (priv->mode_dialog);
+
+ g_object_set_data (G_OBJECT (priv->mode_dialog), "mode", &mode);
+ gtk_dialog_run (GTK_DIALOG (priv->mode_dialog));
+
+ if (mode != BLANKING_MODES) {
+ // will trigger the gconf notify signal
+ GError *error = NULL;
+ gconf_client_set_int (priv->gconf_client, MODE_GCONF_KEY, mode, &error);
+ g_assert (error == NULL);
+ }
+
+ gtk_widget_destroy (priv->mode_dialog);
+ priv->mode_dialog = NULL;