Merge branch 'convert-dialog' into 'master'

Convert dialog

See merge request GNOME/gtk!898
This commit is contained in:
Matthias Clasen 2019-06-01 00:03:15 +00:00
commit ccd7110107
5 changed files with 175 additions and 0 deletions

View File

@ -1265,6 +1265,66 @@ rewrite_paned (Element *element,
rewrite_paned_child (element, data, child2, "child2");
}
static void
rewrite_dialog (Element *element,
MyParserData *data)
{
Element *content_area = NULL;
Element *vbox = NULL;
Element *action_area = NULL;
GList *l;
for (l = element->children; l; l = l->next)
{
Element *elt = l->data;
if (g_str_equal (elt->element_name, "child") &&
g_strcmp0 (get_attribute_value (elt, "internal-child"), "vbox") == 0)
{
content_area = elt;
break;
}
}
if (!content_area || !content_area->children)
return;
vbox = content_area->children->data;
for (l = vbox->children; l; l = l->next)
{
Element *elt = l->data;
if (g_str_equal (elt->element_name, "child") &&
g_strcmp0 (get_attribute_value (elt, "internal-child"), "action_area") == 0)
{
action_area = elt;
break;
}
}
if (!action_area)
return;
set_attribute_value (content_area, "internal-child", "content_area");
vbox->children = g_list_remove (vbox->children, action_area);
action_area->parent = element;
element->children = g_list_append (element->children, action_area);
for (l = action_area->children; l; l = l->next)
{
Element *elt = l->data;
if (g_str_equal (elt->element_name, "packing"))
{
action_area->children = g_list_remove (action_area->children, elt);
free_element (elt);
break;
}
}
}
static void
rewrite_layout_props (Element *element,
MyParserData *data)
@ -1487,6 +1547,10 @@ rewrite_element (Element *element,
g_str_equal (get_class_name (element), "GtkPaned"))
rewrite_paned (element, data);
if (element_is_object_or_template (element) &&
g_str_equal (get_class_name (element), "GtkDialog"))
rewrite_dialog (element, data);
if (element_is_object_or_template (element) &&
g_str_equal (get_class_name (element), "GtkOverlay"))
rewrite_layout_props (element, data);

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<object class="GtkDialog">
<child internal-child="content_area">
<object class="GtkBox">
<property name="visible">0</property>
<property name="name">fancy</property>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="name">actions</property>
</object>
</child>
</object>

View File

@ -0,0 +1,15 @@
<object class="GtkDialog">
<child internal-child="vbox">
<object class="GtkBox">
<property name="name">fancy</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="name">actions</property>
</object>
</child>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
</object>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk30">
<template class="GtkFileChooserDialog" parent="GtkDialog">
<property name="role">GtkFileChooserDialog</property>
<property name="type-hint">dialog</property>
<property name="default-width">600</property>
<signal name="response" handler="response_cb" swapped="no"/>
<child internal-child="content_area">
<object class="GtkBox" id="dialog-vbox1">
<property name="visible">0</property>
<property name="orientation">vertical</property>
<property name="border-width">0</property>
<child>
<object class="GtkFileChooserWidget" id="widget">
<property name="orientation">vertical</property>
<signal name="default-size-changed" handler="file_chooser_widget_default_size_changed" swapped="no"/>
<signal name="file-activated" handler="file_chooser_widget_file_activated" swapped="no"/>
<signal name="response-requested" handler="file_chooser_widget_response_requested" swapped="no"/>
<signal name="selection-changed" handler="file_chooser_widget_selection_changed" swapped="no"/>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
</object>
</child>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="border-width">6</property>
<property name="layout-style">end</property>
</object>
</child>
</template>
<object class="GtkSizeGroup" id="buttons">
<property name="mode">vertical</property>
</object>
</interface>

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk30">
<!-- interface-requires gtk+ 3.10 -->
<template class="GtkFileChooserDialog" parent="GtkDialog">
<property name="role">GtkFileChooserDialog</property>
<property name="type-hint">dialog</property>
<property name="default-width">600</property>
<signal name="response" handler="response_cb" swapped="no"/>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="orientation">vertical</property>
<property name="border-width">0</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="border-width">6</property>
<property name="layout-style">end</property>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
<child>
<object class="GtkFileChooserWidget" id="widget">
<property name="visible">1</property>
<property name="orientation">vertical</property>
<signal name="default-size-changed" handler="file_chooser_widget_default_size_changed" swapped="no"/>
<signal name="file-activated" handler="file_chooser_widget_file_activated" swapped="no"/>
<signal name="response-requested" handler="file_chooser_widget_response_requested" swapped="no"/>
<signal name="selection-changed" handler="file_chooser_widget_selection_changed" swapped="no"/>
</object>
<packing>
<property name="expand">1</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</template>
<object class="GtkSizeGroup" id="buttons">
<property name="mode">vertical</property>
</object>
</interface>