Commit b52d362e authored by Adrien Plazas's avatar Adrien Plazas Committed by Guido Gunther

examples: Make the Dialog section look nicer

This improves the spacing, adds and icon and adds a description to the
Dialog section.
parent fc7a9931
......@@ -245,6 +245,7 @@ dialog_clicked_cb (GtkButton *btn,
dlg = hdy_dialog_new (GTK_WINDOW (self));
gtk_window_set_title (GTK_WINDOW (dlg), "HdyDialog");
lbl = gtk_label_new ("Hello, World!");
g_object_set (lbl, "margin", 12, NULL);
gtk_widget_set_vexpand (lbl, TRUE);
gtk_widget_set_valign (lbl, GTK_ALIGN_CENTER);
gtk_widget_set_halign (lbl, GTK_ALIGN_CENTER);
......@@ -271,6 +272,7 @@ dialog_action_clicked_cb (GtkButton *btn,
gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_ACCEPT);
g_signal_connect (G_OBJECT (dlg), "response", G_CALLBACK (dialog_close_cb), NULL);
lbl = gtk_label_new ("Hello, World!");
g_object_set (lbl, "margin", 12, NULL);
gtk_widget_set_vexpand (lbl, TRUE);
gtk_widget_set_valign (lbl, GTK_ALIGN_CENTER);
gtk_widget_set_halign (lbl, GTK_ALIGN_CENTER);
......
......@@ -1009,56 +1009,114 @@
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="margin_start">12</property>
<property name="margin_end">12</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="halign">center</property>
<property name="expand">True</property>
<child>
<object class="GtkLabel">
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="can_focus">False</property>
<property name="opacity">0.5</property>
<property name="halign">center</property>
<property name="margin_bottom">12</property>
<property name="label" translatable="yes">Dialog</property>
<property name="justify">center</property>
<property name="wrap">True</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="2"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<property name="label" translatable="yes">Presentation Dialog</property>
<signal name="clicked" handler="dialog_clicked_cb" swapped="no"/>
<property name="valign">center</property>
<property name="margin-bottom">32</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="pixel_size">128</property>
<property name="icon_name">dialog-question-symbolic</property>
<property name="icon-size">0</property>
<property name="margin-bottom">18</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="opacity">0.5</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Dialog</property>
<property name="halign">center</property>
<property name="xalign">0</property>
<property name="margin-bottom">12</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="2"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="opacity">0.5</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Dialogs mimicking a view of a small the parent window.</property>
<property name="justify">center</property>
<property name="use_markup">true</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton">
<object class="GtkBox">
<property name="visible">True</property>
<property name="label" translatable="yes">Action Dialog</property>
<signal name="clicked" handler="dialog_action_clicked_cb" swapped="no"/>
<property name="orientation">vertical</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="spacing">12</property>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<property name="label" translatable="yes">Presentation Dialog</property>
<signal name="clicked" handler="dialog_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<property name="label" translatable="yes">Action Dialog</property>
<signal name="clicked" handler="dialog_action_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment