diff --git a/demos/constraint-editor/constraint-editor-application.c b/demos/constraint-editor/constraint-editor-application.c
deleted file mode 100644
index 0eef96ac38..0000000000
--- a/demos/constraint-editor/constraint-editor-application.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright © 2019 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see .
- *
- * Authors: Matthias Clasen
- */
-
-#include "config.h"
-
-#include "constraint-editor-application.h"
-#include "constraint-editor-window.h"
-
-struct _ConstraintEditorApplication
-{
- GtkApplication parent_instance;
-};
-
-G_DEFINE_TYPE(ConstraintEditorApplication, constraint_editor_application, GTK_TYPE_APPLICATION);
-
-static void
-constraint_editor_application_init (ConstraintEditorApplication *app)
-{
-}
-
-static void
-quit_activated (GSimpleAction *action,
- GVariant *parameter,
- gpointer data)
-{
- g_application_quit (G_APPLICATION (data));
-}
-
-static GActionEntry app_entries[] =
-{
- { "quit", quit_activated, NULL, NULL, NULL }
-};
-
-static void
-constraint_editor_application_startup (GApplication *app)
-{
- const char *quit_accels[2] = { "Q", NULL };
- const char *open_accels[2] = { "O", NULL };
- GtkCssProvider *provider;
-
- G_APPLICATION_CLASS (constraint_editor_application_parent_class)->startup (app);
-
- g_action_map_add_action_entries (G_ACTION_MAP (app),
- app_entries, G_N_ELEMENTS (app_entries),
- app);
- gtk_application_set_accels_for_action (GTK_APPLICATION (app), "app.quit", quit_accels);
- gtk_application_set_accels_for_action (GTK_APPLICATION (app), "win.open", open_accels);
-
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_resource (provider, "/org/gtk/gtk4/constraint-editor/constraint-editor.css");
- gtk_style_context_add_provider_for_display (gdk_display_get_default (),
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-}
-
-static void
-constraint_editor_application_activate (GApplication *app)
-{
- ConstraintEditorWindow *win;
-
- win = constraint_editor_window_new (CONSTRAINT_EDITOR_APPLICATION (app));
- gtk_window_present (GTK_WINDOW (win));
-}
-
-static void
-constraint_editor_application_open (GApplication *app,
- GFile **files,
- int n_files,
- const char *hint)
-{
- ConstraintEditorWindow *win;
- int i;
-
- for (i = 0; i < n_files; i++)
- {
- win = constraint_editor_window_new (CONSTRAINT_EDITOR_APPLICATION (app));
- constraint_editor_window_load (win, files[i]);
- gtk_window_present (GTK_WINDOW (win));
- }
-}
-
-static void
-constraint_editor_application_class_init (ConstraintEditorApplicationClass *class)
-{
- GApplicationClass *application_class = G_APPLICATION_CLASS (class);
-
- application_class->startup = constraint_editor_application_startup;
- application_class->activate = constraint_editor_application_activate;
- application_class->open = constraint_editor_application_open;
-}
-
-ConstraintEditorApplication *
-constraint_editor_application_new (void)
-{
- return g_object_new (CONSTRAINT_EDITOR_APPLICATION_TYPE,
- "application-id", "org.gtk.gtk4.ConstraintEditor",
- "flags", G_APPLICATION_HANDLES_OPEN,
- NULL);
-}
diff --git a/demos/constraint-editor/constraint-editor-application.h b/demos/constraint-editor/constraint-editor-application.h
deleted file mode 100644
index c7d9fd3048..0000000000
--- a/demos/constraint-editor/constraint-editor-application.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright © 2019 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see .
- *
- * Authors: Matthias Clasen
- */
-
-#pragma once
-
-#include
-
-#define CONSTRAINT_EDITOR_APPLICATION_TYPE (constraint_editor_application_get_type ())
-
-G_DECLARE_FINAL_TYPE (ConstraintEditorApplication, constraint_editor_application, CONSTRAINT, EDITOR_APPLICATION, GtkApplication)
-
-ConstraintEditorApplication *constraint_editor_application_new (void);
diff --git a/demos/constraint-editor/constraint-editor-window.c b/demos/constraint-editor/constraint-editor-window.c
deleted file mode 100644
index 81eb154d95..0000000000
--- a/demos/constraint-editor/constraint-editor-window.c
+++ /dev/null
@@ -1,652 +0,0 @@
-/*
- * Copyright © 2019 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see .
- *
- * Authors: Matthias Clasen
- */
-
-#include "config.h"
-
-#include "constraint-editor-window.h"
-#include "constraint-view.h"
-#include "constraint-editor.h"
-#include "guide-editor.h"
-
-struct _ConstraintEditorWindow
-{
- GtkApplicationWindow parent_instance;
-
- GtkWidget *paned;
- GtkWidget *view;
- GtkWidget *list;
-};
-
-G_DEFINE_TYPE(ConstraintEditorWindow, constraint_editor_window, GTK_TYPE_APPLICATION_WINDOW);
-
-static GtkConstraintTarget *
-find_target (GListModel *model,
- GtkConstraintTarget *orig)
-{
- const char *name;
- const char *model_name;
- gpointer item;
- int i;
-
- if (orig == NULL)
- return NULL;
-
- if (GTK_IS_LABEL (orig))
- name = gtk_label_get_label (GTK_LABEL (orig));
- else if (GTK_IS_CONSTRAINT_GUIDE (orig))
- name = gtk_constraint_guide_get_name (GTK_CONSTRAINT_GUIDE (orig));
- else
- {
- g_warning ("Don't know how to handle %s targets", G_OBJECT_TYPE_NAME (orig));
- return NULL;
- }
- for (i = 0; i < g_list_model_get_n_items (model); i++)
- {
- item = g_list_model_get_item (model, i);
- g_object_unref (item);
- if (GTK_IS_WIDGET (item))
- model_name = gtk_widget_get_name (GTK_WIDGET (item));
- else
- model_name = gtk_constraint_guide_get_name (GTK_CONSTRAINT_GUIDE (item));
-
- if (strcmp (name, model_name) == 0)
- return GTK_CONSTRAINT_TARGET (item);
- }
- g_warning ("Failed to find target '%s'", name);
-
- return NULL;
-}
-
-gboolean
-constraint_editor_window_load (ConstraintEditorWindow *self,
- GFile *file)
-{
- char *path;
- GtkBuilder *builder;
- GError *error = NULL;
- GtkWidget *view;
- GtkLayoutManager *layout;
- GtkWidget *child;
- const char *name;
- gpointer item;
- int i;
- GListModel *list;
-
- path = g_file_get_path (file);
-
- builder = gtk_builder_new ();
- if (!gtk_builder_add_from_file (builder, path, &error))
- {
- g_print ("Could not load %s: %s", path, error->message);
- g_error_free (error);
- g_free (path);
- g_object_unref (builder);
- return FALSE;
- }
-
- view = GTK_WIDGET (gtk_builder_get_object (builder, "view"));
- if (!GTK_IS_BOX (view))
- {
- g_print ("Could not load %s: No GtkBox named 'view'", path);
- g_free (path);
- g_object_unref (builder);
- return FALSE;
- }
- layout = gtk_widget_get_layout_manager (view);
- if (!GTK_IS_CONSTRAINT_LAYOUT (layout))
- {
- g_print ("Could not load %s: Widget 'view' does not use GtkConstraintLayout", path);
- g_free (path);
- g_object_unref (builder);
- return FALSE;
- }
-
- for (child = gtk_widget_get_first_child (view);
- child;
- child = gtk_widget_get_next_sibling (child))
- {
- if (!GTK_IS_LABEL (child))
- {
- g_print ("Skipping non-GtkLabel child\n");
- continue;
- }
-
- name = gtk_label_get_label (GTK_LABEL (child));
- constraint_view_add_child (CONSTRAINT_VIEW (self->view), name);
- }
-
- list = gtk_constraint_layout_observe_guides (GTK_CONSTRAINT_LAYOUT (layout));
- for (i = 0; i < g_list_model_get_n_items (list); i++)
- {
- GtkConstraintGuide *guide, *clone;
- int w, h;
-
- item = g_list_model_get_item (list, i);
- guide = GTK_CONSTRAINT_GUIDE (item);
-
- /* need to clone here, to attach to the right targets */
- clone = gtk_constraint_guide_new ();
- gtk_constraint_guide_set_name (clone, gtk_constraint_guide_get_name (guide));
- gtk_constraint_guide_set_strength (clone, gtk_constraint_guide_get_strength (guide));
- gtk_constraint_guide_get_min_size (guide, &w, &h);
- gtk_constraint_guide_set_min_size (clone, w, h);
- gtk_constraint_guide_get_nat_size (guide, &w, &h);
- gtk_constraint_guide_set_nat_size (clone, w, h);
- gtk_constraint_guide_get_max_size (guide, &w, &h);
- gtk_constraint_guide_set_max_size (clone, w, h);
- constraint_view_add_guide (CONSTRAINT_VIEW (self->view), clone);
- g_object_unref (guide);
- g_object_unref (clone);
- }
- g_object_unref (list);
-
- list = gtk_constraint_layout_observe_constraints (GTK_CONSTRAINT_LAYOUT (layout));
- for (i = 0; i < g_list_model_get_n_items (list); i++)
- {
- GtkConstraint *constraint;
- GtkConstraint *clone;
- GtkConstraintTarget *target;
- GtkConstraintTarget *source;
- GtkConstraintAttribute source_attr;
-
- item = g_list_model_get_item (list, i);
- constraint = GTK_CONSTRAINT (item);
-
- target = gtk_constraint_get_target (constraint);
- source = gtk_constraint_get_source (constraint);
- source_attr = gtk_constraint_get_source_attribute (constraint);
-
- if (source == NULL && source_attr == GTK_CONSTRAINT_ATTRIBUTE_NONE)
- clone = gtk_constraint_new_constant (find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), target),
- gtk_constraint_get_target_attribute (constraint),
- gtk_constraint_get_relation (constraint),
- gtk_constraint_get_constant (constraint),
- gtk_constraint_get_strength (constraint));
- else
- clone = gtk_constraint_new (find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), target),
- gtk_constraint_get_target_attribute (constraint),
- gtk_constraint_get_relation (constraint),
- find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), source),
- source_attr,
- gtk_constraint_get_multiplier (constraint),
- gtk_constraint_get_constant (constraint),
- gtk_constraint_get_strength (constraint));
-
- constraint_view_add_constraint (CONSTRAINT_VIEW (self->view), clone);
-
- g_object_unref (constraint);
- g_object_unref (clone);
- }
- g_object_unref (list);
-
- g_free (path);
- g_object_unref (builder);
-
- return TRUE;
-}
-
-static void
-open_response_cb (GObject *source,
- GAsyncResult *result,
- void *user_data)
-{
- GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
- ConstraintEditorWindow *self = user_data;
- GFile *file;
-
- file = gtk_file_dialog_open_finish (dialog, result, NULL);
- if (file)
- {
- constraint_editor_window_load (self, file);
- g_object_unref (file);
- }
-}
-
-static void
-open_cb (GtkWidget *button,
- ConstraintEditorWindow *self)
-{
- GtkFileDialog *dialog;
- GFile *cwd;
-
- dialog = gtk_file_dialog_new ();
- gtk_file_dialog_set_title (dialog, "Open file");
- cwd = g_file_new_for_path (".");
- gtk_file_dialog_set_initial_folder (dialog, cwd);
- g_object_unref (cwd);
- gtk_file_dialog_open (dialog, GTK_WINDOW (self), NULL, open_response_cb, self);
- g_object_unref (dialog);
-}
-
-static void
-serialize_child (GString *str,
- int indent,
- GtkWidget *child)
-{
- const char *name;
-
- name = gtk_widget_get_name (child);
- g_string_append_printf (str, "%*s\n", indent, "");
- g_string_append_printf (str, "%*s \n", indent, "");
- g_string_append_printf (str, "%*s\n", indent, "");
-}
-
-static char *
-serialize_model (GListModel *list)
-{
- GString *str = g_string_new ("");
- int i;
-
- g_string_append (str, "\n");
- g_string_append (str, " \n");
- g_string_append (str, "\n");
-
- return g_string_free (str, FALSE);
-}
-
-
-static void
-save_response_cb (GObject *source,
- GAsyncResult *result,
- void *user_data)
-{
- GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
- ConstraintEditorWindow *self = user_data;
- GFile *file;
-
- file = gtk_file_dialog_save_finish (dialog, result, NULL);
- if (file)
- {
- GListModel *model;
- char *text;
- GError *error = NULL;
-
- model = constraint_view_get_model (CONSTRAINT_VIEW (self->view));
- text = serialize_model (model);
- g_file_replace_contents (file, text, strlen (text),
- NULL, FALSE,
- G_FILE_CREATE_NONE,
- NULL,
- NULL,
- &error);
- if (error != NULL)
- {
- GtkAlertDialog *alert;
-
- alert = gtk_alert_dialog_new ("Saving failed");
- gtk_alert_dialog_set_detail (alert, error->message);
- gtk_alert_dialog_show (alert,
- GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))));
- g_object_unref (alert);
- g_error_free (error);
- }
-
- g_free (text);
- g_object_unref (file);
- }
-}
-
-static void
-save_cb (GtkWidget *button,
- ConstraintEditorWindow *self)
-{
- GtkFileDialog *dialog;
- GFile *cwd;
-
- dialog = gtk_file_dialog_new ();
- gtk_file_dialog_set_title (dialog, "Save constraints");
- cwd = g_file_new_for_path (".");
- gtk_file_dialog_set_initial_folder (dialog, cwd);
- g_object_unref (cwd);
- gtk_file_dialog_save (dialog,
- GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
- NULL,
- save_response_cb, self);
- g_object_unref (dialog);
-}
-
-static void
-constraint_editor_window_dispose (GObject *object)
-{
- gtk_widget_dispose_template (GTK_WIDGET (object), CONSTRAINT_EDITOR_WINDOW_TYPE);
-
- G_OBJECT_CLASS (constraint_editor_window_parent_class)->dispose (object);
-}
-
-static int child_counter;
-static int guide_counter;
-
-static void
-add_child (ConstraintEditorWindow *win)
-{
- char *name;
-
- child_counter++;
- name = g_strdup_printf ("Child %d", child_counter);
- constraint_view_add_child (CONSTRAINT_VIEW (win->view), name);
- g_free (name);
-}
-
-static void
-add_guide (ConstraintEditorWindow *win)
-{
- char *name;
- GtkConstraintGuide *guide;
-
- guide_counter++;
- name = g_strdup_printf ("Guide %d", guide_counter);
- guide = gtk_constraint_guide_new ();
- gtk_constraint_guide_set_name (guide, name);
- g_free (name);
-
- constraint_view_add_guide (CONSTRAINT_VIEW (win->view), guide);
-}
-
-static void
-constraint_editor_done (ConstraintEditor *editor,
- GtkConstraint *constraint,
- ConstraintEditorWindow *win)
-{
- GtkConstraint *old_constraint;
-
- g_object_get (editor, "constraint", &old_constraint, NULL);
-
- if (old_constraint)
- constraint_view_remove_constraint (CONSTRAINT_VIEW (win->view), old_constraint);
-
- constraint_view_add_constraint (CONSTRAINT_VIEW (win->view), constraint);
-
- g_clear_object (&old_constraint);
-
- gtk_window_destroy (GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (editor), GTK_TYPE_WINDOW)));
-}
-
-static void
-edit_constraint (ConstraintEditorWindow *win,
- GtkConstraint *constraint)
-{
- GtkWidget *window;
- ConstraintEditor *editor;
- GListModel *model;
-
- window = gtk_window_new ();
- gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (win));
- gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
- if (constraint)
- gtk_window_set_title (GTK_WINDOW (window), "Edit Constraint");
- else
- gtk_window_set_title (GTK_WINDOW (window), "Create Constraint");
-
- model = constraint_view_get_model (CONSTRAINT_VIEW (win->view));
-
- editor = constraint_editor_new (model, constraint);
-
- gtk_window_set_child (GTK_WINDOW (window), GTK_WIDGET (editor));
-
- g_signal_connect (editor, "done", G_CALLBACK (constraint_editor_done), win);
-
- gtk_window_present (GTK_WINDOW (window));
-}
-
-static void
-add_constraint (ConstraintEditorWindow *win)
-{
- edit_constraint (win, NULL);
-}
-
-static void
-guide_editor_done (GuideEditor *editor,
- GtkConstraintGuide *guide,
- ConstraintEditorWindow *win)
-{
- gtk_window_destroy (GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (editor), GTK_TYPE_WINDOW)));
-}
-
-static void
-edit_guide (ConstraintEditorWindow *win,
- GtkConstraintGuide *guide)
-{
- GtkWidget *window;
- GuideEditor *editor;
-
- window = gtk_window_new ();
- gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
- gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (win));
- gtk_window_set_title (GTK_WINDOW (window), "Edit Guide");
-
- editor = guide_editor_new (guide);
- gtk_window_set_child (GTK_WINDOW (window), GTK_WIDGET (editor));
-
- g_signal_connect (editor, "done", G_CALLBACK (guide_editor_done), win);
- gtk_window_present (GTK_WINDOW (window));
-}
-
-static void
-row_activated (GtkListBox *list,
- GtkListBoxRow *row,
- ConstraintEditorWindow *win)
-{
- GObject *item;
-
- item = G_OBJECT (g_object_get_data (G_OBJECT (row), "item"));
-
- if (GTK_IS_CONSTRAINT (item))
- edit_constraint (win, GTK_CONSTRAINT (item));
- else if (GTK_IS_CONSTRAINT_GUIDE (item))
- edit_guide (win, GTK_CONSTRAINT_GUIDE (item));
-}
-
-static void
-constraint_editor_window_class_init (ConstraintEditorWindowClass *class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
-
- g_type_ensure (CONSTRAINT_VIEW_TYPE);
-
- object_class->dispose = constraint_editor_window_dispose;
-
- gtk_widget_class_set_template_from_resource (widget_class,
- "/org/gtk/gtk4/constraint-editor/constraint-editor-window.ui");
-
- gtk_widget_class_bind_template_child (widget_class, ConstraintEditorWindow, paned);
- gtk_widget_class_bind_template_child (widget_class, ConstraintEditorWindow, view);
- gtk_widget_class_bind_template_child (widget_class, ConstraintEditorWindow, list);
-
- gtk_widget_class_bind_template_callback (widget_class, open_cb);
- gtk_widget_class_bind_template_callback (widget_class, save_cb);
- gtk_widget_class_bind_template_callback (widget_class, add_child);
- gtk_widget_class_bind_template_callback (widget_class, add_guide);
- gtk_widget_class_bind_template_callback (widget_class, add_constraint);
- gtk_widget_class_bind_template_callback (widget_class, row_activated);
-}
-
-static void
-row_edit (GtkButton *button,
- ConstraintEditorWindow *win)
-{
- GtkWidget *row;
- GObject *item;
-
- row = gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_LIST_BOX_ROW);
- item = (GObject *)g_object_get_data (G_OBJECT (row), "item");
- if (GTK_IS_CONSTRAINT (item))
- edit_constraint (win, GTK_CONSTRAINT (item));
- else if (GTK_IS_CONSTRAINT_GUIDE (item))
- edit_guide (win, GTK_CONSTRAINT_GUIDE (item));
-}
-
-static void
-mark_constraints_invalid (ConstraintEditorWindow *win,
- gpointer removed)
-{
- GtkWidget *child;
- GObject *item;
-
- for (child = gtk_widget_get_first_child (win->list);
- child;
- child = gtk_widget_get_next_sibling (child))
- {
- item = (GObject *)g_object_get_data (G_OBJECT (child), "item");
- if (GTK_IS_CONSTRAINT (item))
- {
- GtkConstraint *constraint = GTK_CONSTRAINT (item);
-
- if (gtk_constraint_get_target (constraint) == (GtkConstraintTarget *)removed ||
- gtk_constraint_get_source (constraint) == (GtkConstraintTarget *)removed)
- {
- GtkWidget *button;
- button = (GtkWidget *)g_object_get_data (G_OBJECT (child), "edit");
- gtk_button_set_icon_name (GTK_BUTTON (button), "dialog-warning-symbolic");
- gtk_widget_set_tooltip_text (button, "Constraint is invalid");
- }
- }
- }
-}
-
-static void
-row_delete (GtkButton *button,
- ConstraintEditorWindow *win)
-{
- GtkWidget *row;
- GObject *item;
-
- row = gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_LIST_BOX_ROW);
- item = (GObject *)g_object_get_data (G_OBJECT (row), "item");
- if (GTK_IS_CONSTRAINT (item))
- constraint_view_remove_constraint (CONSTRAINT_VIEW (win->view),
- GTK_CONSTRAINT (item));
- else if (GTK_IS_CONSTRAINT_GUIDE (item))
- {
- mark_constraints_invalid (win, item);
- constraint_view_remove_guide (CONSTRAINT_VIEW (win->view),
- GTK_CONSTRAINT_GUIDE (item));
- }
- else if (GTK_IS_WIDGET (item))
- {
- mark_constraints_invalid (win, item);
- constraint_view_remove_child (CONSTRAINT_VIEW (win->view),
- GTK_WIDGET (item));
- }
-}
-
-static GtkWidget *
-create_widget_func (gpointer item,
- gpointer user_data)
-{
- ConstraintEditorWindow *win = user_data;
- const char *name;
- char *freeme = NULL;
- GtkWidget *row, *box, *label, *button;
-
- if (GTK_IS_WIDGET (item))
- name = gtk_widget_get_name (GTK_WIDGET (item));
- else if (GTK_IS_CONSTRAINT_GUIDE (item))
- name = gtk_constraint_guide_get_name (GTK_CONSTRAINT_GUIDE (item));
- else if (GTK_IS_CONSTRAINT (item))
- name = freeme = constraint_editor_constraint_to_string (GTK_CONSTRAINT (item));
- else
- name = "";
-
- row = gtk_list_box_row_new ();
- g_object_set_data_full (G_OBJECT (row), "item", g_object_ref (item), g_object_unref);
- box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- label = gtk_label_new (name);
- if (GTK_IS_WIDGET (item) || GTK_IS_CONSTRAINT_GUIDE (item))
- g_object_bind_property (item, "name",
- label, "label",
- G_BINDING_DEFAULT);
- gtk_widget_set_margin_start (label, 10);
- gtk_widget_set_margin_end (label, 10);
- gtk_widget_set_margin_top (label, 10);
- gtk_widget_set_margin_bottom (label, 10);
- gtk_label_set_xalign (GTK_LABEL (label), 0.0);
- gtk_widget_set_hexpand (label, TRUE);
- gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
- gtk_box_append (GTK_BOX (box), label);
-
- if (GTK_IS_CONSTRAINT (item) || GTK_IS_CONSTRAINT_GUIDE (item))
- {
- button = gtk_button_new_from_icon_name ("document-edit-symbolic");
- gtk_button_set_has_frame (GTK_BUTTON (button), FALSE);
- g_signal_connect (button, "clicked", G_CALLBACK (row_edit), win);
- g_object_set_data (G_OBJECT (row), "edit", button);
- gtk_box_append (GTK_BOX (box), button);
- button = gtk_button_new_from_icon_name ("edit-delete-symbolic");
- gtk_button_set_has_frame (GTK_BUTTON (button), FALSE);
- g_signal_connect (button, "clicked", G_CALLBACK (row_delete), win);
- gtk_box_append (GTK_BOX (box), button);
- }
- else if (GTK_IS_WIDGET (item))
- {
- button = gtk_button_new_from_icon_name ("edit-delete-symbolic");
- gtk_button_set_has_frame (GTK_BUTTON (button), FALSE);
- g_signal_connect (button, "clicked", G_CALLBACK (row_delete), win);
- gtk_box_append (GTK_BOX (box), button);
- }
-
- g_free (freeme);
-
- return row;
-}
-
-static void
-constraint_editor_window_init (ConstraintEditorWindow *self)
-{
- gtk_widget_init_template (GTK_WIDGET (self));
-
- gtk_list_box_bind_model (GTK_LIST_BOX (self->list),
- constraint_view_get_model (CONSTRAINT_VIEW (self->view)),
- create_widget_func,
- self,
- NULL);
-}
-
-ConstraintEditorWindow *
-constraint_editor_window_new (ConstraintEditorApplication *application)
-{
- return g_object_new (CONSTRAINT_EDITOR_WINDOW_TYPE,
- "application", application,
- NULL);
-}
diff --git a/demos/constraint-editor/constraint-editor-window.h b/demos/constraint-editor/constraint-editor-window.h
deleted file mode 100644
index 9096c6e71d..0000000000
--- a/demos/constraint-editor/constraint-editor-window.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright © 2019 Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see .
- *
- * Authors: Matthias Clasen
- */
-
-#pragma once
-
-#include
-
-#include "constraint-editor-application.h"
-
-
-#define CONSTRAINT_EDITOR_WINDOW_TYPE (constraint_editor_window_get_type ())
-
-G_DECLARE_FINAL_TYPE (ConstraintEditorWindow, constraint_editor_window, CONSTRAINT, EDITOR_WINDOW, GtkApplicationWindow)
-
-ConstraintEditorWindow * constraint_editor_window_new (ConstraintEditorApplication *application);
-
-gboolean constraint_editor_window_load (ConstraintEditorWindow *self,
- GFile *file);
diff --git a/demos/constraint-editor/constraint-editor-window.ui b/demos/constraint-editor/constraint-editor-window.ui
deleted file mode 100644
index fab5b8d1d4..0000000000
--- a/demos/constraint-editor/constraint-editor-window.ui
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
- GTK Constraint Editor
- 1024
- 768
-
-
-
-
-
- horizontal
-
-
- vertical
-
-
- horizontal
-
-
- Add Child
-
-
-
-
-
- Add Guide
-
-
-
-
-
- Add Constraint
-
-
-
-
-
-
-
- never
- automatic
- 1
-
-
- 1
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demos/constraint-editor/constraint-editor.c b/demos/constraint-editor/constraint-editor.c
deleted file mode 100644
index 23e609ba55..0000000000
--- a/demos/constraint-editor/constraint-editor.c
+++ /dev/null
@@ -1,716 +0,0 @@
-/*
- * Copyright © 2019 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see .
- *
- * Authors: Matthias Clasen
- */
-
-#include "config.h"
-
-#include "constraint-editor.h"
-#include "constraint-view.h"
-
-struct _ConstraintEditor
-{
- GtkWidget parent_instance;
-
- GtkWidget *grid;
- GtkWidget *target;
- GtkWidget *target_attr;
- GtkWidget *relation;
- GtkWidget *source;
- GtkWidget *source_attr;
- GtkWidget *multiplier;
- GtkWidget *constant;
- GtkWidget *strength;
- GtkWidget *preview;
- GtkWidget *button;
-
- GtkConstraint *constraint;
- GListModel *model;
-
- gboolean constructed;
-};
-
-enum {
- PROP_MODEL = 1,
- PROP_CONSTRAINT,
- LAST_PROP
-};
-
-static GParamSpec *pspecs[LAST_PROP];
-
-enum {
- DONE,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL];
-
-G_DEFINE_TYPE(ConstraintEditor, constraint_editor, GTK_TYPE_WIDGET);
-
-static const char *
-get_target_name (GtkConstraintTarget *target)
-{
- if (target == NULL)
- return "Super";
- else if (GTK_IS_WIDGET (target))
- return gtk_widget_get_name (GTK_WIDGET (target));
- else if (GTK_IS_CONSTRAINT_GUIDE (target))
- return gtk_constraint_guide_get_name (GTK_CONSTRAINT_GUIDE (target));
- else
- return "";
-}
-
-static void
-constraint_target_combo (GListModel *model,
- GtkWidget *combo,
- gboolean is_source)
-{
- GtkStringList *targets;
- int i;
-
- targets = gtk_string_list_new (NULL);
-
- gtk_string_list_append (targets, "Super");
-
- if (model)
- {
- for (i = 0; i < g_list_model_get_n_items (model); i++)
- {
- GObject *item = g_list_model_get_object (model, i);
-
- if (GTK_IS_CONSTRAINT (item))
- continue;
-
- gtk_string_list_append (targets, get_target_name (GTK_CONSTRAINT_TARGET (item)));
- g_object_unref (item);
- }
- }
-
- gtk_drop_down_set_model (GTK_DROP_DOWN (combo), G_LIST_MODEL (targets));
- g_object_unref (targets);
-}
-
-static gpointer
-get_target (GListModel *model,
- const char *id)
-{
- int i;
-
- if (id == NULL)
- return NULL;
-
- if (strcmp ("Super", id) == 0)
- return NULL;
-
- for (i = 0; i < g_list_model_get_n_items (model); i++)
- {
- GObject *item = g_list_model_get_object (model, i);
- g_object_unref (item);
- if (GTK_IS_CONSTRAINT (item))
- continue;
- else if (GTK_IS_WIDGET (item))
- {
- if (strcmp (id, gtk_widget_get_name (GTK_WIDGET (item))) == 0)
- return item;
- }
- else if (GTK_IS_CONSTRAINT_GUIDE (item))
- {
- if (strcmp (id, gtk_constraint_guide_get_name (GTK_CONSTRAINT_GUIDE (item))) == 0)
- return item;
- }
- }
-
- return NULL;
-}
-
-static void
-select_target (GtkDropDown *combo,
- const char *target_name)
-{
- GListModel *model = gtk_drop_down_get_model (combo);
-
- for (unsigned int i = 0; i < g_list_model_get_n_items (model); i++)
- {
- GtkStringObject *s = g_list_model_get_item (model, i);
-
- g_object_unref (s);
- if (strcmp (target_name, gtk_string_object_get_string (s)) == 0)
- {
- gtk_drop_down_set_selected (GTK_DROP_DOWN (combo), i);
- return;
- }
- }
-}
-
-static GtkConstraintAttribute
-get_attr (unsigned int id)
-{
- switch (id)
- {
- case 0: return GTK_CONSTRAINT_ATTRIBUTE_NONE;
- case 1: return GTK_CONSTRAINT_ATTRIBUTE_LEFT;
- case 2: return GTK_CONSTRAINT_ATTRIBUTE_RIGHT;
- case 3: return GTK_CONSTRAINT_ATTRIBUTE_TOP;
- case 4: return GTK_CONSTRAINT_ATTRIBUTE_BOTTOM;
- case 5: return GTK_CONSTRAINT_ATTRIBUTE_START;
- case 6: return GTK_CONSTRAINT_ATTRIBUTE_END;
- case 7: return GTK_CONSTRAINT_ATTRIBUTE_WIDTH;
- case 8: return GTK_CONSTRAINT_ATTRIBUTE_HEIGHT;
- case 9: return GTK_CONSTRAINT_ATTRIBUTE_CENTER_X;
- case 10: return GTK_CONSTRAINT_ATTRIBUTE_CENTER_Y;
- case 11: return GTK_CONSTRAINT_ATTRIBUTE_BASELINE;
- default: g_assert_not_reached ();
- }
-}
-
-static unsigned int
-get_attr_id (GtkConstraintAttribute attr)
-{
- switch (attr)
- {
- case GTK_CONSTRAINT_ATTRIBUTE_NONE: return 0;
- case GTK_CONSTRAINT_ATTRIBUTE_LEFT: return 1;
- case GTK_CONSTRAINT_ATTRIBUTE_RIGHT: return 2;
- case GTK_CONSTRAINT_ATTRIBUTE_TOP: return 3;
- case GTK_CONSTRAINT_ATTRIBUTE_BOTTOM: return 4;
- case GTK_CONSTRAINT_ATTRIBUTE_START: return 5;
- case GTK_CONSTRAINT_ATTRIBUTE_END: return 6;
- case GTK_CONSTRAINT_ATTRIBUTE_WIDTH: return 7;
- case GTK_CONSTRAINT_ATTRIBUTE_HEIGHT: return 8;
- case GTK_CONSTRAINT_ATTRIBUTE_CENTER_X: return 9;
- case GTK_CONSTRAINT_ATTRIBUTE_CENTER_Y: return 10;
- case GTK_CONSTRAINT_ATTRIBUTE_BASELINE: return 11;
- default: g_assert_not_reached ();
- }
-}
-
-static const char *
-get_attr_nick (GtkConstraintAttribute attr)
-{
- GEnumClass *class = g_type_class_ref (GTK_TYPE_CONSTRAINT_ATTRIBUTE);
- GEnumValue *value = g_enum_get_value (class, attr);
- const char *nick = value->value_nick;
- g_type_class_unref (class);
-
- return nick;
-}
-
-static GtkConstraintRelation
-get_relation (unsigned int id)
-{
- switch (id)
- {
- case 0: return GTK_CONSTRAINT_RELATION_LE;
- case 1: return GTK_CONSTRAINT_RELATION_EQ;
- case 2: return GTK_CONSTRAINT_RELATION_GE;
- default: g_assert_not_reached ();
- }
-}
-
-static unsigned int
-get_relation_id (GtkConstraintRelation relation)
-{
- switch (relation)
- {
- case GTK_CONSTRAINT_RELATION_LE: return 0;
- case GTK_CONSTRAINT_RELATION_EQ: return 1;
- case GTK_CONSTRAINT_RELATION_GE: return 2;
- default: g_assert_not_reached ();
- }
-}
-
-static const char *
-get_relation_nick (GtkConstraintRelation relation)
-{
- GEnumClass *class = g_type_class_ref (GTK_TYPE_CONSTRAINT_RELATION);
- GEnumValue *value = g_enum_get_value (class, relation);
- const char *nick = value->value_nick;
- g_type_class_unref (class);
-
- return nick;
-}
-
-static const char *
-get_relation_display_name (GtkConstraintRelation relation)
-{
- switch (relation)
- {
- case GTK_CONSTRAINT_RELATION_LE:
- return "≤";
- case GTK_CONSTRAINT_RELATION_EQ:
- return "=";
- case GTK_CONSTRAINT_RELATION_GE:
- return "≥";
- default:
- return "?";
- }
-}
-
-static GtkConstraintStrength
-get_strength (unsigned int id)
-{
- switch (id)
- {
- case 0: return GTK_CONSTRAINT_STRENGTH_WEAK;
- case 1: return GTK_CONSTRAINT_STRENGTH_MEDIUM;
- case 2: return GTK_CONSTRAINT_STRENGTH_STRONG;
- case 3: return GTK_CONSTRAINT_STRENGTH_REQUIRED;
- default: g_assert_not_reached ();
- }
-}
-
-static unsigned int
-get_strength_id (GtkConstraintStrength strength)
-{
- switch (strength)
- {
- case GTK_CONSTRAINT_STRENGTH_WEAK: return 0;
- case GTK_CONSTRAINT_STRENGTH_MEDIUM: return 1;
- case GTK_CONSTRAINT_STRENGTH_STRONG: return 2;
- case GTK_CONSTRAINT_STRENGTH_REQUIRED: return 3;
- default: g_assert_not_reached ();
- }
-}
-
-static const char *
-get_strength_nick (GtkConstraintStrength strength)
-{
- GEnumClass *class = g_type_class_ref (GTK_TYPE_CONSTRAINT_STRENGTH);
- GEnumValue *value = g_enum_get_value (class, strength);
- const char *nick = value->value_nick;
- g_type_class_unref (class);
-
- return nick;
-}
-
-void
-constraint_editor_serialize_constraint (GString *str,
- int indent,
- GtkConstraint *constraint)
-{
- const char *target;
- const char *target_attr;
- const char *relation;
- const char *source;
- const char *source_attr;
- double multiplier;
- double constant;
- const char *strength;
-
- target = get_target_name (gtk_constraint_get_target (constraint));
- target_attr = get_attr_nick (gtk_constraint_get_target_attribute (constraint));
- relation = get_relation_nick (gtk_constraint_get_relation (constraint));
- source = get_target_name (gtk_constraint_get_source (constraint));
- source_attr = get_attr_nick (gtk_constraint_get_source_attribute (constraint));
- multiplier = gtk_constraint_get_multiplier (constraint);
- constant = gtk_constraint_get_constant (constraint);
- strength = get_strength_nick (gtk_constraint_get_strength (constraint));
-
- g_string_append_printf (str, "%*s\n", indent, "", strength);
-}
-
-static void
-create_constraint (GtkButton *button,
- ConstraintEditor *editor)
-{
- gpointer obj;
- gpointer target;
- GtkConstraintAttribute target_attr;
- gpointer source;
- GtkConstraintAttribute source_attr;
- GtkConstraintRelation relation;
- double multiplier;
- double constant;
- int strength;
- GtkConstraint *constraint;
-
- obj = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (editor->target));
- if (obj)
- target = get_target (editor->model, gtk_string_object_get_string (GTK_STRING_OBJECT (obj)));
- else
- target = NULL;
- target_attr = get_attr (gtk_drop_down_get_selected (GTK_DROP_DOWN (editor->target_attr)));
-
- obj = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (editor->source));
- if (obj)
- source = get_target (editor->model, gtk_string_object_get_string (GTK_STRING_OBJECT (obj)));
- else
- source = NULL;
- source_attr = get_attr (gtk_drop_down_get_selected (GTK_DROP_DOWN(editor->source_attr)));
-
- relation = get_relation (gtk_drop_down_get_selected (GTK_DROP_DOWN (editor->relation)));
-
- multiplier = g_ascii_strtod (gtk_editable_get_text (GTK_EDITABLE (editor->multiplier)), NULL);
-
- constant = g_ascii_strtod (gtk_editable_get_text (GTK_EDITABLE (editor->constant)), NULL);
-
- strength = get_strength (gtk_drop_down_get_selected (GTK_DROP_DOWN (editor->strength)));
-
- constraint = gtk_constraint_new (target, target_attr,
- relation,
- source, source_attr,
- multiplier,
- constant,
- strength);
- g_signal_emit (editor, signals[DONE], 0, constraint);
- g_object_unref (constraint);
-}
-
-static void
-source_attr_changed (ConstraintEditor *editor)
-{
- if (get_attr (gtk_drop_down_get_selected (GTK_DROP_DOWN (editor->source_attr))) == GTK_CONSTRAINT_ATTRIBUTE_NONE)
- {
- gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->source), GTK_INVALID_LIST_POSITION);
- gtk_editable_set_text (GTK_EDITABLE (editor->multiplier), "");
- gtk_widget_set_sensitive (editor->source, FALSE);
- gtk_widget_set_sensitive (editor->multiplier, FALSE);
- }
- else
- {
- gtk_widget_set_sensitive (editor->source, TRUE);
- gtk_widget_set_sensitive (editor->multiplier, TRUE);
- gtk_editable_set_text (GTK_EDITABLE (editor->multiplier), "1");
- }
-}
-
-char *
-constraint_editor_constraint_to_string (GtkConstraint *constraint)
-{
- GString *str;
- const char *name;
- const char *attr;
- const char *relation;
- double c, m;
-
- str = g_string_new ("");
-
- name = get_target_name (gtk_constraint_get_target (constraint));
- attr = get_attr_nick (gtk_constraint_get_target_attribute (constraint));
- relation = get_relation_display_name (gtk_constraint_get_relation (constraint));
-
- if (name == NULL)
- name = "[ ]";
-
- g_string_append_printf (str, "%s.%s %s ", name, attr, relation);
-
- c = gtk_constraint_get_constant (constraint);
-
- attr = get_attr_nick (gtk_constraint_get_source_attribute (constraint));
- if (strcmp (attr, "none") != 0)
- {
- name = get_target_name (gtk_constraint_get_source (constraint));
- m = gtk_constraint_get_multiplier (constraint);
-
- if (name == NULL)
- name = "[ ]";
-
- g_string_append_printf (str, "%s.%s", name, attr);
-
- if (m != 1.0)
- g_string_append_printf (str, " × %g", m);
-
- if (c > 0.0)
- g_string_append_printf (str, " + %g", c);
- else if (c < 0.0)
- g_string_append_printf (str, " - %g", -c);
- }
- else
- g_string_append_printf (str, "%g", c);
-
- return g_string_free (str, FALSE);
-}
-
-static void
-update_preview (ConstraintEditor *editor)
-{
- GString *str;
- const char *name;
- const char *attr;
- const char *relation;
- const char *multiplier;
- const char *constant;
- double c, m;
-
- if (!editor->constructed)
- return;
-
- str = g_string_new ("");
-
- name = gtk_string_object_get_string (GTK_STRING_OBJECT (gtk_drop_down_get_selected_item (GTK_DROP_DOWN (editor->target))));
- attr = get_attr_nick (get_attr (gtk_drop_down_get_selected ((GTK_DROP_DOWN (editor->target_attr)))));
- relation = get_relation_nick (get_relation (gtk_drop_down_get_selected (GTK_DROP_DOWN (editor->relation))));
-
- if (name == NULL)
- name = "[ ]";
-
- g_string_append_printf (str, "%s.%s %s ", name, attr, relation);
-
- constant = gtk_editable_get_text (GTK_EDITABLE (editor->constant));
- c = g_ascii_strtod (constant, NULL);
-
- attr = get_attr_nick (get_attr (gtk_drop_down_get_selected (GTK_DROP_DOWN (editor->source_attr))));
- if (strcmp (attr, "none") != 0)
- {
- name = gtk_string_object_get_string (GTK_STRING_OBJECT (gtk_drop_down_get_selected_item (GTK_DROP_DOWN (editor->source))));
- multiplier = gtk_editable_get_text (GTK_EDITABLE (editor->multiplier));
- m = g_ascii_strtod (multiplier, NULL);
-
- if (name == NULL)
- name = "[ ]";
-
- g_string_append_printf (str, "%s.%s", name, attr);
-
- if (m != 1.0)
- g_string_append_printf (str, " × %g", m);
-
- if (c > 0.0)
- g_string_append_printf (str, " + %g", c);
- else if (c < 0.0)
- g_string_append_printf (str, " - %g", -c);
- }
- else
- g_string_append_printf (str, "%g", c);
-
- gtk_label_set_label (GTK_LABEL (editor->preview), str->str);
-
- g_string_free (str, TRUE);
-}
-
-static void
-update_button (ConstraintEditor *editor)
-{
- gpointer obj;
- const char *target;
- const char *source;
- GtkConstraintAttribute source_attr = get_attr (gtk_drop_down_get_selected (GTK_DROP_DOWN (editor->source_attr)));
-
- obj = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (editor->target));
- target = obj ? gtk_string_object_get_string (GTK_STRING_OBJECT (obj)) : NULL;
-
- obj = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (editor->source));
- source = obj ? gtk_string_object_get_string (GTK_STRING_OBJECT (obj)) : NULL;
-
- if (target && (source || (source_attr == GTK_CONSTRAINT_ATTRIBUTE_NONE)))
- gtk_widget_set_sensitive (editor->button, TRUE);
- else
- gtk_widget_set_sensitive (editor->button, FALSE);
-}
-
-static void
-constraint_editor_init (ConstraintEditor *editor)
-{
- gtk_widget_init_template (GTK_WIDGET (editor));
-}
-
-static void
-constraint_editor_constructed (GObject *object)
-{
- ConstraintEditor *editor = CONSTRAINT_EDITOR (object);
-
- constraint_target_combo (editor->model, editor->target, FALSE);
- constraint_target_combo (editor->model, editor->source, TRUE);
-
- if (editor->constraint)
- {
- GtkConstraintTarget *target;
- GtkConstraintAttribute attr;
- GtkConstraintRelation relation;
- GtkConstraintStrength strength;
- char *val;
- double multiplier;
- double constant;
-
- target = gtk_constraint_get_target (editor->constraint);
- select_target (GTK_DROP_DOWN (editor->target), get_target_name (target));
-
- attr = gtk_constraint_get_target_attribute (editor->constraint);
- gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->target_attr), get_attr_id (attr));
-
- target = gtk_constraint_get_source (editor->constraint);
- select_target (GTK_DROP_DOWN (editor->source), get_target_name (target));
-
- attr = gtk_constraint_get_source_attribute (editor->constraint);
- gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->source_attr), get_attr_id (attr));
-
- relation = gtk_constraint_get_relation (editor->constraint);
- gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->relation), get_relation_id (relation));
-
- multiplier = gtk_constraint_get_multiplier (editor->constraint);
- val = g_strdup_printf ("%g", multiplier);
- gtk_editable_set_text (GTK_EDITABLE (editor->multiplier), val);
- g_free (val);
-
- constant = gtk_constraint_get_constant (editor->constraint);
- val = g_strdup_printf ("%g", constant);
- gtk_editable_set_text (GTK_EDITABLE (editor->constant), val);
- g_free (val);
-
- strength = gtk_constraint_get_strength (editor->constraint);
- gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->strength), get_strength_id (strength));
-
- gtk_button_set_label (GTK_BUTTON (editor->button), "Apply");
- }
- else
- {
- gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->target_attr), get_attr_id (GTK_CONSTRAINT_ATTRIBUTE_LEFT));
- gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->source_attr), get_attr_id (GTK_CONSTRAINT_ATTRIBUTE_LEFT));
- gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->relation), get_relation_id (GTK_CONSTRAINT_RELATION_EQ));
- gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->strength), get_strength_id (GTK_CONSTRAINT_STRENGTH_REQUIRED));
-
- gtk_editable_set_text (GTK_EDITABLE (editor->multiplier), "1.0");
- gtk_editable_set_text (GTK_EDITABLE (editor->constant), "0.0");
-
- gtk_button_set_label (GTK_BUTTON (editor->button), "Create");
- }
-
- editor->constructed = TRUE;
- update_preview (editor);
- update_button (editor);
-}
-
-static void
-constraint_editor_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ConstraintEditor *self = CONSTRAINT_EDITOR (object);
-
- switch (property_id)
- {
- case PROP_MODEL:
- self->model = g_value_dup_object (value);
- break;
-
- case PROP_CONSTRAINT:
- self->constraint = g_value_dup_object (value);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
-}
-
-static void
-constraint_editor_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ConstraintEditor *self = CONSTRAINT_EDITOR (object);
-
- switch (property_id)
- {
- case PROP_MODEL:
- g_value_set_object (value, self->model);
- break;
-
- case PROP_CONSTRAINT:
- g_value_set_object (value, self->constraint);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
-}
-
-static void
-constraint_editor_dispose (GObject *object)
-{
- ConstraintEditor *self = (ConstraintEditor *)object;
-
- g_clear_object (&self->model);
- g_clear_object (&self->constraint);
-
- gtk_widget_dispose_template (GTK_WIDGET (object), CONSTRAINT_EDITOR_TYPE);
-
- G_OBJECT_CLASS (constraint_editor_parent_class)->dispose (object);
-}
-
-static void
-constraint_editor_class_init (ConstraintEditorClass *class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
-
- object_class->constructed = constraint_editor_constructed;
- object_class->dispose = constraint_editor_dispose;
- object_class->set_property = constraint_editor_set_property;
- object_class->get_property = constraint_editor_get_property;
-
- pspecs[PROP_CONSTRAINT] =
- g_param_spec_object ("constraint", "constraint", "constraint",
- GTK_TYPE_CONSTRAINT,
- G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY);
-
- pspecs[PROP_MODEL] =
- g_param_spec_object ("model", "model", "model",
- G_TYPE_LIST_MODEL,
- G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY);
-
- g_object_class_install_properties (object_class, LAST_PROP, pspecs);
-
- signals[DONE] =
- g_signal_new ("done",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- NULL,
- G_TYPE_NONE, 1, GTK_TYPE_CONSTRAINT);
-
- gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
-
- gtk_widget_class_set_template_from_resource (widget_class,
- "/org/gtk/gtk4/constraint-editor/constraint-editor.ui");
-
- gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, grid);
- gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, target);
- gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, target_attr);
- gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, relation);
- gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, source);
- gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, source_attr);
- gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, multiplier);
- gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, constant);
- gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, strength);
- gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, preview);
- gtk_widget_class_bind_template_child (widget_class, ConstraintEditor, button);
-
- gtk_widget_class_bind_template_callback (widget_class, update_preview);
- gtk_widget_class_bind_template_callback (widget_class, update_button);
- gtk_widget_class_bind_template_callback (widget_class, create_constraint);
- gtk_widget_class_bind_template_callback (widget_class, source_attr_changed);
-}
-
-ConstraintEditor *
-constraint_editor_new (GListModel *model,
- GtkConstraint *constraint)
-{
- return g_object_new (CONSTRAINT_EDITOR_TYPE,
- "model", model,
- "constraint", constraint,
- NULL);
-}
diff --git a/demos/constraint-editor/constraint-editor.css b/demos/constraint-editor/constraint-editor.css
deleted file mode 100644
index c9538bf268..0000000000
--- a/demos/constraint-editor/constraint-editor.css
+++ /dev/null
@@ -1,12 +0,0 @@
-constraintview {
- background: black;
- color: white;
-}
-
-constraintview .child {
- background: red;
-}
-
-constraintview .guide {
- background: blue;
-}
diff --git a/demos/constraint-editor/constraint-editor.gresource.xml b/demos/constraint-editor/constraint-editor.gresource.xml
deleted file mode 100644
index e57964b1a7..0000000000
--- a/demos/constraint-editor/constraint-editor.gresource.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
- constraint-editor-window.ui
- constraint-editor.ui
- guide-editor.ui
- constraint-editor.css
-
-
diff --git a/demos/constraint-editor/constraint-editor.h b/demos/constraint-editor/constraint-editor.h
deleted file mode 100644
index 1b6125bfad..0000000000
--- a/demos/constraint-editor/constraint-editor.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright © 2019 Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see .
- *
- * Authors: Matthias Clasen
- */
-
-#pragma once
-
-#include
-
-#define CONSTRAINT_EDITOR_TYPE (constraint_editor_get_type ())
-
-G_DECLARE_FINAL_TYPE (ConstraintEditor, constraint_editor, CONSTRAINT, EDITOR, GtkWidget)
-
-ConstraintEditor * constraint_editor_new (GListModel *model,
- GtkConstraint *constraint);
-
-void constraint_editor_serialize_constraint (GString *str,
- int indent,
- GtkConstraint *constraint);
-char *constraint_editor_constraint_to_string (GtkConstraint *constraint);
diff --git a/demos/constraint-editor/constraint-editor.ui b/demos/constraint-editor/constraint-editor.ui
deleted file mode 100644
index 57cd9ec30b..0000000000
--- a/demos/constraint-editor/constraint-editor.ui
+++ /dev/null
@@ -1,204 +0,0 @@
-
-
-
-
- - None
- - Left
- - Right
- - Top
- - Bottom
- - Start
- - End
- - Width
- - Height
- - Center X
- - Center Y
- - Baseline
-
-
-
-
-
- 20
- 20
- 20
- 20
- 10
- 10
-
-
- Target
-
- 0
- 1
-
-
-
-
-
-
-
-
- 1
- 1
-
-
-
-
-
- targets
-
-
- 2
- 1
-
-
-
-
-
- Relation
-
- 0
- 2
-
-
-
-
-
-
-
-
-
- - ≤
- - =
- - ≥
-
-
-
-
- 1
- 2
-
-
-
-
-
- Source
-
- 0
- 3
-
-
-
-
-
-
-
-
- 1
- 3
-
-
-
-
-
- targets
-
-
-
-
- 2
- 3
-
-
-
-
-
- Multiplier
-
- 0
- 4
-
-
-
-
-
-
-
- 1
- 4
-
-
-
-
-
- Constant
-
- 0
- 5
-
-
-
-
-
-
-
- 1
- 5
-
-
-
-
-
- Strength
-
- 0
- 6
-
-
-
-
-
-
-
-
- - Weak
- - Medium
- - Strong
- - Required
-
-
-
-
- 1
- 6
-
-
-
-
-
- 0
-
- 1
- 7
- 2
-
-
-
-
-
-
-
-
- Create
-
-
- 2
- 8
-
-
-
-
-
-
-
diff --git a/demos/constraint-editor/constraint-view-child.c b/demos/constraint-editor/constraint-view-child.c
deleted file mode 100644
index 272054a387..0000000000
--- a/demos/constraint-editor/constraint-view-child.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright © 2019 Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see .
- *
- * Authors: Matthias Clasen
- */
-
-#include "constraint-view-child.h"
-
-struct _ConstraintViewChild
-{
- GObject parent_instance;
-
- char *name;
-};
-
-enum {
- PROP_NAME = 1,
- LAST_PROP
-};
-
-static GParamSpec props[LAST_PROP];
-
-G_DEFINE_TYPE (ConstraintViewChild, constraint_view_child, G_TYPE_OBJECT)
-
-static void
-constraint_view_child_init (ConstraintViewChild *child)
-{
-}
-
-static void
-constraint_view_child_finalize (GObject *object)
-{
- ConstraintViewChild *child = CONSTRAINT_VIEW_CHILD (object);
-
- g_free (child->name);
-
- G_OBJECT_CLASS (constraint_view_child_parent_class)->finalize (object);
-}
-
-static void
-constraint_view_child_set_property (GObject *object,
-
-static void
-constraint_view_child_class_init (ConstraintViewChildClass *class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
-
- object_class->finalize = constraint_view_child_finalize;
- object_class->get_property = constraint_view_child_get_property;
- object_class->set_property = constraint_view_child_set_property;
-
- props[PROP_NAME] =
- g_param_spec_string ("name", "name", "name",
- NULL,
- G_PARAM_READWRITE);
-
- g_object_class_install_properties (object_class, LAST_PROP, props);
-}
-
-#define CONSTRAINT_VIEW_CHILD_TYPE (constraint_view_get_type ())
-
-G_DECLARE_TYPE (ConstraintViewChild, constraint_view_child, CONSTRAINT, VIEW_CHILD, GObject)
-
-#define CONSTRAINT_VIEW_WIDGET_TYPE (constraint_view_widget_get_type ())
-
-G_DECLARE_FINAL_TYPE (ConstraintViewWidget, constraint_view_widget, CONSTRAINT, VIEW_WIDGET, ConstraintViewChild)
-
-ConstraintViewWidget * constraint_view_widget_new (void);
-
-#define CONSTRAINT_VIEW_GUIDE_TYPE (constraint_view_guide_get_type ())
-
-G_DECLARE_FINAL_TYPE (ConstraintViewGuide, constraint_view_guide, CONSTRAINT, VIEW_GUIDE, ConstraintViewChild)
-
-ConstraintViewGuide * constraint_view_guide_new (void);
-
-#define CONSTRAINT_VIEW_CONSTRAINT_TYPE (constraint_view_constraint_get_type ())
-
-G_DECLARE_FINAL_TYPE (ConstraintViewConstraint, constraint_view_constraint, CONSTRAINT, VIEW_CONSTRAINT, ConstraintViewChild)
-
-ConstraintViewGuide * constraint_view_constraint_new (void);
diff --git a/demos/constraint-editor/constraint-view-child.h b/demos/constraint-editor/constraint-view-child.h
deleted file mode 100644
index 6f2120ef0b..0000000000
--- a/demos/constraint-editor/constraint-view-child.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright © 2019 Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see .
- *
- * Authors: Matthias Clasen
- */
-
-#pragma once
-
-#include
-
-#define CONSTRAINT_VIEW_CHILD_TYPE (constraint_view_get_type ())
-
-G_DECLARE_TYPE (ConstraintViewChild, constraint_view_child, CONSTRAINT, VIEW_CHILD, GObject)
-
-#define CONSTRAINT_VIEW_WIDGET_TYPE (constraint_view_widget_get_type ())
-
-G_DECLARE_FINAL_TYPE (ConstraintViewWidget, constraint_view_widget, CONSTRAINT, VIEW_WIDGET, ConstraintViewChild)
-
-ConstraintViewWidget * constraint_view_widget_new (void);
-
-#define CONSTRAINT_VIEW_GUIDE_TYPE (constraint_view_guide_get_type ())
-
-G_DECLARE_FINAL_TYPE (ConstraintViewGuide, constraint_view_guide, CONSTRAINT, VIEW_GUIDE, ConstraintViewChild)
-
-ConstraintViewGuide * constraint_view_guide_new (void);
-
-#define CONSTRAINT_VIEW_CONSTRAINT_TYPE (constraint_view_constraint_get_type ())
-
-G_DECLARE_FINAL_TYPE (ConstraintViewConstraint, constraint_view_constraint, CONSTRAINT, VIEW_CONSTRAINT, ConstraintViewChild)
-
-ConstraintViewGuide * constraint_view_constraint_new (void);
diff --git a/demos/constraint-editor/constraint-view.c b/demos/constraint-editor/constraint-view.c
deleted file mode 100644
index cc5b11c0f5..0000000000
--- a/demos/constraint-editor/constraint-view.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/* Copyright (C) 2019 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see .
- */
-
-#include
-#include "constraint-view.h"
-
-struct _ConstraintView
-{
- GtkWidget parent;
-
- GListModel *model;
-
- GtkWidget *drag_widget;
-};
-
-G_DEFINE_TYPE (ConstraintView, constraint_view, GTK_TYPE_WIDGET);
-
-static void
-constraint_view_dispose (GObject *object)
-{
- ConstraintView *view = CONSTRAINT_VIEW (object);
- GtkWidget *child;
-
- while ((child = gtk_widget_get_first_child (GTK_WIDGET (view))) != NULL)
- gtk_widget_unparent (child);
-
- g_clear_object (&view->model);
-
- G_OBJECT_CLASS (constraint_view_parent_class)->dispose (object);
-}
-
-static void
-constraint_view_class_init (ConstraintViewClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- object_class->dispose = constraint_view_dispose;
-
- gtk_widget_class_set_css_name (widget_class, "constraintview");
-}
-
-static void
-update_weak_position (ConstraintView *self,
- GtkWidget *child,
- double x,
- double y)
-{
- GtkLayoutManager *manager;
- GtkConstraint *constraint;
-
- manager = gtk_widget_get_layout_manager (GTK_WIDGET (self));
- constraint = (GtkConstraint *)g_object_get_data (G_OBJECT (child), "x-constraint");
- if (constraint)
- {
- gtk_constraint_layout_remove_constraint (GTK_CONSTRAINT_LAYOUT (manager),
- constraint);
- g_object_set_data (G_OBJECT (child), "x-constraint", NULL);
- }
- if (x != -100)
- {
- constraint = gtk_constraint_new_constant (child,
- GTK_CONSTRAINT_ATTRIBUTE_CENTER_X,
- GTK_CONSTRAINT_RELATION_EQ,
- x,
- GTK_CONSTRAINT_STRENGTH_WEAK);
- g_object_set_data (G_OBJECT (constraint), "internal", (char *)"yes");
- gtk_constraint_layout_add_constraint (GTK_CONSTRAINT_LAYOUT (manager),
- constraint);
- g_object_set_data (G_OBJECT (child), "x-constraint", constraint);
- }
-
- constraint = (GtkConstraint *)g_object_get_data (G_OBJECT (child), "y-constraint");
- if (constraint)
- {
- gtk_constraint_layout_remove_constraint (GTK_CONSTRAINT_LAYOUT (manager),
- constraint);
- g_object_set_data (G_OBJECT (child), "y-constraint", NULL);
- }
- if (y != -100)
- {
- constraint = gtk_constraint_new_constant (child,
- GTK_CONSTRAINT_ATTRIBUTE_CENTER_Y,
- GTK_CONSTRAINT_RELATION_EQ,
- y,
- GTK_CONSTRAINT_STRENGTH_WEAK);
- g_object_set_data (G_OBJECT (constraint), "internal", (char *)"yes");
- gtk_constraint_layout_add_constraint (GTK_CONSTRAINT_LAYOUT (manager),
- constraint);
- g_object_set_data (G_OBJECT (child), "y-constraint", constraint);
- }
-}
-
-static void
-drag_begin (GtkGestureDrag *drag,
- double start_x,
- double start_y,
- ConstraintView *self)
-{
- GtkWidget *widget;
-
- widget = gtk_widget_pick (GTK_WIDGET (self), start_x, start_y, GTK_PICK_DEFAULT);
-
- if (GTK_IS_LABEL (widget))
- {
- widget = gtk_widget_get_ancestor (widget, GTK_TYPE_FRAME);
- if (widget &&
- gtk_widget_get_parent (widget) == (GtkWidget *)self)
- {
- self->drag_widget = widget;
- }
- }
-}
-
-static void
-drag_update (GtkGestureDrag *drag,
- double offset_x,
- double offset_y,
- ConstraintView *self)
-{
- double x, y;
-
- if (!self->drag_widget)
- return;
-
- gtk_gesture_drag_get_start_point (drag, &x, &y);
- update_weak_position (self, self->drag_widget, x + offset_x, y + offset_y);
-}
-
-static void
-drag_end (GtkGestureDrag *drag,
- double offset_x,
- double offset_y,
- ConstraintView *self)
-{
- self->drag_widget = NULL;
-}
-
-static gboolean
-omit_internal (gpointer item, gpointer user_data)
-{
- if (g_object_get_data (G_OBJECT (item), "internal"))
- return FALSE;
-
- return TRUE;
-}
-
-static void
-constraint_view_init (ConstraintView *self)
-{
- GtkLayoutManager *manager;
- GtkEventController *controller;
- GListStore *list;
- GListModel *all_children;
- GListModel *all_constraints;
- GListModel *guides;
- GListModel *children;
- GListModel *constraints;
- GtkFilter *filter;
-
- manager = gtk_constraint_layout_new ();
- gtk_widget_set_layout_manager (GTK_WIDGET (self), manager);
-
- guides = gtk_constraint_layout_observe_guides (GTK_CONSTRAINT_LAYOUT (manager));
-
- all_constraints = gtk_constraint_layout_observe_constraints (GTK_CONSTRAINT_LAYOUT (manager));
- filter = GTK_FILTER (gtk_custom_filter_new (omit_internal, NULL, NULL));
- constraints = (GListModel *)gtk_filter_list_model_new (all_constraints, filter);
-
- all_children = gtk_widget_observe_children (GTK_WIDGET (self));
- filter = GTK_FILTER (gtk_custom_filter_new (omit_internal, NULL, NULL));
- children = (GListModel *)gtk_filter_list_model_new (all_children, filter);
-
- list = g_list_store_new (G_TYPE_LIST_MODEL);
- g_list_store_append (list, children);
- g_list_store_append (list, guides);
- g_list_store_append (list, constraints);
- g_object_unref (children);
- g_object_unref (guides);
- g_object_unref (constraints);
-
- self->model = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (list)));
-
- controller = (GtkEventController *)gtk_gesture_drag_new ();
- g_signal_connect (controller, "drag-begin", G_CALLBACK (drag_begin), self);
- g_signal_connect (controller, "drag-update", G_CALLBACK (drag_update), self);
- g_signal_connect (controller, "drag-end", G_CALLBACK (drag_end), self);
- gtk_widget_add_controller (GTK_WIDGET (self), controller);
-}
-
-ConstraintView *
-constraint_view_new (void)
-{
- return g_object_new (CONSTRAINT_VIEW_TYPE, NULL);
-}
-
-void
-constraint_view_add_child (ConstraintView *view,
- const char *name)
-{
- GtkWidget *frame;
- GtkWidget *label;
-
- label = gtk_label_new (name);
- frame = gtk_frame_new (NULL);
- gtk_widget_add_css_class (frame, "child");
- gtk_widget_set_name (frame, name);
- gtk_frame_set_child (GTK_FRAME (frame), label);
- gtk_widget_set_parent (frame, GTK_WIDGET (view));
-
- update_weak_position (view, frame, 100, 100);
-}
-
-void
-constraint_view_remove_child (ConstraintView *view,
- GtkWidget *child)
-{
- update_weak_position (view, child, -100, -100);
- gtk_widget_unparent (child);
-}
-
-void
-constraint_view_add_guide (ConstraintView *view,
- GtkConstraintGuide *guide)
-{
- GtkConstraintLayout *layout;
- GtkWidget *frame;
- GtkWidget *label;
- const char *name;
- GtkConstraint *constraint;
- struct {
- const char *name;
- GtkConstraintAttribute attr;
- } names[] = {
- { "left-constraint", GTK_CONSTRAINT_ATTRIBUTE_LEFT },
- { "top-constraint", GTK_CONSTRAINT_ATTRIBUTE_TOP },
- { "width-constraint", GTK_CONSTRAINT_ATTRIBUTE_WIDTH },
- { "height-constraint", GTK_CONSTRAINT_ATTRIBUTE_HEIGHT },
- };
- int i;
-
- name = gtk_constraint_guide_get_name (guide);
- label = gtk_label_new (name);
- g_object_bind_property (guide, "name",
- label, "label",
- G_BINDING_DEFAULT);
-
- frame = gtk_frame_new (NULL);
- gtk_widget_add_css_class (frame, "guide");
- g_object_set_data (G_OBJECT (frame), "internal", (char *)"yes");
- gtk_frame_set_child (GTK_FRAME (frame), label);
- gtk_widget_insert_after (frame, GTK_WIDGET (view), NULL);
-
- g_object_set_data (G_OBJECT (guide), "frame", frame);
-
- layout = GTK_CONSTRAINT_LAYOUT (gtk_widget_get_layout_manager (GTK_WIDGET (view)));
- gtk_constraint_layout_add_guide (layout, g_object_ref (guide));
-
- for (i = 0; i < G_N_ELEMENTS (names); i++)
- {
- constraint = gtk_constraint_new (frame,
- names[i].attr,
- GTK_CONSTRAINT_RELATION_EQ,
- guide,
- names[i].attr,
- 1.0, 0.0,
- GTK_CONSTRAINT_STRENGTH_REQUIRED);
- g_object_set_data (G_OBJECT (constraint), "internal", (char *)"yes");
- gtk_constraint_layout_add_constraint (layout, constraint);
- g_object_set_data (G_OBJECT (guide), names[i].name, constraint);
- }
-
- update_weak_position (view, frame, 150, 150);
-}
-
-void
-constraint_view_remove_guide (ConstraintView *view,
- GtkConstraintGuide *guide)
-{
- GtkConstraintLayout *layout;
- GtkWidget *frame;
- GtkConstraint *constraint;
- const char *names[] = {
- "left-constraint",
- "top-constraint",
- "width-constraint",
- "height-constraint"
- };
- int i;
-
- layout = GTK_CONSTRAINT_LAYOUT (gtk_widget_get_layout_manager (GTK_WIDGET (view)));
-
- for (i = 0; i < G_N_ELEMENTS (names); i++)
- {
- constraint = (GtkConstraint*)g_object_get_data (G_OBJECT (guide), names[i]);
- gtk_constraint_layout_remove_constraint (layout, constraint);
- }
-
- frame = (GtkWidget *)g_object_get_data (G_OBJECT (guide), "frame");
- update_weak_position (view, frame, -100, -100);
- gtk_widget_unparent (frame);
-
- gtk_constraint_layout_remove_guide (layout, guide);
-}
-
-void
-constraint_view_add_constraint (ConstraintView *view,
- GtkConstraint *constraint)
-{
- GtkLayoutManager *manager;
-
- manager = gtk_widget_get_layout_manager (GTK_WIDGET (view));
- gtk_constraint_layout_add_constraint (GTK_CONSTRAINT_LAYOUT (manager),
- g_object_ref (constraint));
-}
-
-void
-constraint_view_remove_constraint (ConstraintView *view,
- GtkConstraint *constraint)
-{
- GtkLayoutManager *manager;
-
- manager = gtk_widget_get_layout_manager (GTK_WIDGET (view));
- gtk_constraint_layout_remove_constraint (GTK_CONSTRAINT_LAYOUT (manager),
- constraint);
-}
-
-GListModel *
-constraint_view_get_model (ConstraintView *view)
-{
- return view->model;
-}
diff --git a/demos/constraint-editor/constraint-view.h b/demos/constraint-editor/constraint-view.h
deleted file mode 100644
index 834e606eb7..0000000000
--- a/demos/constraint-editor/constraint-view.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright © 2019 Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see .
- *
- * Authors: Matthias Clasen
- */
-
-#pragma once
-
-#include
-
-#define CONSTRAINT_VIEW_TYPE (constraint_view_get_type ())
-
-G_MODULE_EXPORT
-G_DECLARE_FINAL_TYPE (ConstraintView, constraint_view, CONSTRAINT, VIEW, GtkWidget)
-
-ConstraintView * constraint_view_new (void);
-
-void constraint_view_add_child (ConstraintView *view,
- const char *name);
-void constraint_view_remove_child (ConstraintView *view,
- GtkWidget *child);
-void constraint_view_add_guide (ConstraintView *view,
- GtkConstraintGuide *guide);
-void constraint_view_remove_guide (ConstraintView *view,
- GtkConstraintGuide *guide);
-void constraint_view_guide_changed (ConstraintView *view,
- GtkConstraintGuide *guide);
-void constraint_view_add_constraint (ConstraintView *view,
- GtkConstraint *constraint);
-void constraint_view_remove_constraint (ConstraintView *view,
- GtkConstraint *constraint);
-GListModel * constraint_view_get_model (ConstraintView *view);
diff --git a/demos/constraint-editor/guide-editor.c b/demos/constraint-editor/guide-editor.c
deleted file mode 100644
index 0c24ef96ab..0000000000
--- a/demos/constraint-editor/guide-editor.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * Copyright © 2019 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see .
- *
- * Authors: Matthias Clasen
- */
-
-#include "config.h"
-
-#include "guide-editor.h"
-
-struct _GuideEditor
-{
- GtkWidget parent_instance;
-
- GtkWidget *grid;
- GtkWidget *name;
- GtkWidget *min_width;
- GtkWidget *min_height;
- GtkWidget *nat_width;
- GtkWidget *nat_height;
- GtkWidget *max_width;
- GtkWidget *max_height;
- GtkWidget *strength;
- GtkWidget *button;
-
- GtkConstraintGuide *guide;
-
- gboolean constructed;
-};
-
-enum {
- PROP_GUIDE = 1,
- LAST_PROP
-};
-
-static GParamSpec *pspecs[LAST_PROP];
-
-enum {
- DONE,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL];
-
-G_DEFINE_TYPE(GuideEditor, guide_editor, GTK_TYPE_WIDGET);
-
-static GtkConstraintStrength
-get_strength (unsigned int id)
-{
- switch (id)
- {
- case 0: return GTK_CONSTRAINT_STRENGTH_WEAK;
- case 1: return GTK_CONSTRAINT_STRENGTH_MEDIUM;
- case 2: return GTK_CONSTRAINT_STRENGTH_STRONG;
- case 3: return GTK_CONSTRAINT_STRENGTH_REQUIRED;
- default: g_assert_not_reached ();
- }
-}
-
-static unsigned int
-get_strength_id (GtkConstraintStrength strength)
-{
- switch (strength)
- {
- case GTK_CONSTRAINT_STRENGTH_WEAK: return 0;
- case GTK_CONSTRAINT_STRENGTH_MEDIUM: return 1;
- case GTK_CONSTRAINT_STRENGTH_STRONG: return 2;
- case GTK_CONSTRAINT_STRENGTH_REQUIRED: return 3;
- default: g_assert_not_reached ();
- }
-}
-
-static const char *
-get_strength_nick (GtkConstraintStrength strength)
-{
- GEnumClass *class = g_type_class_ref (GTK_TYPE_CONSTRAINT_STRENGTH);
- GEnumValue *value = g_enum_get_value (class, strength);
- const char *nick = value->value_nick;
- g_type_class_unref (class);
-
- return nick;
-}
-
-void
-guide_editor_serialize_guide (GString *str,
- int indent,
- GtkConstraintGuide *guide)
-{
- int min_width, min_height;
- int nat_width, nat_height;
- int max_width, max_height;
- const char *name;
- const char *strength;
-
- gtk_constraint_guide_get_min_size (guide, &min_width, &min_height);
- gtk_constraint_guide_get_nat_size (guide, &nat_width, &nat_height);
- gtk_constraint_guide_get_max_size (guide, &max_width, &max_height);
- name = gtk_constraint_guide_get_name (guide);
- strength = get_strength_nick (gtk_constraint_guide_get_strength (guide));
-
- g_string_append_printf (str, "%*s\n", indent, "", name, strength);
-}
-
-static void
-create_guide (GtkButton *button,
- GuideEditor *editor)
-{
- int strength;
- const char *name;
- int w, h;
- GtkConstraintGuide *guide;
- unsigned int id;
-
- if (editor->guide)
- guide = g_object_ref (editor->guide);
- else
- guide = gtk_constraint_guide_new ();
-
- name = gtk_editable_get_text (GTK_EDITABLE (editor->name));
- gtk_constraint_guide_set_name (guide, name);
-
- w = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (editor->min_width));
- h = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (editor->min_height));
- gtk_constraint_guide_set_min_size (guide, w, h);
-
- w = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (editor->nat_width));
- h = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (editor->nat_height));
- gtk_constraint_guide_set_nat_size (guide, w, h);
-
- w = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (editor->max_width));
- h = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (editor->max_height));
- gtk_constraint_guide_set_max_size (guide, w, h);
-
- id = gtk_drop_down_get_selected (GTK_DROP_DOWN (editor->strength));
- strength = get_strength (id);
- gtk_constraint_guide_set_strength (guide, strength);
-
- g_signal_emit (editor, signals[DONE], 0, guide);
- g_object_unref (guide);
-}
-
-static void
-guide_editor_init (GuideEditor *editor)
-{
- gtk_widget_init_template (GTK_WIDGET (editor));
-}
-
-static int guide_counter;
-
-static int
-min_input (GtkSpinButton *spin_button,
- double *new_val)
-{
- if (strcmp (gtk_editable_get_text (GTK_EDITABLE (spin_button)), "") == 0)
- {
- *new_val = 0.0;
- return TRUE;
- }
-
- return FALSE;
-}
-
-static int
-max_input (GtkSpinButton *spin_button,
- double *new_val)
-{
- if (strcmp (gtk_editable_get_text (GTK_EDITABLE (spin_button)), "") == 0)
- {
- *new_val = G_MAXINT;
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-guide_editor_constructed (GObject *object)
-{
- GuideEditor *editor = GUIDE_EDITOR (object);
-
- g_signal_connect (editor->min_width, "input", G_CALLBACK (min_input), NULL);
- g_signal_connect (editor->min_height, "input", G_CALLBACK (min_input), NULL);
- g_signal_connect (editor->max_width, "input", G_CALLBACK (max_input), NULL);
- g_signal_connect (editor->max_height, "input", G_CALLBACK (max_input), NULL);
-
- if (editor->guide)
- {
- GtkConstraintStrength strength;
- const char *nick;
- int w, h;
-
- nick = gtk_constraint_guide_get_name (editor->guide);
- if (nick)
- gtk_editable_set_text (GTK_EDITABLE (editor->name), nick);
-
- gtk_constraint_guide_get_min_size (editor->guide, &w, &h);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->min_width), w);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->min_height), h);
-
- gtk_constraint_guide_get_nat_size (editor->guide, &w, &h);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->nat_width), w);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->nat_height), h);
-
- gtk_constraint_guide_get_max_size (editor->guide, &w, &h);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->max_width), w);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->max_height), h);
-
- strength = gtk_constraint_guide_get_strength (editor->guide);
- gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->strength), get_strength_id (strength));
-
- gtk_button_set_label (GTK_BUTTON (editor->button), "Apply");
- }
- else
- {
- char *name;
-
- guide_counter++;
- name = g_strdup_printf ("Guide %d", guide_counter);
- gtk_editable_set_text (GTK_EDITABLE (editor->name), name);
- g_free (name);
-
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->min_width), 0.0);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->min_height), 0.0);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->nat_width), 0.0);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->nat_height), 0.0);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->max_width), G_MAXINT);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->max_height), G_MAXINT);
-
- gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->strength), get_strength_id (GTK_CONSTRAINT_STRENGTH_MEDIUM));
-
- gtk_button_set_label (GTK_BUTTON (editor->button), "Create");
- }
-
- editor->constructed = TRUE;
-}
-
-static void
-guide_editor_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GuideEditor *self = GUIDE_EDITOR (object);
-
- switch (property_id)
- {
- case PROP_GUIDE:
- self->guide = g_value_dup_object (value);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
-}
-
-static void
-guide_editor_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GuideEditor *self = GUIDE_EDITOR (object);
-
- switch (property_id)
- {
- case PROP_GUIDE:
- g_value_set_object (value, self->guide);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
-}
-
-static void
-guide_editor_dispose (GObject *object)
-{
- GuideEditor *self = (GuideEditor *)object;
-
- g_clear_object (&self->guide);
-
- gtk_widget_dispose_template (GTK_WIDGET (self), GUIDE_EDITOR_TYPE);
-
- G_OBJECT_CLASS (guide_editor_parent_class)->dispose (object);
-}
-
-static void
-guide_editor_class_init (GuideEditorClass *class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
-
- object_class->constructed = guide_editor_constructed;
- object_class->dispose = guide_editor_dispose;
- object_class->set_property = guide_editor_set_property;
- object_class->get_property = guide_editor_get_property;
-
- pspecs[PROP_GUIDE] =
- g_param_spec_object ("guide", "guide", "guide",
- GTK_TYPE_CONSTRAINT_GUIDE,
- G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY);
-
- g_object_class_install_properties (object_class, LAST_PROP, pspecs);
-
- signals[DONE] =
- g_signal_new ("done",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- NULL,
- G_TYPE_NONE, 1, GTK_TYPE_CONSTRAINT_GUIDE);
-
- gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
-
- gtk_widget_class_set_template_from_resource (widget_class,
- "/org/gtk/gtk4/constraint-editor/guide-editor.ui");
-
- gtk_widget_class_bind_template_child (widget_class, GuideEditor, grid);
- gtk_widget_class_bind_template_child (widget_class, GuideEditor, name);
- gtk_widget_class_bind_template_child (widget_class, GuideEditor, min_width);
- gtk_widget_class_bind_template_child (widget_class, GuideEditor, min_height);
- gtk_widget_class_bind_template_child (widget_class, GuideEditor, nat_width);
- gtk_widget_class_bind_template_child (widget_class, GuideEditor, nat_height);
- gtk_widget_class_bind_template_child (widget_class, GuideEditor, max_width);
- gtk_widget_class_bind_template_child (widget_class, GuideEditor, max_height);
- gtk_widget_class_bind_template_child (widget_class, GuideEditor, strength);
- gtk_widget_class_bind_template_child (widget_class, GuideEditor, button);
-
- gtk_widget_class_bind_template_callback (widget_class, create_guide);
-}
-
-GuideEditor *
-guide_editor_new (GtkConstraintGuide *guide)
-{
- return g_object_new (GUIDE_EDITOR_TYPE,
- "guide", guide,
- NULL);
-}
diff --git a/demos/constraint-editor/guide-editor.h b/demos/constraint-editor/guide-editor.h
deleted file mode 100644
index 56ccbfd5d3..0000000000
--- a/demos/constraint-editor/guide-editor.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright © 2019 Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see .
- *
- * Authors: Matthias Clasen
- */
-
-#pragma once
-
-#include
-
-#define GUIDE_EDITOR_TYPE (guide_editor_get_type ())
-
-G_DECLARE_FINAL_TYPE (GuideEditor, guide_editor, GUIDE, EDITOR, GtkWidget)
-
-GuideEditor * guide_editor_new (GtkConstraintGuide *guide);
-
-void guide_editor_serialize_guide (GString *str,
- int indent,
- GtkConstraintGuide *guide);
diff --git a/demos/constraint-editor/guide-editor.ui b/demos/constraint-editor/guide-editor.ui
deleted file mode 100644
index cf0162fa94..0000000000
--- a/demos/constraint-editor/guide-editor.ui
+++ /dev/null
@@ -1,201 +0,0 @@
-
-
-
- 0
- 2147483647
- 1
- 10
- 0
-
-
- 0
- 2147483647
- 1
- 10
- 0
-
-
- 0
- 2147483647
- 1
- 10
- 0
-
-
- 0
- 2147483647
- 1
- 10
- 0
-
-
- 0
- 2147483647
- 1
- 10
- 0
-
-
- 0
- 2147483647
- 1
- 10
- 0
-
-
-
-
- 20
- 20
- 20
- 20
- 10
- 10
-
-
- Name
-
- 0
- 0
-
-
-
-
-
- 20
-
- 1
- 0
- 2
-
-
-
-
-
- Min Size
-
- 0
- 1
-
-
-
-
-
- min_width_adj
- 5
-
- 1
- 1
-
-
-
-
-
- min_height_adj
- 5
-
- 2
- 1
-
-
-
-
-
- Nat Size
-
- 0
- 2
-
-
-
-
-
- nat_width_adj
- 5
-
- 1
- 2
-
-
-
-
-
- nat_height_adj
- 5
-
- 2
- 2
-
-
-
-
-
- Max Size
-
- 0
- 3
-
-
-
-
-
- max_width_adj
- 5
-
- 1
- 3
-
-
-
-
-
- max_height_adj
- 5
-
- 2
- 3
-
-
-
-
-
- Strength
-
- 0
- 4
-
-
-
-
-
-
-
-
- - Weak
- - Medium
- - Strong
- - Required
-
-
-
-
- 1
- 4
- 2
-
-
-
-
-
- Create
-
-
- 2
- 5
-
-
-
-
-
-
-
diff --git a/demos/constraint-editor/main.c b/demos/constraint-editor/main.c
deleted file mode 100644
index 771774c08f..0000000000
--- a/demos/constraint-editor/main.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright © 2019 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see .
- *
- * Authors: Matthias Clasen
- */
-
-#include "config.h"
-
-#include
-
-int
-main (int argc, char *argv[])
-{
- return g_application_run (G_APPLICATION (constraint_editor_application_new ()), argc, argv);
-}
diff --git a/demos/constraint-editor/meson.build b/demos/constraint-editor/meson.build
deleted file mode 100644
index f04abca6da..0000000000
--- a/demos/constraint-editor/meson.build
+++ /dev/null
@@ -1,23 +0,0 @@
-constraint_editor_sources = [
- 'main.c',
- 'constraint-editor-application.c',
- 'constraint-editor-window.c',
- 'constraint-view.c',
- 'constraint-editor.c',
- 'guide-editor.c',
-]
-
-constraint_editor_resources = gnome.compile_resources('constraint_editor_resources',
- 'constraint-editor.gresource.xml',
- source_dir: meson.current_source_dir(),
-)
-
-executable('gtk4-constraint-editor',
- sources: [ constraint_editor_sources, constraint_editor_resources, ],
- c_args: common_cflags,
- dependencies: libgtk_dep,
- include_directories: confinc,
- win_subsystem: 'windows',
- link_args: extra_demo_ldflags,
- install: false,
-)
diff --git a/demos/icon-browser/data/scalable/apps/org.gtk.IconBrowser4.svg b/demos/icon-browser/data/scalable/apps/org.gtk.IconBrowser4.svg
deleted file mode 100644
index ff312e407e..0000000000
--- a/demos/icon-browser/data/scalable/apps/org.gtk.IconBrowser4.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/demos/icon-browser/data/symbolic/apps/org.gtk.IconBrowser4-symbolic.svg b/demos/icon-browser/data/symbolic/apps/org.gtk.IconBrowser4-symbolic.svg
deleted file mode 100644
index e9d73f4327..0000000000
--- a/demos/icon-browser/data/symbolic/apps/org.gtk.IconBrowser4-symbolic.svg
+++ /dev/null
@@ -1,136 +0,0 @@
-
-
-
-
diff --git a/demos/meson.build b/demos/meson.build
index e3792cc27f..ac44532bbc 100644
--- a/demos/meson.build
+++ b/demos/meson.build
@@ -3,9 +3,7 @@
appdata_config = configuration_data()
appdata_config.set('BUILD_VERSION', meson.project_version())
-subdir('constraint-editor')
subdir('gtk-demo')
-subdir('icon-browser')
subdir('node-editor')
subdir('widget-factory')
subdir('print-editor')
diff --git a/docs/reference/gtk/gtk4-icon-browser.rst b/docs/reference/gtk/gtk4-icon-browser.rst
deleted file mode 100644
index bb7073d6be..0000000000
--- a/docs/reference/gtk/gtk4-icon-browser.rst
+++ /dev/null
@@ -1,32 +0,0 @@
-.. _gtk4-icon-browser(1):
-
-=================
-gtk4-icon-browser
-=================
-
------------------
-List themed icons
------------------
-
-:Version: GTK
-:Manual section: 1
-:Manual group: GTK commands
-
-SYNOPSIS
---------
-
-| **gtk4-icon-browser** [OPTIONS...]
-
-DESCRIPTION
------------
-
-``gtk4-icon-browser`` is a utility to explore the icons in the current icon
-theme. It shows icons in various sizes, their symbolic variants where available,
-as well as a description of the icon and its context.
-
-OPTIONS
--------
-
-``-h, --help``
-
- Show the application help.
diff --git a/docs/reference/gtk/meson.build b/docs/reference/gtk/meson.build
index 70741afe97..46b2e220cf 100644
--- a/docs/reference/gtk/meson.build
+++ b/docs/reference/gtk/meson.build
@@ -98,7 +98,6 @@ if get_option('build-demos')
[ 'gtk4-demo', '1', ],
[ 'gtk4-demo-application', '1', ],
[ 'gtk4-widget-factory', '1', ],
- [ 'gtk4-icon-browser', '1', ],
[ 'gtk4-node-editor', '1', ],
]
endif