forked from AuroraMiddleware/gtk
dialog: Remove alternative button order API
This commit is contained in:
parent
2acc31b46a
commit
3b336dda73
@ -1070,8 +1070,6 @@ gtk_dialog_get_content_area
|
||||
gtk_dialog_get_header_bar
|
||||
<SUBSECTION>
|
||||
gtk_alternative_dialog_button_order
|
||||
gtk_dialog_set_alternative_button_order
|
||||
gtk_dialog_set_alternative_button_order_from_array
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_DIALOG
|
||||
|
@ -203,12 +203,6 @@ gtk_color_selection_dialog_init (GtkColorSelectionDialog *colorseldiag)
|
||||
|
||||
gtk_widget_hide (priv->help_button);
|
||||
|
||||
gtk_dialog_set_alternative_button_order (dialog,
|
||||
GTK_RESPONSE_OK,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
GTK_RESPONSE_HELP,
|
||||
-1);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (colorseldiag),
|
||||
_("Color Selection"));
|
||||
}
|
||||
|
@ -1699,12 +1699,6 @@ gtk_font_selection_dialog_init (GtkFontSelectionDialog *fontseldiag)
|
||||
GTK_RESPONSE_OK);
|
||||
gtk_widget_grab_default (priv->ok_button);
|
||||
|
||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (fontseldiag),
|
||||
GTK_RESPONSE_OK,
|
||||
GTK_RESPONSE_APPLY,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
-1);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (fontseldiag),
|
||||
_("Font Selection"));
|
||||
|
||||
|
@ -713,13 +713,6 @@ gtk_app_chooser_dialog_init (GtkAppChooserDialog *self)
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
gtk_dialog_set_use_header_bar_from_setting (GTK_DIALOG (self));
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (self),
|
||||
GTK_RESPONSE_OK,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
-1);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
/* we can't override the class signal handler here, as it's a RUN_LAST;
|
||||
* we want our signal handler instead to be executed before any user code.
|
||||
*/
|
||||
|
@ -107,13 +107,6 @@ gtk_color_chooser_dialog_init (GtkColorChooserDialog *cc)
|
||||
gtk_widget_init_template (GTK_WIDGET (cc));
|
||||
gtk_dialog_set_use_header_bar_from_setting (GTK_DIALOG (cc));
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (cc),
|
||||
GTK_RESPONSE_OK,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
-1);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
g_signal_connect (cc, "response",
|
||||
G_CALLBACK (gtk_color_chooser_dialog_response), NULL);
|
||||
}
|
||||
|
215
gtk/gtkdialog.c
215
gtk/gtkdialog.c
@ -836,31 +836,6 @@ gtk_dialog_style_updated (GtkWidget *widget)
|
||||
update_spacings (GTK_DIALOG (widget));
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
dialog_find_button (GtkDialog *dialog,
|
||||
gint response_id)
|
||||
{
|
||||
GtkWidget *child = NULL;
|
||||
GList *children, *tmp_list;
|
||||
|
||||
children = get_action_children (dialog);
|
||||
|
||||
for (tmp_list = children; tmp_list; tmp_list = tmp_list->next)
|
||||
{
|
||||
ResponseData *rd = get_response_data (tmp_list->data, FALSE);
|
||||
|
||||
if (rd && rd->response_id == response_id)
|
||||
{
|
||||
child = tmp_list->data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dialog_close (GtkDialog *dialog)
|
||||
{
|
||||
@ -1066,17 +1041,6 @@ gtk_dialog_add_button (GtkDialog *dialog,
|
||||
button = gtk_button_new_with_label (button_text);
|
||||
gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
|
||||
if (button_text)
|
||||
{
|
||||
GtkStockItem item;
|
||||
if (gtk_stock_lookup (button_text, &item))
|
||||
g_object_set (button, "use-stock", TRUE, NULL);
|
||||
}
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "text-button");
|
||||
gtk_widget_set_can_default (button, TRUE);
|
||||
|
||||
@ -1487,185 +1451,6 @@ gtk_dialog_get_response_for_widget (GtkDialog *dialog,
|
||||
return rd->response_id;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_alt_dialog_button_order (void)
|
||||
{
|
||||
gboolean result;
|
||||
g_object_get (gtk_settings_get_default (),
|
||||
"gtk-alternative-button-order", &result, NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_alternative_dialog_button_order:
|
||||
* @screen: (allow-none): a #GdkScreen, or %NULL to use the default screen
|
||||
*
|
||||
* Returns %TRUE if dialogs are expected to use an alternative
|
||||
* button order on the screen @screen. See
|
||||
* gtk_dialog_set_alternative_button_order() for more details
|
||||
* about alternative button order.
|
||||
*
|
||||
* If you need to use this function, you should probably connect
|
||||
* to the ::notify:gtk-alternative-button-order signal on the
|
||||
* #GtkSettings object associated to @screen, in order to be
|
||||
* notified if the button order setting changes.
|
||||
*
|
||||
* Returns: Whether the alternative button order should be used
|
||||
*
|
||||
* Since: 2.6
|
||||
* Deprecated: 3.10: Deprecated
|
||||
*/
|
||||
gboolean
|
||||
gtk_alternative_dialog_button_order (GdkScreen *screen)
|
||||
{
|
||||
return gtk_alt_dialog_button_order ();
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dialog_set_alternative_button_order_valist (GtkDialog *dialog,
|
||||
gint first_response_id,
|
||||
va_list args)
|
||||
{
|
||||
GtkDialogPrivate *priv = dialog->priv;
|
||||
GtkWidget *child;
|
||||
gint response_id;
|
||||
gint position;
|
||||
|
||||
response_id = first_response_id;
|
||||
position = 0;
|
||||
while (response_id != -1)
|
||||
{
|
||||
/* reorder child with response_id to position */
|
||||
child = dialog_find_button (dialog, response_id);
|
||||
if (child != NULL)
|
||||
gtk_box_reorder_child (GTK_BOX (priv->action_area), child, position);
|
||||
else
|
||||
g_warning ("%s : no child button with response id %d.", G_STRFUNC,
|
||||
response_id);
|
||||
|
||||
response_id = va_arg (args, gint);
|
||||
position++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_dialog_set_alternative_button_order:
|
||||
* @dialog: a #GtkDialog
|
||||
* @first_response_id: a response id used by one @dialog’s buttons
|
||||
* @...: a list of more response ids of @dialog’s buttons, terminated by -1
|
||||
*
|
||||
* 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 passed to this function.
|
||||
*
|
||||
* By default, GTK+ dialogs use the button order advocated by the
|
||||
* [GNOME Human Interface Guidelines](http://library.gnome.org/devel/hig-book/stable/)
|
||||
* with the affirmative button at the far
|
||||
* right, and the cancel button left of it. But the builtin GTK+ dialogs
|
||||
* and #GtkMessageDialogs do provide an alternative button order,
|
||||
* which is more suitable on some platforms, e.g. Windows.
|
||||
*
|
||||
* Use this function after adding all the buttons to your dialog, as the
|
||||
* following example shows:
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
|
||||
* _("_Cancel"),
|
||||
* GTK_RESPONSE_CANCEL);
|
||||
*
|
||||
* ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
|
||||
* _("_OK"),
|
||||
* GTK_RESPONSE_OK);
|
||||
*
|
||||
* gtk_widget_grab_default (ok_button);
|
||||
*
|
||||
* help_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
|
||||
* _("_Help"),
|
||||
* GTK_RESPONSE_HELP);
|
||||
*
|
||||
* gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
||||
* GTK_RESPONSE_OK,
|
||||
* GTK_RESPONSE_CANCEL,
|
||||
* GTK_RESPONSE_HELP,
|
||||
* -1);
|
||||
* ]|
|
||||
*
|
||||
* Since: 2.6
|
||||
* Deprecated: 3.10: Deprecated
|
||||
*/
|
||||
void
|
||||
gtk_dialog_set_alternative_button_order (GtkDialog *dialog,
|
||||
gint first_response_id,
|
||||
...)
|
||||
{
|
||||
GtkDialogPrivate *priv = dialog->priv;
|
||||
va_list args;
|
||||
|
||||
g_return_if_fail (GTK_IS_DIALOG (dialog));
|
||||
|
||||
if (priv->constructed && priv->use_header_bar)
|
||||
return;
|
||||
|
||||
if (!gtk_alt_dialog_button_order ())
|
||||
return;
|
||||
|
||||
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: (array length=n_params): 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
|
||||
* Deprecated: 3.10: Deprecated
|
||||
*/
|
||||
void
|
||||
gtk_dialog_set_alternative_button_order_from_array (GtkDialog *dialog,
|
||||
gint n_params,
|
||||
gint *new_order)
|
||||
{
|
||||
GtkDialogPrivate *priv = dialog->priv;
|
||||
GtkWidget *child;
|
||||
gint position;
|
||||
|
||||
g_return_if_fail (GTK_IS_DIALOG (dialog));
|
||||
g_return_if_fail (new_order != NULL);
|
||||
|
||||
if (dialog->priv->use_header_bar)
|
||||
return;
|
||||
|
||||
if (!gtk_alt_dialog_button_order ())
|
||||
return;
|
||||
|
||||
for (position = 0; position < n_params; position++)
|
||||
{
|
||||
/* reorder child with response_id to position */
|
||||
child = dialog_find_button (dialog, new_order[position]);
|
||||
if (child != NULL)
|
||||
gtk_box_reorder_child (GTK_BOX (priv->action_area), child, position);
|
||||
else
|
||||
g_warning ("%s : no child button with response id %d.", G_STRFUNC,
|
||||
new_order[position]);
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
gchar *widget_name;
|
||||
gint response_id;
|
||||
|
@ -179,17 +179,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_dialog_get_response_for_widget (GtkDialog *dialog,
|
||||
GtkWidget *widget);
|
||||
|
||||
GDK_DEPRECATED_IN_3_10
|
||||
gboolean gtk_alternative_dialog_button_order (GdkScreen *screen);
|
||||
GDK_DEPRECATED_IN_3_10
|
||||
void gtk_dialog_set_alternative_button_order (GtkDialog *dialog,
|
||||
gint first_response_id,
|
||||
...);
|
||||
GDK_DEPRECATED_IN_3_10
|
||||
void gtk_dialog_set_alternative_button_order_from_array (GtkDialog *dialog,
|
||||
gint n_params,
|
||||
gint *new_order);
|
||||
|
||||
/* Emit response signal */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_dialog_response (GtkDialog *dialog,
|
||||
|
@ -516,13 +516,6 @@ gtk_file_chooser_native_init (GtkFileChooserNative *self)
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (self->dialog),
|
||||
GTK_RESPONSE_ACCEPT);
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (self->dialog),
|
||||
GTK_RESPONSE_ACCEPT,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
-1);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
/* We don't want to destroy on delete event, instead we hide in the response cb */
|
||||
g_signal_connect (self->dialog,
|
||||
"delete-event",
|
||||
|
@ -1478,12 +1478,6 @@ confirm_delete (GtkFileChooserWidget *impl,
|
||||
_("If you delete an item, it will be permanently lost."));
|
||||
gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Cancel"), GTK_RESPONSE_CANCEL);
|
||||
gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Delete"), GTK_RESPONSE_ACCEPT);
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
||||
GTK_RESPONSE_ACCEPT,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
-1);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||
|
||||
if (gtk_window_has_group (toplevel))
|
||||
@ -6374,12 +6368,6 @@ confirm_dialog_should_accept_filename (GtkFileChooserWidget *impl,
|
||||
|
||||
gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Cancel"), GTK_RESPONSE_CANCEL);
|
||||
add_custom_button_to_dialog (GTK_DIALOG (dialog), _("_Replace"), GTK_RESPONSE_ACCEPT);
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
||||
GTK_RESPONSE_ACCEPT,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
-1);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||
|
||||
if (gtk_window_has_group (toplevel))
|
||||
|
@ -152,13 +152,6 @@ gtk_font_chooser_dialog_init (GtkFontChooserDialog *fontchooserdiag)
|
||||
gtk_widget_init_template (GTK_WIDGET (fontchooserdiag));
|
||||
gtk_dialog_set_use_header_bar_from_setting (GTK_DIALOG (fontchooserdiag));
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (fontchooserdiag),
|
||||
GTK_RESPONSE_OK,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
-1);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
priv->select_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (fontchooserdiag), GTK_RESPONSE_OK);
|
||||
priv->cancel_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (fontchooserdiag), GTK_RESPONSE_CANCEL);
|
||||
|
||||
|
@ -935,7 +935,6 @@ gtk_message_dialog_add_buttons (GtkMessageDialog* message_dialog,
|
||||
{
|
||||
GtkDialog* dialog = GTK_DIALOG (message_dialog);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
switch (buttons)
|
||||
{
|
||||
case GTK_BUTTONS_NONE:
|
||||
@ -957,26 +956,17 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
case GTK_BUTTONS_YES_NO:
|
||||
gtk_dialog_add_button (dialog, _("_No"), GTK_RESPONSE_NO);
|
||||
gtk_dialog_add_button (dialog, _("_Yes"), GTK_RESPONSE_YES);
|
||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
||||
GTK_RESPONSE_YES,
|
||||
GTK_RESPONSE_NO,
|
||||
-1);
|
||||
break;
|
||||
|
||||
case GTK_BUTTONS_OK_CANCEL:
|
||||
gtk_dialog_add_button (dialog, _("_Cancel"), GTK_RESPONSE_CANCEL);
|
||||
gtk_dialog_add_button (dialog, _("_OK"), GTK_RESPONSE_OK);
|
||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
||||
GTK_RESPONSE_OK,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
-1);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_warning ("Unknown GtkButtonsType");
|
||||
break;
|
||||
}
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
g_object_notify (G_OBJECT (message_dialog), "buttons");
|
||||
}
|
||||
|
@ -547,12 +547,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
NULL);
|
||||
gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_dialog_set_alternative_button_order (dialog,
|
||||
GTK_RESPONSE_OK,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
-1);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
/* Build contents */
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
||||
|
@ -198,13 +198,6 @@ gtk_page_setup_unix_dialog_init (GtkPageSetupUnixDialog *dialog)
|
||||
NULL);
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
||||
GTK_RESPONSE_OK,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
-1);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
/* Do this in code, we want the translatable strings without the markup */
|
||||
gtk_list_store_append (priv->printer_list, &iter);
|
||||
tmp = g_strdup_printf ("<b>%s</b>\n%s", _("Any Printer"), _("For portable documents"));
|
||||
|
@ -675,12 +675,6 @@ error_dialogs (GtkPrintUnixDialog *print_dialog,
|
||||
gtk_dialog_add_button (GTK_DIALOG (dialog),
|
||||
_("_Replace"),
|
||||
GTK_RESPONSE_ACCEPT);
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
||||
GTK_RESPONSE_ACCEPT,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
-1);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog),
|
||||
GTK_RESPONSE_ACCEPT);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user