widget-factory: Add a sidebar example

This commit is contained in:
Matthias Clasen 2014-10-03 01:03:52 -04:00
parent c9d9c9158f
commit 3b18ea71c3
2 changed files with 197 additions and 0 deletions

View File

@ -851,6 +851,7 @@ activate (GApplication *app)
GtkWidget *stack;
GtkWidget *dialog;
GtkAdjustment *adj;
GtkCssProvider *provider;
static GActionEntry win_entries[] = {
{ "dark", NULL, NULL, "false", change_theme_state },
{ "search", activate_search, NULL, NULL, NULL },
@ -870,6 +871,13 @@ activate (GApplication *app)
g_type_ensure (my_text_view_get_type ());
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, ".circular-button { border-radius: 20px; outline-radius: 20px; }", -1, NULL);
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_USER);
g_object_unref (provider);
builder = gtk_builder_new_from_resource ("/org/gtk/WidgetFactory/widget-factory.ui");
gtk_builder_add_callback_symbol (builder, "on_entry_icon_release", (GCallback)on_entry_icon_release);
gtk_builder_add_callback_symbol (builder, "on_scale_button_value_changed", (GCallback)on_scale_button_value_changed);

View File

@ -3200,6 +3200,7 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
@ -3313,6 +3314,194 @@ microphone-sensitivity-medium-symbolic</property>
</child>
</object>
</child>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<style>
<class name="image-button"/>
<class name="circular-button"/>
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-size">1</property>
<property name="icon-name">emblem-system-symbolic</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
</object>
</child>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<child>
<object class="GtkSidebar">
<property name="visible">True</property>
<property name="stack">sidebar_stack</property>
</object>
</child>
<child>
<object class="GtkStack" id="sidebar_stack">
<property name="visible">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="margin">20</property>
<property name="spacing">10</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkEntry">
<property name="visible">True</property>
<property name="placeholder-text">First Name</property>
</object>
</child>
<child>
<object class="GtkEntry">
<property name="visible">True</property>
<property name="placeholder-text">Last Name</property>
</object>
</child>
</object>
<packing>
<property name="name">id</property>
<property name="title">Identity</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="margin">20</property>
<property name="spacing">10</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="spacing">2</property>
<child>
<object class="GtkComboBoxText">
<property name="visible">True</property>
<items>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>11</item>
<item>12</item>
<item>13</item>
<item>14</item>
<item>15</item>
<item>16</item>
<item>17</item>
<item>18</item>
<item>19</item>
<item>20</item>
<item>21</item>
<item>22</item>
<item>23</item>
<item>24</item>
<item>25</item>
<item>26</item>
<item>27</item>
<item>28</item>
<item>29</item>
<item>30</item>
<item>31</item>
</items>
</object>
</child>
<child>
<object class="GtkComboBoxText">
<property name="visible">True</property>
<items>
<item>January</item>
<item>February</item>
<item>March</item>
<item>April</item>
<item>May</item>
<item>June</item>
<item>July</item>
<item>August</item>
<item>September</item>
<item>October</item>
<item>November</item>
<item>December</item>
</items>
</object>
</child>
</object>
</child>
<child>
<object class="GtkEntry">
<property name="visible">True</property>
<property name="placeholder-text">Year</property>
</object>
</child>
</object>
<packing>
<property name="name">bd</property>
<property name="title">Birthdate</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="margin">20</property>
<property name="halign">center</property>
<property name="valign">center</property>
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkEntry">
<property name="visible">True</property>
<property name="placeholder-text">Street</property>
</object>
</child>
<child>
<object class="GtkEntry">
<property name="visible">True</property>
<property name="placeholder-text">City</property>
</object>
</child>
<child>
<object class="GtkEntry">
<property name="visible">True</property>
<property name="placeholder-text">Province</property>
</object>
</child>
</object>
<packing>
<property name="name">ad</property>
<property name="title">Address</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>