summaryrefslogtreecommitdiffstats
path: root/subprojects/libhandy/examples/hdy-demo-preferences-window.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 14:36:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 14:36:24 +0000
commit9b6d8e63db85c30007b463e91f91a791969fa83f (patch)
tree0899af51d73c1bf986f73ae39a03c4436083018a /subprojects/libhandy/examples/hdy-demo-preferences-window.c
parentInitial commit. (diff)
downloadgnome-control-center-upstream.tar.xz
gnome-control-center-upstream.zip
Adding upstream version 1:3.38.4.upstream/1%3.38.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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));
+}