mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-17 23:50:16 +00:00
message dialog: Allow action area to extend to the edge
https://bugzilla.gnome.org/show_bug.cgi?id=720059
This commit is contained in:
parent
38d8fdab80
commit
c42b39a9db
@ -32,6 +32,7 @@
|
|||||||
#include "gtkbuildable.h"
|
#include "gtkbuildable.h"
|
||||||
#include "gtklabel.h"
|
#include "gtklabel.h"
|
||||||
#include "gtkbox.h"
|
#include "gtkbox.h"
|
||||||
|
#include "gtkbbox.h"
|
||||||
#include "gtkimage.h"
|
#include "gtkimage.h"
|
||||||
#include "gtkintl.h"
|
#include "gtkintl.h"
|
||||||
#include "gtkprivate.h"
|
#include "gtkprivate.h"
|
||||||
@ -305,6 +306,7 @@ static void
|
|||||||
gtk_message_dialog_init (GtkMessageDialog *dialog)
|
gtk_message_dialog_init (GtkMessageDialog *dialog)
|
||||||
{
|
{
|
||||||
GtkMessageDialogPrivate *priv;
|
GtkMessageDialogPrivate *priv;
|
||||||
|
GtkWidget *action_area;
|
||||||
|
|
||||||
dialog->priv = gtk_message_dialog_get_instance_private (dialog);
|
dialog->priv = gtk_message_dialog_get_instance_private (dialog);
|
||||||
priv = dialog->priv;
|
priv = dialog->priv;
|
||||||
@ -316,6 +318,10 @@ gtk_message_dialog_init (GtkMessageDialog *dialog)
|
|||||||
|
|
||||||
gtk_widget_init_template (GTK_WIDGET (dialog));
|
gtk_widget_init_template (GTK_WIDGET (dialog));
|
||||||
gtk_message_dialog_style_updated (GTK_WIDGET (dialog));
|
gtk_message_dialog_style_updated (GTK_WIDGET (dialog));
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
|
action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
gtk_button_box_set_layout (GTK_BUTTON_BOX (action_area), GTK_BUTTONBOX_EXPAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -869,6 +875,7 @@ gtk_message_dialog_add_buttons (GtkMessageDialog* message_dialog,
|
|||||||
{
|
{
|
||||||
GtkDialog* dialog = GTK_DIALOG (message_dialog);
|
GtkDialog* dialog = GTK_DIALOG (message_dialog);
|
||||||
|
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
switch (buttons)
|
switch (buttons)
|
||||||
{
|
{
|
||||||
case GTK_BUTTONS_NONE:
|
case GTK_BUTTONS_NONE:
|
||||||
@ -876,57 +883,40 @@ gtk_message_dialog_add_buttons (GtkMessageDialog* message_dialog,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_BUTTONS_OK:
|
case GTK_BUTTONS_OK:
|
||||||
gtk_dialog_add_button (dialog,
|
gtk_dialog_add_button (dialog, _("_OK"), GTK_RESPONSE_OK);
|
||||||
_("_OK"),
|
|
||||||
GTK_RESPONSE_OK);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_BUTTONS_CLOSE:
|
case GTK_BUTTONS_CLOSE:
|
||||||
gtk_dialog_add_button (dialog,
|
gtk_dialog_add_button (dialog, _("_Close"), GTK_RESPONSE_CLOSE);
|
||||||
_("_Close"),
|
|
||||||
GTK_RESPONSE_CLOSE);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_BUTTONS_CANCEL:
|
case GTK_BUTTONS_CANCEL:
|
||||||
gtk_dialog_add_button (dialog,
|
gtk_dialog_add_button (dialog, _("_Cancel"), GTK_RESPONSE_CANCEL);
|
||||||
_("_Cancel"),
|
|
||||||
GTK_RESPONSE_CANCEL);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_BUTTONS_YES_NO:
|
case GTK_BUTTONS_YES_NO:
|
||||||
gtk_dialog_add_button (dialog,
|
gtk_dialog_add_button (dialog, _("_No"), GTK_RESPONSE_NO);
|
||||||
_("_No"),
|
gtk_dialog_add_button (dialog, _("_Yes"), GTK_RESPONSE_YES);
|
||||||
GTK_RESPONSE_NO);
|
|
||||||
gtk_dialog_add_button (dialog,
|
|
||||||
_("_Yes"),
|
|
||||||
GTK_RESPONSE_YES);
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
||||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
||||||
GTK_RESPONSE_YES,
|
GTK_RESPONSE_YES,
|
||||||
GTK_RESPONSE_NO,
|
GTK_RESPONSE_NO,
|
||||||
-1);
|
-1);
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_BUTTONS_OK_CANCEL:
|
case GTK_BUTTONS_OK_CANCEL:
|
||||||
gtk_dialog_add_button (dialog,
|
gtk_dialog_add_button (dialog, _("_Cancel"), GTK_RESPONSE_CANCEL);
|
||||||
_("_Cancel"),
|
gtk_dialog_add_button (dialog, _("_OK"), GTK_RESPONSE_OK);
|
||||||
GTK_RESPONSE_CANCEL);
|
|
||||||
gtk_dialog_add_button (dialog,
|
|
||||||
_("_OK"),
|
|
||||||
GTK_RESPONSE_OK);
|
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
||||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
||||||
GTK_RESPONSE_OK,
|
GTK_RESPONSE_OK,
|
||||||
GTK_RESPONSE_CANCEL,
|
GTK_RESPONSE_CANCEL,
|
||||||
-1);
|
-1);
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_warning ("Unknown GtkButtonsType");
|
g_warning ("Unknown GtkButtonsType");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (message_dialog), "buttons");
|
g_object_notify (G_OBJECT (message_dialog), "buttons");
|
||||||
}
|
}
|
||||||
|
@ -3,38 +3,29 @@
|
|||||||
<!-- interface-requires gtk+ 3.10 -->
|
<!-- interface-requires gtk+ 3.10 -->
|
||||||
<template class="GtkMessageDialog" parent="GtkDialog">
|
<template class="GtkMessageDialog" parent="GtkDialog">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="border_width">5</property>
|
<property name="border_width">0</property>
|
||||||
<property name="title"> </property>
|
<property name="title"> </property>
|
||||||
<property name="resizable">False</property>
|
<property name="resizable">False</property>
|
||||||
<property name="type_hint">dialog</property>
|
<property name="type_hint">dialog</property>
|
||||||
<property name="skip_taskbar_hint">True</property>
|
<property name="skip_taskbar_hint">True</property>
|
||||||
|
<child internal-child="headerbar">
|
||||||
|
<object class="GtkHeaderBar" id="headerbar1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="show-close-button">False</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
<child internal-child="vbox">
|
<child internal-child="vbox">
|
||||||
<object class="GtkBox" id="dialog-vbox1">
|
<object class="GtkBox" id="dialog-vbox1">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="border_width">0</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<property name="spacing">14</property>
|
<property name="spacing">20</property>
|
||||||
<child internal-child="action_area">
|
|
||||||
<object class="GtkButtonBox" id="dialog-action_area1">
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="pack_type">end</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="box">
|
<object class="GtkBox" id="box">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="border_width">5</property>
|
<property name="border_width">0</property>
|
||||||
<property name="spacing">12</property>
|
<property name="spacing">12</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImage" id="image">
|
<object class="GtkImage" id="image">
|
||||||
@ -45,7 +36,7 @@
|
|||||||
<property name="stock">gtk-missing-image</property>
|
<property name="stock">gtk-missing-image</property>
|
||||||
<property name="use_fallback">True</property>
|
<property name="use_fallback">True</property>
|
||||||
<property name="icon_size">6</property>
|
<property name="icon_size">6</property>
|
||||||
<property name="xpad">6</property>
|
<property name="xpad">12</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@ -57,6 +48,7 @@
|
|||||||
<object class="GtkBox" id="message_area">
|
<object class="GtkBox" id="message_area">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_end">20</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<property name="spacing">12</property>
|
<property name="spacing">12</property>
|
||||||
<child>
|
<child>
|
||||||
@ -106,7 +98,7 @@
|
|||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">False</property>
|
||||||
<property name="position">1</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
Loading…
Reference in New Issue
Block a user