summaryrefslogtreecommitdiffstats
path: root/tests/interactive-panels
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:45:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:45:20 +0000
commitae1c76ff830d146d41e88d6fba724c0a54bce868 (patch)
tree3c354bec95af07be35fc71a4b738268496f1a1c4 /tests/interactive-panels
parentInitial commit. (diff)
downloadgnome-control-center-upstream/1%43.6.tar.xz
gnome-control-center-upstream/1%43.6.zip
Adding upstream version 1:43.6.upstream/1%43.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/interactive-panels/applications/gtp-dynamic-panel.desktop.in11
-rw-r--r--tests/interactive-panels/applications/gtp-header-widget.desktop.in11
-rw-r--r--tests/interactive-panels/applications/gtp-sidebar-widget.desktop.in11
-rw-r--r--tests/interactive-panels/applications/gtp-static-init.desktop.in11
-rw-r--r--tests/interactive-panels/applications/gtp-toplevel-sidebar-widget.desktop.in11
-rw-r--r--tests/interactive-panels/applications/meson.build22
-rw-r--r--tests/interactive-panels/gtp-dynamic-panel.c85
-rw-r--r--tests/interactive-panels/gtp-dynamic-panel.h30
-rw-r--r--tests/interactive-panels/gtp-dynamic-panel.ui27
-rw-r--r--tests/interactive-panels/gtp-header-widget.c42
-rw-r--r--tests/interactive-panels/gtp-header-widget.h30
-rw-r--r--tests/interactive-panels/gtp-header-widget.ui20
-rw-r--r--tests/interactive-panels/gtp-sidebar-widget.c56
-rw-r--r--tests/interactive-panels/gtp-sidebar-widget.h30
-rw-r--r--tests/interactive-panels/gtp-sidebar-widget.ui19
-rw-r--r--tests/interactive-panels/gtp-static-init.c49
-rw-r--r--tests/interactive-panels/gtp-static-init.h32
-rw-r--r--tests/interactive-panels/gtp-static-init.ui15
-rw-r--r--tests/interactive-panels/main.c80
-rw-r--r--tests/interactive-panels/meson.build49
-rw-r--r--tests/interactive-panels/panels.gresource.xml10
21 files changed, 651 insertions, 0 deletions
diff --git a/tests/interactive-panels/applications/gtp-dynamic-panel.desktop.in b/tests/interactive-panels/applications/gtp-dynamic-panel.desktop.in
new file mode 100644
index 0000000..8a550ba
--- /dev/null
+++ b/tests/interactive-panels/applications/gtp-dynamic-panel.desktop.in
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Name=Dynamic Panel
+Comment=Panel that can be hidden from the sidebar
+Exec=gnome-control-center dynamic-panels
+Icon=weather-clear-night
+Terminal=false
+Type=Application
+NoDisplay=true
+StartupNotify=true
+Categories=GNOME;GTK;Settings;X-GNOME-Settings-Panel;X-GNOME-ConnectivitySettings;
+OnlyShowIn=GNOME;Unity; \ No newline at end of file
diff --git a/tests/interactive-panels/applications/gtp-header-widget.desktop.in b/tests/interactive-panels/applications/gtp-header-widget.desktop.in
new file mode 100644
index 0000000..4ffbf20
--- /dev/null
+++ b/tests/interactive-panels/applications/gtp-header-widget.desktop.in
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Name=Header
+Comment=Panel that embeds a widget at the header bar
+Exec=gnome-control-center thunderbolt
+Icon=view-sort-descending
+Terminal=false
+Type=Application
+NoDisplay=true
+StartupNotify=true
+Categories=GNOME;GTK;Settings;X-GNOME-Settings-Panel;X-GNOME-ConnectivitySettings;
+OnlyShowIn=GNOME;Unity; \ No newline at end of file
diff --git a/tests/interactive-panels/applications/gtp-sidebar-widget.desktop.in b/tests/interactive-panels/applications/gtp-sidebar-widget.desktop.in
new file mode 100644
index 0000000..6c96c2d
--- /dev/null
+++ b/tests/interactive-panels/applications/gtp-sidebar-widget.desktop.in
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Name=Another Sidebar Widget
+Comment=Panel that embeds a widget at the sidebar
+Exec=gnome-control-center sidebar-widget
+Icon=go-first-symbolic
+Terminal=false
+Type=Application
+NoDisplay=true
+StartupNotify=true
+Categories=GNOME;GTK;Settings;X-GNOME-Settings-Panel;X-GNOME-DetailsSettings;
+OnlyShowIn=GNOME;Unity;
diff --git a/tests/interactive-panels/applications/gtp-static-init.desktop.in b/tests/interactive-panels/applications/gtp-static-init.desktop.in
new file mode 100644
index 0000000..e8ccdf5
--- /dev/null
+++ b/tests/interactive-panels/applications/gtp-static-init.desktop.in
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Name=Static Initializer
+Comment=Panel with a static initializer function
+Exec=gnome-control-center static-init
+Icon=view-continuous
+Terminal=false
+Type=Application
+NoDisplay=true
+StartupNotify=true
+Categories=GNOME;GTK;Settings;X-GNOME-Settings-Panel;X-GNOME-ConnectivitySettings;
+OnlyShowIn=GNOME;Unity; \ No newline at end of file
diff --git a/tests/interactive-panels/applications/gtp-toplevel-sidebar-widget.desktop.in b/tests/interactive-panels/applications/gtp-toplevel-sidebar-widget.desktop.in
new file mode 100644
index 0000000..a6d4aa8
--- /dev/null
+++ b/tests/interactive-panels/applications/gtp-toplevel-sidebar-widget.desktop.in
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Name=Sidebar Widget
+Comment=Panel that embeds a widget at the sidebar
+Exec=gnome-control-center sidebar-widget
+Icon=go-first-symbolic
+Terminal=false
+Type=Application
+NoDisplay=true
+StartupNotify=true
+Categories=GNOME;GTK;Settings;X-GNOME-Settings-Panel;X-GNOME-ConnectivitySettings;
+OnlyShowIn=GNOME;Unity; \ No newline at end of file
diff --git a/tests/interactive-panels/applications/meson.build b/tests/interactive-panels/applications/meson.build
new file mode 100644
index 0000000..82eed4d
--- /dev/null
+++ b/tests/interactive-panels/applications/meson.build
@@ -0,0 +1,22 @@
+#################
+# Desktop files #
+#################
+
+desktop_files = [
+ 'dynamic-panel',
+ 'header-widget',
+ 'sidebar-widget',
+ 'static-init',
+ 'toplevel-sidebar-widget',
+]
+
+foreach desktop_file : desktop_files
+ i18n.merge_file(
+ type : 'desktop',
+ input : 'gtp-@0@.desktop.in'.format(desktop_file),
+ output : 'gnome-@0@-panel.desktop'.format(desktop_file),
+ po_dir : po_dir,
+ build_by_default : true,
+ install : false,
+ )
+endforeach
diff --git a/tests/interactive-panels/gtp-dynamic-panel.c b/tests/interactive-panels/gtp-dynamic-panel.c
new file mode 100644
index 0000000..31efa30
--- /dev/null
+++ b/tests/interactive-panels/gtp-dynamic-panel.c
@@ -0,0 +1,85 @@
+/* gtp-dynamic-panel.c
+ *
+ * Copyright 2018 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define G_LOG_DOMAIN "gtp-dynamic-panel"
+
+#include "gtp-dynamic-panel.h"
+
+#include "shell/cc-application.h"
+#include "shell/cc-shell-model.h"
+
+struct _GtpDynamicPanel
+{
+ CcPanel parent;
+};
+
+G_DEFINE_TYPE (GtpDynamicPanel, gtp_dynamic_panel, CC_TYPE_PANEL)
+
+/* Auxiliary methods */
+
+static void
+set_visibility (CcPanelVisibility visibility)
+{
+ GApplication *application;
+ CcShellModel *model;
+
+ application = g_application_get_default ();
+ model = cc_application_get_model (CC_APPLICATION (application));
+
+ cc_shell_model_set_panel_visibility (model, "dynamic-panel", visibility);
+}
+
+/* Callbacks */
+
+static gboolean
+show_panel_cb (gpointer data)
+{
+ g_debug ("Showing panel");
+
+ set_visibility (CC_PANEL_VISIBLE);
+
+ return G_SOURCE_REMOVE;
+}
+
+static void
+on_button_clicked_cb (GtkButton *button,
+ GtpDynamicPanel *self)
+{
+ g_debug ("Hiding panel");
+
+ set_visibility (CC_PANEL_HIDDEN);
+ g_timeout_add_seconds (3, show_panel_cb, self);
+}
+
+static void
+gtp_dynamic_panel_class_init (GtpDynamicPanelClass *klass)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/tests/panels/gtp-dynamic-panel.ui");
+
+ gtk_widget_class_bind_template_callback (widget_class, on_button_clicked_cb);
+}
+
+static void
+gtp_dynamic_panel_init (GtpDynamicPanel *self)
+{
+ gtk_widget_init_template (GTK_WIDGET (self));
+}
diff --git a/tests/interactive-panels/gtp-dynamic-panel.h b/tests/interactive-panels/gtp-dynamic-panel.h
new file mode 100644
index 0000000..84ad5cc
--- /dev/null
+++ b/tests/interactive-panels/gtp-dynamic-panel.h
@@ -0,0 +1,30 @@
+/* gtp-dynamic-panel.h
+ *
+ * Copyright 2018 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <shell/cc-panel.h>
+
+G_BEGIN_DECLS
+
+#define GTP_TYPE_DYNAMIC_PANEL (gtp_dynamic_panel_get_type())
+G_DECLARE_FINAL_TYPE (GtpDynamicPanel, gtp_dynamic_panel, GTP, DYNAMIC_PANEL, CcPanel)
+
+G_END_DECLS
diff --git a/tests/interactive-panels/gtp-dynamic-panel.ui b/tests/interactive-panels/gtp-dynamic-panel.ui
new file mode 100644
index 0000000..30e1bdd
--- /dev/null
+++ b/tests/interactive-panels/gtp-dynamic-panel.ui
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <requires lib="gtk+" version="3.22"/>
+ <template class="GtpDynamicPanel" parent="CcPanel">
+ <child type="content">
+ <object class="AdwStatusPage">
+ <property name="icon-name">weather-clear-night-symbolic</property>
+ <property name="title">Dynamic Panel</property>
+ <property name="description">Dynamic panels may hide if you don't have some hardware. Use the button below to toggle the panel visibility:</property>
+
+ <child>
+ <object class="GtkButton">
+ <property name="halign">center</property>
+ <property name="label">Hide</property>
+ <signal name="clicked" handler="on_button_clicked_cb" object="GtpDynamicPanel" swapped="no" />
+ <style>
+ <class name="pill" />
+ </style>
+ </object>
+ </child>
+
+ </object>
+ </child>
+
+ </template>
+</interface>
+
diff --git a/tests/interactive-panels/gtp-header-widget.c b/tests/interactive-panels/gtp-header-widget.c
new file mode 100644
index 0000000..b27327a
--- /dev/null
+++ b/tests/interactive-panels/gtp-header-widget.c
@@ -0,0 +1,42 @@
+/* gtp-header-widget.c
+ *
+ * Copyright 2018 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#include "gtp-header-widget.h"
+
+struct _GtpHeaderWidget
+{
+ CcPanel parent;
+};
+
+G_DEFINE_TYPE (GtpHeaderWidget, gtp_header_widget, CC_TYPE_PANEL)
+
+static void
+gtp_header_widget_class_init (GtpHeaderWidgetClass *klass)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/tests/panels/gtp-header-widget.ui");
+}
+
+static void
+gtp_header_widget_init (GtpHeaderWidget *self)
+{
+ gtk_widget_init_template (GTK_WIDGET (self));
+}
diff --git a/tests/interactive-panels/gtp-header-widget.h b/tests/interactive-panels/gtp-header-widget.h
new file mode 100644
index 0000000..99f7ce0
--- /dev/null
+++ b/tests/interactive-panels/gtp-header-widget.h
@@ -0,0 +1,30 @@
+/* gtp-header-widget.h
+ *
+ * Copyright 2018 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <shell/cc-panel.h>
+
+G_BEGIN_DECLS
+
+#define GTP_TYPE_HEADER_WIDGET (gtp_header_widget_get_type())
+G_DECLARE_FINAL_TYPE (GtpHeaderWidget, gtp_header_widget, GTP, HEADER_WIDGET, CcPanel)
+
+G_END_DECLS
diff --git a/tests/interactive-panels/gtp-header-widget.ui b/tests/interactive-panels/gtp-header-widget.ui
new file mode 100644
index 0000000..8eb9b88
--- /dev/null
+++ b/tests/interactive-panels/gtp-header-widget.ui
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <template class="GtpHeaderWidget" parent="CcPanel">
+
+ <child type="titlebar-end">
+ <object class="GtkLabel" id="header_widget">
+ <property name="label">I'm a header widget</property>
+ </object>
+ </child>
+
+ <child type="content">
+ <object class="AdwStatusPage">
+ <property name="icon-name">go-top-symbolic</property>
+ <property name="title">Header Widgets</property>
+ <property name="description">Embed widgets in the header bar</property>
+ </object>
+ </child>
+ </template>
+</interface>
+
diff --git a/tests/interactive-panels/gtp-sidebar-widget.c b/tests/interactive-panels/gtp-sidebar-widget.c
new file mode 100644
index 0000000..1395724
--- /dev/null
+++ b/tests/interactive-panels/gtp-sidebar-widget.c
@@ -0,0 +1,56 @@
+/* gtp-sidebar-widget.c
+ *
+ * Copyright 2018 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#include "gtp-sidebar-widget.h"
+
+struct _GtpSidebarWidget
+{
+ CcPanel parent;
+
+ GtkWidget *sidebar_widget;
+};
+
+G_DEFINE_TYPE (GtpSidebarWidget, gtp_sidebar_widget, CC_TYPE_PANEL)
+
+static GtkWidget*
+gtp_sidebar_widget_get_sidebar_widget (CcPanel *panel)
+{
+ GtpSidebarWidget *self = GTP_SIDEBAR_WIDGET (panel);
+ return self->sidebar_widget;
+}
+
+static void
+gtp_sidebar_widget_class_init (GtpSidebarWidgetClass *klass)
+{
+ CcPanelClass *panel_class = CC_PANEL_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ panel_class->get_sidebar_widget = gtp_sidebar_widget_get_sidebar_widget;
+
+ gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/tests/panels/gtp-sidebar-widget.ui");
+
+ gtk_widget_class_bind_template_child (widget_class, GtpSidebarWidget, sidebar_widget);
+}
+
+static void
+gtp_sidebar_widget_init (GtpSidebarWidget *self)
+{
+ gtk_widget_init_template (GTK_WIDGET (self));
+}
diff --git a/tests/interactive-panels/gtp-sidebar-widget.h b/tests/interactive-panels/gtp-sidebar-widget.h
new file mode 100644
index 0000000..3bf8dfe
--- /dev/null
+++ b/tests/interactive-panels/gtp-sidebar-widget.h
@@ -0,0 +1,30 @@
+/* gtp-sidebar-widget.h
+ *
+ * Copyright 2018 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <shell/cc-panel.h>
+
+G_BEGIN_DECLS
+
+#define GTP_TYPE_SIDEBAR_WIDGET (gtp_sidebar_widget_get_type())
+G_DECLARE_FINAL_TYPE (GtpSidebarWidget, gtp_sidebar_widget, GTP, SIDEBAR_WIDGET, CcPanel)
+
+G_END_DECLS
diff --git a/tests/interactive-panels/gtp-sidebar-widget.ui b/tests/interactive-panels/gtp-sidebar-widget.ui
new file mode 100644
index 0000000..cba80fc
--- /dev/null
+++ b/tests/interactive-panels/gtp-sidebar-widget.ui
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <template class="GtpSidebarWidget" parent="CcPanel">
+
+ <child type="content">
+ <object class="AdwStatusPage">
+ <property name="icon_name">go-first-symbolic</property>
+ <property name="title">Sidebar</property>
+ <property name="description">Add a custom sidebar to the panel</property>
+ </object>
+ </child>
+
+ </template>
+
+ <object class="GtkLabel" id="sidebar_widget">
+ <property name="label">I'm a sidebar widget</property>
+ </object>
+</interface>
+
diff --git a/tests/interactive-panels/gtp-static-init.c b/tests/interactive-panels/gtp-static-init.c
new file mode 100644
index 0000000..c6b7a4f
--- /dev/null
+++ b/tests/interactive-panels/gtp-static-init.c
@@ -0,0 +1,49 @@
+/* gtp-static-init.c
+ *
+ * Copyright 2018 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#include "gtp-static-init.h"
+
+struct _GtpStaticInit
+{
+ CcPanel parent;
+};
+
+G_DEFINE_TYPE (GtpStaticInit, gtp_static_init, CC_TYPE_PANEL)
+
+void
+gtp_static_init_func (void)
+{
+ g_message ("GtpStaticInit: running outside the panel instance");
+}
+
+static void
+gtp_static_init_class_init (GtpStaticInitClass *klass)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/tests/panels/gtp-static-init.ui");
+
+}
+
+static void
+gtp_static_init_init (GtpStaticInit *self)
+{
+ gtk_widget_init_template (GTK_WIDGET (self));
+}
diff --git a/tests/interactive-panels/gtp-static-init.h b/tests/interactive-panels/gtp-static-init.h
new file mode 100644
index 0000000..1dbbea2
--- /dev/null
+++ b/tests/interactive-panels/gtp-static-init.h
@@ -0,0 +1,32 @@
+/* gtp-static-init.h
+ *
+ * Copyright 2018 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <shell/cc-panel.h>
+
+G_BEGIN_DECLS
+
+#define GTP_TYPE_STATIC_INIT (gtp_static_init_get_type())
+G_DECLARE_FINAL_TYPE (GtpStaticInit, gtp_static_init, GTP, STATIC_INIT, CcPanel)
+
+void gtp_static_init_func (void);
+
+G_END_DECLS
diff --git a/tests/interactive-panels/gtp-static-init.ui b/tests/interactive-panels/gtp-static-init.ui
new file mode 100644
index 0000000..32b02a9
--- /dev/null
+++ b/tests/interactive-panels/gtp-static-init.ui
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <template class="GtpStaticInit" parent="CcPanel">
+
+ <child type="content">
+ <object class="AdwStatusPage">
+ <property name="icon_name">view-continuous-symbolic</property>
+ <property name="title">Static Initializer</property>
+ <property name="description">A panel with a static initializer</property>
+ </object>
+ </child>
+
+ </template>
+</interface>
+
diff --git a/tests/interactive-panels/main.c b/tests/interactive-panels/main.c
new file mode 100644
index 0000000..0b0faaa
--- /dev/null
+++ b/tests/interactive-panels/main.c
@@ -0,0 +1,80 @@
+/* main.c
+ *
+ * Copyright 2018 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+#include "shell/cc-application.h"
+#include "shell/cc-panel-loader.h"
+#include "shell/resources.h"
+#include "test-panels-resources.h"
+
+#include "gtp-dynamic-panel.h"
+#include "gtp-header-widget.h"
+#include "gtp-sidebar-widget.h"
+#include "gtp-static-init.h"
+
+/* Test panels */
+static CcPanelLoaderVtable test_panels[] = {
+ { "dynamic-panel", gtp_dynamic_panel_get_type, NULL },
+ { "header-widget", gtp_header_widget_get_type, NULL },
+ { "sidebar-widget", gtp_sidebar_widget_get_type, NULL },
+ { "static-init", gtp_static_init_get_type, gtp_static_init_func },
+ { "toplevel-sidebar-widget", gtp_sidebar_widget_get_type, NULL },
+};
+
+static void
+override_xdg_data_dirs (void)
+{
+ g_autoptr(GString) extended_xdg_data_dirs = NULL;
+ const gchar *xdg_data_dirs;
+
+ extended_xdg_data_dirs = g_string_new (".");
+ xdg_data_dirs = g_getenv ("XDG_DATA_DIRS");
+
+ if (xdg_data_dirs)
+ g_string_append_printf (extended_xdg_data_dirs, ":%s", xdg_data_dirs);
+
+ g_setenv ("XDG_DATA_DIRS", extended_xdg_data_dirs->str, TRUE);
+}
+
+gint
+main (gint argc,
+ gchar *argv[])
+{
+ g_autoptr(GtkApplication) application = NULL;
+
+ /* Manually register GResources */
+ g_resources_register (gnome_control_center_get_resource ());
+ g_resources_register (test_panels_get_resource ());
+
+ /* Override the panels vtable with the test panels */
+ cc_panel_loader_override_vtable (test_panels, G_N_ELEMENTS (test_panels));
+
+ /* Override XDG_DATA_DIRS */
+ override_xdg_data_dirs ();
+
+ application = cc_application_new ();
+
+ return g_application_run (G_APPLICATION (application), argc, argv);
+}
diff --git a/tests/interactive-panels/meson.build b/tests/interactive-panels/meson.build
new file mode 100644
index 0000000..04856ee
--- /dev/null
+++ b/tests/interactive-panels/meson.build
@@ -0,0 +1,49 @@
+subdir('applications')
+
+###########
+# Sources #
+###########
+
+sources = files(
+ 'gtp-dynamic-panel.c',
+ 'gtp-header-widget.c',
+ 'gtp-sidebar-widget.c',
+ 'gtp-static-init.c',
+ 'main.c',
+)
+
+
+##############
+# GResources #
+##############
+
+resource_data = files(
+ 'gtp-dynamic-panel.ui',
+ 'gtp-header-widget.ui',
+ 'gtp-sidebar-widget.ui',
+ 'gtp-static-init.ui',
+)
+
+sources += gnome.compile_resources(
+ 'test-panels-resources',
+ 'panels.gresource.xml',
+ source_dir : '.',
+ c_name : 'test_panels',
+ dependencies : resource_data,
+ export : true,
+)
+
+
+######################
+# interactive-panels #
+######################
+
+includes = [top_inc]
+
+exe = executable(
+ 'test-interactive-panels',
+ sources,
+ include_directories : includes,
+ dependencies : shell_deps + [libtestshell_dep],
+ c_args : cflags
+)
diff --git a/tests/interactive-panels/panels.gresource.xml b/tests/interactive-panels/panels.gresource.xml
new file mode 100644
index 0000000..9fc6605
--- /dev/null
+++ b/tests/interactive-panels/panels.gresource.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/control-center/tests/panels">
+ <file preprocess="xml-stripblanks">gtp-dynamic-panel.ui</file>
+ <file preprocess="xml-stripblanks">gtp-header-widget.ui</file>
+ <file preprocess="xml-stripblanks">gtp-sidebar-widget.ui</file>
+ <file preprocess="xml-stripblanks">gtp-static-init.ui</file>
+ </gresource>
+</gresources>
+