forked from AuroraMiddleware/gtk
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 "gtklabel.h"
|
||||
#include "gtkbox.h"
|
||||
#include "gtkbbox.h"
|
||||
#include "gtkimage.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkprivate.h"
|
||||
@ -305,6 +306,7 @@ static void
|
||||
gtk_message_dialog_init (GtkMessageDialog *dialog)
|
||||
{
|
||||
GtkMessageDialogPrivate *priv;
|
||||
GtkWidget *action_area;
|
||||
|
||||
dialog->priv = gtk_message_dialog_get_instance_private (dialog);
|
||||
priv = dialog->priv;
|
||||
@ -316,6 +318,10 @@ gtk_message_dialog_init (GtkMessageDialog *dialog)
|
||||
|
||||
gtk_widget_init_template (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
|
||||
@ -869,6 +875,7 @@ 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:
|
||||
@ -876,57 +883,40 @@ gtk_message_dialog_add_buttons (GtkMessageDialog* message_dialog,
|
||||
break;
|
||||
|
||||
case GTK_BUTTONS_OK:
|
||||
gtk_dialog_add_button (dialog,
|
||||
_("_OK"),
|
||||
GTK_RESPONSE_OK);
|
||||
gtk_dialog_add_button (dialog, _("_OK"), GTK_RESPONSE_OK);
|
||||
break;
|
||||
|
||||
case GTK_BUTTONS_CLOSE:
|
||||
gtk_dialog_add_button (dialog,
|
||||
_("_Close"),
|
||||
GTK_RESPONSE_CLOSE);
|
||||
gtk_dialog_add_button (dialog, _("_Close"), GTK_RESPONSE_CLOSE);
|
||||
break;
|
||||
|
||||
case GTK_BUTTONS_CANCEL:
|
||||
gtk_dialog_add_button (dialog,
|
||||
_("_Cancel"),
|
||||
GTK_RESPONSE_CANCEL);
|
||||
gtk_dialog_add_button (dialog, _("_Cancel"), GTK_RESPONSE_CANCEL);
|
||||
break;
|
||||
|
||||
case GTK_BUTTONS_YES_NO:
|
||||
gtk_dialog_add_button (dialog,
|
||||
_("_No"),
|
||||
GTK_RESPONSE_NO);
|
||||
gtk_dialog_add_button (dialog,
|
||||
_("_Yes"),
|
||||
GTK_RESPONSE_YES);
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
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);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
break;
|
||||
|
||||
case GTK_BUTTONS_OK_CANCEL:
|
||||
gtk_dialog_add_button (dialog,
|
||||
_("_Cancel"),
|
||||
GTK_RESPONSE_CANCEL);
|
||||
gtk_dialog_add_button (dialog,
|
||||
_("_OK"),
|
||||
GTK_RESPONSE_OK);
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
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);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
break;
|
||||
|
||||
default:
|
||||
g_warning ("Unknown GtkButtonsType");
|
||||
break;
|
||||
}
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
g_object_notify (G_OBJECT (message_dialog), "buttons");
|
||||
}
|
||||
|
@ -3,38 +3,29 @@
|
||||
<!-- interface-requires gtk+ 3.10 -->
|
||||
<template class="GtkMessageDialog" parent="GtkDialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="border_width">0</property>
|
||||
<property name="title"> </property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="type_hint">dialog</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">
|
||||
<object class="GtkBox" id="dialog-vbox1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">0</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">14</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>
|
||||
<property name="spacing">20</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="border_width">0</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image">
|
||||
@ -45,7 +36,7 @@
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
<property name="use_fallback">True</property>
|
||||
<property name="icon_size">6</property>
|
||||
<property name="xpad">6</property>
|
||||
<property name="xpad">12</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@ -57,6 +48,7 @@
|
||||
<object class="GtkBox" id="message_area">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_end">20</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
@ -106,7 +98,7 @@
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
Loading…
Reference in New Issue
Block a user