summaryrefslogtreecommitdiffstats
path: root/subprojects/libhandy/examples/hdy-demo-preferences-window.c
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/libhandy/examples/hdy-demo-preferences-window.c')
-rw-r--r--subprojects/libhandy/examples/hdy-demo-preferences-window.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/subprojects/libhandy/examples/hdy-demo-preferences-window.c b/subprojects/libhandy/examples/hdy-demo-preferences-window.c
new file mode 100644
index 0000000..4481664
--- /dev/null
+++ b/subprojects/libhandy/examples/hdy-demo-preferences-window.c
@@ -0,0 +1,56 @@
+#include "hdy-demo-preferences-window.h"
+
+struct _HdyDemoPreferencesWindow
+{
+ HdyPreferencesWindow parent_instance;
+
+ GtkWidget *subpage1;
+ GtkWidget *subpage2;
+};
+
+G_DEFINE_TYPE (HdyDemoPreferencesWindow, hdy_demo_preferences_window, HDY_TYPE_PREFERENCES_WINDOW)
+
+HdyDemoPreferencesWindow *
+hdy_demo_preferences_window_new (void)
+{
+ return g_object_new (HDY_TYPE_DEMO_PREFERENCES_WINDOW, NULL);
+}
+
+static void
+return_to_preferences_cb (HdyDemoPreferencesWindow *self)
+{
+ hdy_preferences_window_close_subpage (HDY_PREFERENCES_WINDOW (self));
+}
+
+static void
+subpage1_activated_cb (HdyDemoPreferencesWindow *self)
+{
+ hdy_preferences_window_present_subpage (HDY_PREFERENCES_WINDOW (self), self->subpage1);
+}
+
+static void
+subpage2_activated_cb (HdyDemoPreferencesWindow *self)
+{
+ hdy_preferences_window_present_subpage (HDY_PREFERENCES_WINDOW (self), self->subpage2);
+}
+
+static void
+hdy_demo_preferences_window_class_init (HdyDemoPreferencesWindowClass *klass)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ gtk_widget_class_set_template_from_resource (widget_class, "/sm/puri/Handy/Demo/ui/hdy-demo-preferences-window.ui");
+
+ gtk_widget_class_bind_template_child (widget_class, HdyDemoPreferencesWindow, subpage1);
+ gtk_widget_class_bind_template_child (widget_class, HdyDemoPreferencesWindow, subpage2);
+
+ gtk_widget_class_bind_template_callback (widget_class, return_to_preferences_cb);
+ gtk_widget_class_bind_template_callback (widget_class, subpage1_activated_cb);
+ gtk_widget_class_bind_template_callback (widget_class, subpage2_activated_cb);
+}
+
+static void
+hdy_demo_preferences_window_init (HdyDemoPreferencesWindow *self)
+{
+ gtk_widget_init_template (GTK_WIDGET (self));
+}