2013-04-22 01:16:24 +00:00
|
|
|
/* Stack
|
|
|
|
*
|
|
|
|
* GtkStack is a container that shows a single child at a time,
|
|
|
|
* with nice transitions when the visible child changes.
|
|
|
|
*
|
|
|
|
* GtkStackSwitcher adds buttons to control which child is visible.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
GtkWidget *
|
|
|
|
do_stack (GtkWidget *do_widget)
|
|
|
|
{
|
|
|
|
static GtkWidget *window = NULL;
|
|
|
|
|
|
|
|
if (!window)
|
|
|
|
{
|
2015-06-28 13:23:28 +00:00
|
|
|
GtkBuilder *builder;
|
|
|
|
|
2015-06-20 01:59:15 +00:00
|
|
|
builder = gtk_builder_new_from_resource ("/stack/stack.ui");
|
2013-04-22 01:16:24 +00:00
|
|
|
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
|
2017-10-31 06:41:15 +00:00
|
|
|
gtk_window_set_display (GTK_WINDOW (window),
|
|
|
|
gtk_widget_get_display (do_widget));
|
2020-05-09 16:03:11 +00:00
|
|
|
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
2015-06-28 13:23:28 +00:00
|
|
|
|
|
|
|
g_object_unref (builder);
|
2013-04-22 01:16:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!gtk_widget_get_visible (window))
|
2017-01-19 09:02:04 +00:00
|
|
|
gtk_widget_show (window);
|
2013-04-22 01:16:24 +00:00
|
|
|
else
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (window));
|
2013-04-22 01:16:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
return window;
|
|
|
|
}
|