widget-factory: Add new widgets
Add GtkStack and GtkRevealer to the second page in gtk3-widget-factory.
This commit is contained in:
@ -78,6 +78,35 @@ on_page_toggled (GtkToggleButton *button,
|
|||||||
gtk_notebook_set_current_page (pages, page);
|
gtk_notebook_set_current_page (pages, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
spin_value_changed (GtkAdjustment *adjustment, GtkWidget *label)
|
||||||
|
{
|
||||||
|
GtkWidget *w;
|
||||||
|
gint v;
|
||||||
|
gchar *text;
|
||||||
|
|
||||||
|
v = (int)gtk_adjustment_get_value (adjustment);
|
||||||
|
|
||||||
|
if ((v % 3) == 0)
|
||||||
|
{
|
||||||
|
text = g_strdup_printf ("%d is a multiple of 3", v);
|
||||||
|
gtk_label_set_label (GTK_LABEL (label), text);
|
||||||
|
g_free (text);
|
||||||
|
}
|
||||||
|
|
||||||
|
w = gtk_widget_get_ancestor (label, GTK_TYPE_REVEALER);
|
||||||
|
gtk_revealer_set_reveal_child (GTK_REVEALER (w), (v % 3) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
dismiss (GtkWidget *button)
|
||||||
|
{
|
||||||
|
GtkWidget *w;
|
||||||
|
|
||||||
|
w = gtk_widget_get_ancestor (button, GTK_TYPE_REVEALER);
|
||||||
|
gtk_revealer_set_reveal_child (GTK_REVEALER (w), FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -86,6 +115,7 @@ main (int argc, char *argv[])
|
|||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GtkWidget *notebook;
|
GtkWidget *notebook;
|
||||||
gboolean dark = FALSE;
|
gboolean dark = FALSE;
|
||||||
|
GtkAdjustment *adj;
|
||||||
|
|
||||||
gtk_init (&argc, &argv);
|
gtk_init (&argc, &argv);
|
||||||
|
|
||||||
@ -114,6 +144,14 @@ main (int argc, char *argv[])
|
|||||||
widget = (GtkWidget*) gtk_builder_get_object (builder, "aboutmenuitem");
|
widget = (GtkWidget*) gtk_builder_get_object (builder, "aboutmenuitem");
|
||||||
g_signal_connect (widget, "activate", G_CALLBACK (show_about), window);
|
g_signal_connect (widget, "activate", G_CALLBACK (show_about), window);
|
||||||
|
|
||||||
|
widget = (GtkWidget*) gtk_builder_get_object (builder, "page2dismiss");
|
||||||
|
g_signal_connect (widget, "clicked", G_CALLBACK (dismiss), NULL);
|
||||||
|
|
||||||
|
widget = (GtkWidget*) gtk_builder_get_object (builder, "page2note");
|
||||||
|
adj = (GtkAdjustment *) gtk_builder_get_object (builder, "adjustment2");
|
||||||
|
g_signal_connect (adj, "value-changed",
|
||||||
|
G_CALLBACK (spin_value_changed), widget);
|
||||||
|
|
||||||
g_object_unref (G_OBJECT (builder));
|
g_object_unref (G_OBJECT (builder));
|
||||||
|
|
||||||
gtk_widget_show (window);
|
gtk_widget_show (window);
|
||||||
|
|||||||
@ -54,6 +54,23 @@ Vestibulum in tortor diam, quis aliquet quam. Praesent ut justo neque, tempus ru
|
|||||||
Duis eu lectus quam. Vivamus eget metus a mauris molestie venenatis pulvinar eleifend nisi.
|
Duis eu lectus quam. Vivamus eget metus a mauris molestie venenatis pulvinar eleifend nisi.
|
||||||
Nulla facilisi. Pellentesque at dolor sit amet purus dapibus pulvinar molestie quis neque.
|
Nulla facilisi. Pellentesque at dolor sit amet purus dapibus pulvinar molestie quis neque.
|
||||||
Suspendisse feugiat quam quis dolor accumsan cursus. </property>
|
Suspendisse feugiat quam quis dolor accumsan cursus. </property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkTextBuffer" id="textbuffer2">
|
||||||
|
<property name="text">* Translation updates:
|
||||||
|
Aragonese
|
||||||
|
Assamese
|
||||||
|
Basque
|
||||||
|
Brazilian Portuguese
|
||||||
|
Dutch
|
||||||
|
German
|
||||||
|
Hebrew
|
||||||
|
Hungarian
|
||||||
|
Polish
|
||||||
|
Portuguese
|
||||||
|
Serbian
|
||||||
|
Slovenian
|
||||||
|
Spanish
|
||||||
|
Uyghur</property>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkAccelGroup" id="accelgroup1"/>
|
<object class="GtkAccelGroup" id="accelgroup1"/>
|
||||||
<object class="GtkWindow" id="window">
|
<object class="GtkWindow" id="window">
|
||||||
@ -2146,10 +2163,57 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="page2">
|
<object class="GtkOverlay" id="page2">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="orientation">vertical</property>
|
<child type="overlay">
|
||||||
<property name="spacing">6</property>
|
<object class="GtkRevealer" id="page2revealer">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="halign">center</property>
|
||||||
|
<property name="valign">start</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame" id="page2frame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="margin-top">2</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="page2box">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="margin-top">10</property>
|
||||||
|
<property name="margin-bottom">10</property>
|
||||||
|
<property name="margin-left">10</property>
|
||||||
|
<property name="margin-right">10</property>
|
||||||
|
<property name="spacing">20</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="page2note">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="hexpand">True</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="label">NEWS!</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="page2dismiss">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="page2dismissi">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="icon-name">window-close-symbolic</property>
|
||||||
|
<property name="icon-size">0</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkGrid" id="page2grid">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="column-homogeneous">True</property>
|
||||||
|
<property name="row-spacing">6</property>
|
||||||
|
<property name="column-spacing">6</property>
|
||||||
<property name="border-width">6</property>
|
<property name="border-width">6</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="page2box1">
|
<object class="GtkBox" id="page2box1">
|
||||||
@ -2172,6 +2236,87 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="filler1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">1</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="filler2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">2</property>
|
||||||
|
<property name="top-attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkStackSwitcher" id="switcher">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="stack">stack</property>
|
||||||
|
<property name="halign">center</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame" id="frame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="hexpand">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkStack" id="stack">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="transition-type">crossfade</property>
|
||||||
|
<property name="transition-duration">1000</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScrolledWindow" id="swo">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="shadow-type">none</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTextView" id="tvo">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="buffer">textbuffer2</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="name">page1</property>
|
||||||
|
<property name="icon-name">document-open-recent-symbolic</property>
|
||||||
|
<property name="title">News</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage" id="imageo">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="resource">/logos/gtk-logo-256.png</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="name">page2</property>
|
||||||
|
<property name="icon-name">system-shutdown-symbolic</property>
|
||||||
|
<property name="title">Logo</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left-attach">0</property>
|
||||||
|
<property name="top-attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|||||||
Reference in New Issue
Block a user