+ va_start (args, first_response_id);
+
+ gtk_dialog_set_alternative_button_order_valist (dialog,
+ first_response_id,
+ args);
+ va_end (args);
+}
+/**
+ * gtk_dialog_set_alternative_button_order_from_array:
+ * @dialog: a #GtkDialog
+ * @n_params: the number of response ids in @new_order
+ * @new_order: an array of response ids of @dialog's buttons
+ *
+ * Sets an alternative button order. If the
+ * #GtkSettings:gtk-alternative-button-order setting is set to %TRUE,
+ * the dialog buttons are reordered according to the order of the
+ * response ids in @new_order.
+ *
+ * See gtk_dialog_set_alternative_button_order() for more information.
+ *
+ * This function is for use by language bindings.
+ *
+ * Since: 2.6
+ */
+void
+gtk_dialog_set_alternative_button_order_from_array (GtkDialog *dialog,
+ gint n_params,
+ gint *new_order)
+{
+ GdkScreen *screen;
+ GtkWidget *child;
+ gint position;
+
+ g_return_if_fail (GTK_IS_DIALOG (dialog));
+ g_return_if_fail (new_order != NULL);
+
+ screen = gtk_widget_get_screen (GTK_WIDGET (dialog));
+ if (!gtk_alternative_dialog_button_order (screen))
+ return;
+
+ for (position = 0; position < n_params; position++)
+ {
+ /* reorder child with response_id to position */
+ child = dialog_find_button (dialog, new_order[position]);
+ gtk_box_reorder_child (GTK_BOX (dialog->action_area), child, position);
+ }
+}
+
+typedef struct {
+ gchar *widget_name;
+ gchar *response_id;
+} ActionWidgetInfo;
+
+typedef struct {
+ GtkDialog *dialog;
+ GtkBuilder *builder;
+ GSList *items;
+ gchar *response;
+} ActionWidgetsSubParserData;
+
+static void
+attributes_start_element (GMarkupParseContext *context,
+ const gchar *element_name,
+ const gchar **names,
+ const gchar **values,
+ gpointer user_data,
+ GError **error)
+{
+ ActionWidgetsSubParserData *parser_data = (ActionWidgetsSubParserData*)user_data;
+ guint i;
+
+ if (strcmp (element_name, "action-widget") == 0)
+ for (i = 0; names[i]; i++)
+ if (strcmp (names[i], "response") == 0)
+ parser_data->response = g_strdup (values[i]);
+ else if (strcmp (element_name, "action-widgets") == 0)
+ return;
+ else
+ g_warning ("Unsupported tag for GtkDialog: %s\n", element_name);
+}
+
+static void
+attributes_text_element (GMarkupParseContext *context,
+ const gchar *text,
+ gsize text_len,
+ gpointer user_data,
+ GError **error)
+{
+ ActionWidgetsSubParserData *parser_data = (ActionWidgetsSubParserData*)user_data;
+ ActionWidgetInfo *item;
+
+ if (!parser_data->response)
+ return;
+
+ item = g_new (ActionWidgetInfo, 1);
+ item->widget_name = g_strndup (text, text_len);
+ item->response_id = parser_data->response;
+ parser_data->items = g_slist_prepend (parser_data->items, item);
+ parser_data->response = NULL;
+}
+
+static const GMarkupParser attributes_parser =
+ {
+ attributes_start_element,
+ NULL,
+ attributes_text_element,
+ };
+
+gboolean
+gtk_dialog_buildable_custom_tag_start (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *tagname,
+ GMarkupParser *parser,
+ gpointer *data)
+{
+ ActionWidgetsSubParserData *parser_data;
+
+ if (child)
+ return FALSE;
+
+ if (strcmp (tagname, "action-widgets") == 0)
+ {
+ parser_data = g_slice_new0 (ActionWidgetsSubParserData);
+ parser_data->dialog = GTK_DIALOG (buildable);
+ parser_data->items = NULL;
+
+ *parser = attributes_parser;
+ *data = parser_data;
+ return TRUE;
+ }
+
+ return parent_buildable_iface->custom_tag_start (buildable, builder, child,
+ tagname, parser, data);
+}
+
+static void
+gtk_dialog_buildable_custom_finished (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *tagname,
+ gpointer user_data)
+{
+ GSList *l;
+ ActionWidgetsSubParserData *parser_data;
+ GObject *object;
+ GtkDialog *dialog;
+ ResponseData *ad;
+ guint signal_id;
+
+ if (strcmp (tagname, "action-widgets"))
+ {
+ parent_buildable_iface->custom_finished (buildable, builder, child,
+ tagname, user_data);
+ return;
+ }
+
+ dialog = GTK_DIALOG (buildable);
+ parser_data = (ActionWidgetsSubParserData*)user_data;
+ parser_data->items = g_slist_reverse (parser_data->items);
+
+ for (l = parser_data->items; l; l = l->next)
+ {
+ ActionWidgetInfo *item = l->data;
+
+ object = gtk_builder_get_object (builder, item->widget_name);
+ if (!object)
+ {
+ g_warning ("Unknown object %s specified in action-widgets of %s",
+ item->widget_name,
+ gtk_buildable_get_name (GTK_BUILDABLE (buildable)));
+ continue;
+ }
+
+ ad = get_response_data (GTK_WIDGET (object), TRUE);
+ ad->response_id = atoi (item->response_id);
+
+ if (GTK_IS_BUTTON (object))
+ signal_id = g_signal_lookup ("clicked", GTK_TYPE_BUTTON);
+ else
+ signal_id = GTK_WIDGET_GET_CLASS (object)->activate_signal;
+
+ if (signal_id)
+ {
+ GClosure *closure;
+
+ closure = g_cclosure_new_object (G_CALLBACK (action_widget_activated),
+ G_OBJECT (dialog));
+ g_signal_connect_closure_by_id (object,
+ signal_id,
+ 0,
+ closure,
+ FALSE);
+ }
+
+ if (ad->response_id == GTK_RESPONSE_HELP)
+ gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (dialog->action_area),
+ GTK_WIDGET (object), TRUE);
+
+ g_free (item->widget_name);
+ g_free (item->response_id);
+ g_free (item);
+ }
+ g_slist_free (parser_data->items);
+ g_slice_free (ActionWidgetsSubParserData, parser_data);
+}
+
+/**
+ * gtk_dialog_get_action_area:
+ * @dialog: a #GtkDialog
+ *
+ * Returns the action area of @dialog.
+ *
+ * Returns: a #GtkHButtonBox.
+ *
+ * Since: GSEAL-branch
+ **/
+GtkHButtonBox *
+gtk_dialog_get_action_area (GtkDialog *dialog)
+{
+ g_return_val_if_fail (GTK_IS_DIALOG (dialog), NULL);
+
+ return dialog->action_area;
+}
+
+/**
+ * gtk_dialog_pack_start:
+ * @dialog: a #GtkDialog
+ * @widget: #GtkWidget to be added to @dialog.
+ * @expand: %TRUE if @widget should take all extra space.
+ * @fill: %TRUE if all space given should be used by @widget
+ * @padding: extra pixels to put between @widget and its neighbors
+ *
+ * This function similar to gtk_box_pack_start() packs @widget
+ * with reference to the start of @dialog.
+ *
+ * Since: GSEAL-branch
+ **/
+void
+gtk_dialog_pack_start (GtkDialog *dialog,
+ GtkWidget *widget,
+ gboolean expand,
+ gboolean fill,
+ guint padding)
+{
+ g_return_if_fail (GTK_IS_DIALOG (dialog));
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ gtk_box_pack_start (GTK_BOX (dialog->vbox),
+ widget, expand, fill, padding);
+}
+
+/**
+ * gtk_dialog_pack_end:
+ * @dialog: a #GtkDialog
+ * @widget: #GtkWidget to be added to @dialog.
+ * @expand: %TRUE if @widget should take all extra space.
+ * @fill: %TRUE if all space given should be used by @widget
+ * @padding: extra pixels to put between @widget and its neighbors
+ *
+ * This function similar to gtk_box_pack_end() packs @widget
+ * with reference to the end of @dialog.
+ *
+ * Since: GSEAL-branch
+ **/
+void
+gtk_dialog_pack_end (GtkDialog *dialog,
+ GtkWidget *widget,
+ gboolean expand,
+ gboolean fill,
+ guint padding)
+{
+ g_return_if_fail (GTK_IS_DIALOG (dialog));
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ gtk_box_pack_end (GTK_BOX (dialog->vbox),
+ widget, expand, fill, padding);
+}