diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-10-12 19:28:04 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-10-12 19:28:04 +0000 |
commit | 410813eb6b14c4677c683e7da845a1f1b1a93343 (patch) | |
tree | 1a1d3a02547e8d9f1cad78df454965fa33f67c85 /gtk/inspector | |
parent | 6cc44eb0fe5e067432a46e250af82df575fc33a0 (diff) | |
parent | 69e4c9b01e0db22db96aed7d700ac98c698e3390 (diff) | |
download | gtk+-410813eb6b14c4677c683e7da845a1f1b1a93343.tar.gz |
Merge branch 'deprecate-all-the-cells' into 'main'
Deprecate treeviews and cell renderers
See merge request GNOME/gtk!5098
Diffstat (limited to 'gtk/inspector')
-rw-r--r-- | gtk/inspector/actions.c | 1 | ||||
-rw-r--r-- | gtk/inspector/meson.build | 1 | ||||
-rw-r--r-- | gtk/inspector/object-tree.c | 15 | ||||
-rw-r--r-- | gtk/inspector/object-tree.h | 2 | ||||
-rw-r--r-- | gtk/inspector/prop-editor.c | 10 | ||||
-rw-r--r-- | gtk/inspector/recorder.c | 1 | ||||
-rw-r--r-- | gtk/inspector/tree-data.c | 5 | ||||
-rw-r--r-- | gtk/inspector/treewalk.c | 231 | ||||
-rw-r--r-- | gtk/inspector/treewalk.h | 43 | ||||
-rw-r--r-- | gtk/inspector/window.c | 1 |
10 files changed, 18 insertions, 292 deletions
diff --git a/gtk/inspector/actions.c b/gtk/inspector/actions.c index d857add4c8..eeac0a188e 100644 --- a/gtk/inspector/actions.c +++ b/gtk/inspector/actions.c @@ -24,7 +24,6 @@ #include "gtkapplication.h" #include "gtkapplicationwindow.h" -#include "gtkliststore.h" #include "gtkwidgetprivate.h" #include "gtkactionmuxerprivate.h" #include "gtkpopover.h" diff --git a/gtk/inspector/meson.build b/gtk/inspector/meson.build index 0ab1b1c47f..813028a26a 100644 --- a/gtk/inspector/meson.build +++ b/gtk/inspector/meson.build @@ -42,7 +42,6 @@ inspector_sources = files( 'statistics.c', 'strv-editor.c', 'tree-data.c', - 'treewalk.c', 'type-info.c', 'updatesoverlay.c', 'variant-editor.c', diff --git a/gtk/inspector/object-tree.c b/gtk/inspector/object-tree.c index 4986ee5518..88e97a9c2c 100644 --- a/gtk/inspector/object-tree.c +++ b/gtk/inspector/object-tree.c @@ -33,14 +33,14 @@ #include "gtkbuildable.h" #include "gtkbutton.h" -#include "gtkcelllayout.h" +#include "deprecated/gtkcelllayout.h" #include "gtkcolumnview.h" -#include "gtkcomboboxprivate.h" +#include "deprecated/gtkcomboboxprivate.h" #include "gtkfilterlistmodel.h" #include "gtkcustomfilter.h" #include "gtkflattenlistmodel.h" #include "gtkbuiltiniconprivate.h" -#include "gtkiconview.h" +#include "deprecated/gtkiconview.h" #include "gtkinscription.h" #include "gtklabel.h" #include "gtklistitem.h" @@ -52,15 +52,16 @@ #include "gtktogglebutton.h" #include "gtktreeexpander.h" #include "gtktreelistmodel.h" -#include "gtktreeview.h" -#include "gtktreeselection.h" -#include "gtktreemodelsort.h" -#include "gtktreemodelfilter.h" +#include "deprecated/gtktreeview.h" +#include "deprecated/gtktreeselection.h" +#include "deprecated/gtktreemodelsort.h" +#include "deprecated/gtktreemodelfilter.h" #include "gtkwidgetprivate.h" #include "gtksearchbar.h" #include "gtksearchentry.h" #include "gtkeventcontrollerkey.h" +G_GNUC_BEGIN_IGNORE_DEPRECATIONS enum { diff --git a/gtk/inspector/object-tree.h b/gtk/inspector/object-tree.h index fe9e0cc7bd..5fc457390e 100644 --- a/gtk/inspector/object-tree.h +++ b/gtk/inspector/object-tree.h @@ -24,7 +24,7 @@ #define _GTK_INSPECTOR_OBJECT_TREE_H_ #include <gtk/gtkbox.h> -#include <gtk/gtktreemodel.h> +#include <gtk/deprecated/gtktreemodel.h> #define GTK_TYPE_INSPECTOR_OBJECT_TREE (gtk_inspector_object_tree_get_type()) #define GTK_INSPECTOR_OBJECT_TREE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_OBJECT_TREE, GtkInspectorObjectTree)) diff --git a/gtk/inspector/prop-editor.c b/gtk/inspector/prop-editor.c index e08a194e0c..df87ef3b38 100644 --- a/gtk/inspector/prop-editor.c +++ b/gtk/inspector/prop-editor.c @@ -26,14 +26,14 @@ #include "gtkactionable.h" #include "gtkadjustment.h" #include "gtkapplicationwindow.h" -#include "gtkcelllayout.h" -#include "gtkcellrenderertext.h" +#include "deprecated/gtkcelllayout.h" +#include "deprecated/gtkcombobox.h" +#include "deprecated/gtkiconview.h" +#include "deprecated/gtktreeview.h" #include "gtkcolorbutton.h" #include "gtkcolorchooser.h" -#include "gtkcombobox.h" #include "gtkfontbutton.h" #include "gtkfontchooser.h" -#include "gtkiconview.h" #include "gtklabel.h" #include "gtkpopover.h" #include "gtkscrolledwindow.h" @@ -46,6 +46,8 @@ #include "gtklistbox.h" #include "gtkmenubutton.h" +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + struct _GtkInspectorPropEditor { GtkBox parent_instance; diff --git a/gtk/inspector/recorder.c b/gtk/inspector/recorder.c index 2ef40fe32f..d097f602b6 100644 --- a/gtk/inspector/recorder.c +++ b/gtk/inspector/recorder.c @@ -38,7 +38,6 @@ #include <gtk/gtktogglebutton.h> #include <gtk/gtktreeexpander.h> #include <gtk/gtktreelistmodel.h> -#include <gtk/gtktreemodel.h> #include <gtk/gtkstack.h> #include <gtk/gtknoselection.h> #include <gtk/gtkcolumnview.h> diff --git a/gtk/inspector/tree-data.c b/gtk/inspector/tree-data.c index 42cec69a84..7873f50b0f 100644 --- a/gtk/inspector/tree-data.c +++ b/gtk/inspector/tree-data.c @@ -22,14 +22,15 @@ #include "object-tree.h" -#include "gtktreeview.h" -#include "gtkcellrenderertext.h" +#include "deprecated/gtktreeview.h" +#include "deprecated/gtkcellrenderertext.h" #include "gtktogglebutton.h" #include "gtklabel.h" #include "gtkstack.h" #include "gtkboxlayout.h" #include "gtkorientable.h" +G_GNUC_BEGIN_IGNORE_DEPRECATIONS struct _GtkInspectorTreeData { diff --git a/gtk/inspector/treewalk.c b/gtk/inspector/treewalk.c deleted file mode 100644 index 3e13de235c..0000000000 --- a/gtk/inspector/treewalk.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) 2014 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 <http://www.gnu.org/licenses/>. - */ - -#include "treewalk.h" - -struct _GtkTreeWalk -{ - GtkTreeModel *model; - GtkTreeIter position; - gboolean visited; - RowPredicate predicate; - gpointer data; - GDestroyNotify destroy; -}; - -GtkTreeWalk * -gtk_tree_walk_new (GtkTreeModel *model, - RowPredicate predicate, - gpointer data, - GDestroyNotify destroy) -{ - GtkTreeWalk *walk; - - walk = g_new (GtkTreeWalk, 1); - walk->model = g_object_ref (model); - walk->visited = FALSE; - walk->predicate = predicate; - walk->data = data; - walk->destroy = destroy; - - return walk; -} - -void -gtk_tree_walk_free (GtkTreeWalk *walk) -{ - g_object_unref (walk->model); - - if (walk->destroy) - walk->destroy (walk->data); - - g_free (walk); -} - -void -gtk_tree_walk_reset (GtkTreeWalk *walk, - GtkTreeIter *iter) -{ - if (iter) - { - walk->position = *iter; - walk->visited = TRUE; - } - else - { - walk->visited = FALSE; - } -} - -static gboolean -gtk_tree_walk_step_forward (GtkTreeWalk *walk) -{ - GtkTreeIter next, up; - - if (!walk->visited) - { - if (!gtk_tree_model_get_iter_first (walk->model, &walk->position)) - return FALSE; - - walk->visited = TRUE; - return TRUE; - } - - if (gtk_tree_model_iter_children (walk->model, &next, &walk->position)) - { - walk->position = next; - return TRUE; - } - - next = walk->position; - do - { - up = next; - if (gtk_tree_model_iter_next (walk->model, &next)) - { - walk->position = next; - return TRUE; - } - } - while (gtk_tree_model_iter_parent (walk->model, &next, &up)); - - return FALSE; -} - -static gboolean -gtk_tree_model_iter_last_child (GtkTreeModel *model, - GtkTreeIter *iter, - GtkTreeIter *parent) -{ - GtkTreeIter next; - - if (!gtk_tree_model_iter_children (model, &next, parent)) - return FALSE; - - do - *iter = next; - while (gtk_tree_model_iter_next (model, &next)); - - return TRUE; -} - -static gboolean -gtk_tree_model_get_iter_last (GtkTreeModel *model, - GtkTreeIter *iter) -{ - GtkTreeIter next; - - if (!gtk_tree_model_iter_last_child (model, &next, NULL)) - return FALSE; - - do - *iter = next; - while (gtk_tree_model_iter_last_child (model, &next, &next)); - - return TRUE; -} - -static gboolean -gtk_tree_walk_step_back (GtkTreeWalk *walk) -{ - GtkTreeIter previous, down; - - if (!walk->visited) - { - if (!gtk_tree_model_get_iter_last (walk->model, &walk->position)) - return FALSE; - - walk->visited = TRUE; - return TRUE; - } - - previous = walk->position; - if (gtk_tree_model_iter_previous (walk->model, &previous)) - { - while (gtk_tree_model_iter_last_child (walk->model, &down, &previous)) - previous = down; - - walk->position = previous; - return TRUE; - } - - if (gtk_tree_model_iter_parent (walk->model, &previous, &walk->position)) - { - walk->position = previous; - return TRUE; - } - - return FALSE; -} - -static gboolean -gtk_tree_walk_step (GtkTreeWalk *walk, gboolean backwards) -{ - if (backwards) - return gtk_tree_walk_step_back (walk); - else - return gtk_tree_walk_step_forward (walk); -} - -static gboolean -row_is_match (GtkTreeWalk *walk) -{ - if (walk->predicate) - return walk->predicate (walk->model, &walk->position, walk->data); - return TRUE; -} - -gboolean -gtk_tree_walk_next_match (GtkTreeWalk *walk, - gboolean force_move, - gboolean backwards, - GtkTreeIter *iter) -{ - gboolean moved = FALSE; - gboolean was_visited; - GtkTreeIter position; - - was_visited = walk->visited; - position = walk->position; - - do - { - if (moved || (!force_move && walk->visited)) - { - if (row_is_match (walk)) - { - *iter = walk->position; - return TRUE; - } - } - moved = TRUE; - } - while (gtk_tree_walk_step (walk, backwards)); - - walk->visited = was_visited; - walk->position = position; - - return FALSE; -} - -gboolean -gtk_tree_walk_get_position (GtkTreeWalk *walk, - GtkTreeIter *iter) -{ - *iter = walk->position; - return walk->visited; -} diff --git a/gtk/inspector/treewalk.h b/gtk/inspector/treewalk.h deleted file mode 100644 index ec43b96591..0000000000 --- a/gtk/inspector/treewalk.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2014 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 <http://www.gnu.org/licenses/>. - */ - -#include <gtk/gtktreemodel.h> - - -typedef gboolean (*RowPredicate) (GtkTreeModel *model, - GtkTreeIter *iter, - gpointer data); - -typedef struct _GtkTreeWalk GtkTreeWalk; - -GtkTreeWalk * gtk_tree_walk_new (GtkTreeModel *model, - RowPredicate predicate, - gpointer data, - GDestroyNotify destroy); - -void gtk_tree_walk_free (GtkTreeWalk *walk); - -void gtk_tree_walk_reset (GtkTreeWalk *walk, - GtkTreeIter *iter); - -gboolean gtk_tree_walk_next_match (GtkTreeWalk *walk, - gboolean force_move, - gboolean backwards, - GtkTreeIter *iter); - -gboolean gtk_tree_walk_get_position (GtkTreeWalk *walk, - GtkTreeIter *iter); diff --git a/gtk/inspector/window.c b/gtk/inspector/window.c index 9603a573d3..1364f34d3f 100644 --- a/gtk/inspector/window.c +++ b/gtk/inspector/window.c @@ -59,7 +59,6 @@ #include "gtkprivate.h" #include "gtknative.h" #include "gtkstack.h" -#include "gtktreeviewcolumn.h" #include "gtkwindowgroup.h" #include "gtkrevealer.h" #include "gtklayoutmanager.h" |