Commit df007fb9 authored by Matthias Clasen's avatar Matthias Clasen

Add another dialog to test

This one is taken from polari, and currently doesn't work
as expected.
parent dc1317a5
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.10 -->
<object class="GtkListStore" id="liststore1">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkEntryCompletion" id="name_completion">
<property name="model">liststore1</property>
<property name="text_column">0</property>
<property name="inline_completion">True</property>
</object>
<object class="GtkDialog" id="dialog">
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<property name="default_width">500</property>
<property name="use_header_bar">1</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="titlebar">
<property name="visible">True</property>
<property name="title" translatable="yes">Join Chat Room</property>
<child>
<object class="GtkButton" id="back_button">
<property name="visible">False</property>
<property name="can_focus">True</property>
<property name="valign">center</property>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage" id="back_icon">
<property name="visible">True</property>
<property name="icon_size">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="cancel_button">
<property name="label" translatable="yes">_Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="confirm_button">
<property name="label" translatable="yes">_Join</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
</object>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkStack" id="stack">
<property name="visible">True</property>
<property name="transition_type">slide-left-right</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">24</property>
<property name="margin_right">24</property>
<property name="margin_top">24</property>
<property name="margin_bottom">24</property>
<property name="row_spacing">12</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="margin">
<property name="visible">True</property>
<property name="width_request">24</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="password_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="visibility">False</property>
<property name="activates_default">True</property>
<property name="placeholder_text" translatable="yes">optional</property>
<property name="input_purpose">password</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">2</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="name_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="margin_top">24</property>
<property name="activates_default">True</property>
<property name="completion">name_completion</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
<property name="width">2</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="add_connection_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">list-add-symbolic</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Add Connection</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">add_connection_button</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="connection_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="connection_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">C_onnection</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">connection_combo</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="name_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="margin_top">24</property>
<property name="label" translatable="yes">Room _Name</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">name_entry</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="password_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">_Password</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">password_entry</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="name">main</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-6">cancel_button</action-widget>
</action-widgets>
<action-widgets>
<action-widget response="apply">confirm_button</action-widget>
</action-widgets>
</object>
</interface>
......@@ -177,6 +177,21 @@ show_dialog_with_header_buttons (GtkWindow *parent)
gtk_widget_destroy (dialog);
}
static void
show_dialog_with_header_buttons2 (GtkWindow *parent)
{
GtkBuilder *builder;
GtkWidget *dialog;
builder = gtk_builder_new ();
gtk_builder_add_from_file (builder, "dialog.ui", NULL);
dialog = (GtkWidget *)gtk_builder_get_object (builder, "dialog");
g_object_unref (builder);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
typedef struct {
GtkDialog parent;
} MyDialog;
......@@ -364,6 +379,12 @@ main (int argc, char *argv[])
gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_label ("Header & Buttons & Builder");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_with_header_buttons2), window);
gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_with_label ("Template");
button = gtk_button_new_with_label ("Template");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_dialog_from_template), window);
gtk_widget_show (button);
......
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