[gtk/kill-containers: 142/199] treeview: Derive from GtkWidget
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/kill-containers: 142/199] treeview: Derive from GtkWidget
- Date: Tue, 12 May 2020 00:35:49 +0000 (UTC)
commit 3697c57e561660075256b0790e710f5d8f4a386d
Author: Matthias Clasen <mclasen redhat com>
Date: Tue May 5 07:27:04 2020 -0400
treeview: Derive from GtkWidget
Drop the GtkContainer vfuncs.
gtk/a11y/gtktreeviewaccessible.c | 10 +-------
gtk/a11y/gtktreeviewaccessible.h | 6 ++---
gtk/gtktreeview.c | 55 ++++++++--------------------------------
gtk/gtktreeview.h | 2 +-
gtk/gtktreeviewcolumn.c | 2 +-
5 files changed, 16 insertions(+), 59 deletions(-)
---
diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c
index 51a9cf1e7b..7041f06ed1 100644
--- a/gtk/a11y/gtktreeviewaccessible.c
+++ b/gtk/a11y/gtktreeviewaccessible.c
@@ -78,7 +78,7 @@ static void atk_selection_interface_init (AtkSelectionIface
static void atk_component_interface_init (AtkComponentIface *iface);
static void gtk_cell_accessible_parent_interface_init (GtkCellAccessibleParentIface *iface);
-G_DEFINE_TYPE_WITH_CODE (GtkTreeViewAccessible, gtk_tree_view_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE,
+G_DEFINE_TYPE_WITH_CODE (GtkTreeViewAccessible, gtk_tree_view_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
G_ADD_PRIVATE (GtkTreeViewAccessible)
G_IMPLEMENT_INTERFACE (ATK_TYPE_TABLE, atk_table_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init)
@@ -491,7 +491,6 @@ gtk_tree_view_accessible_class_init (GtkTreeViewAccessibleClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkAccessibleClass *accessible_class = (GtkAccessibleClass*)klass;
GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
- GtkContainerAccessibleClass *container_class = (GtkContainerAccessibleClass*)klass;
class->get_n_children = gtk_tree_view_accessible_get_n_children;
class->ref_child = gtk_tree_view_accessible_ref_child;
@@ -502,13 +501,6 @@ gtk_tree_view_accessible_class_init (GtkTreeViewAccessibleClass *klass)
accessible_class->widget_unset = gtk_tree_view_accessible_widget_unset;
- /* The children of a GtkTreeView are the buttons at the top of the columns
- * we do not represent these as children so we do not want to report
- * children added or deleted when these changed.
- */
- container_class->add_gtk = NULL;
- container_class->remove_gtk = NULL;
-
gobject_class->finalize = gtk_tree_view_accessible_finalize;
}
diff --git a/gtk/a11y/gtktreeviewaccessible.h b/gtk/a11y/gtktreeviewaccessible.h
index da97223def..331756ff9f 100644
--- a/gtk/a11y/gtktreeviewaccessible.h
+++ b/gtk/a11y/gtktreeviewaccessible.h
@@ -22,7 +22,7 @@
#error "Only <gtk/gtk-a11y.h> can be included directly."
#endif
-#include <gtk/a11y/gtkcontaineraccessible.h>
+#include <gtk/a11y/gtkwidgetaccessible.h>
G_BEGIN_DECLS
@@ -39,14 +39,14 @@ typedef struct _GtkTreeViewAccessiblePrivate GtkTreeViewAccessiblePrivate;
struct _GtkTreeViewAccessible
{
- GtkContainerAccessible parent;
+ GtkWidgetAccessible parent;
GtkTreeViewAccessiblePrivate *priv;
};
struct _GtkTreeViewAccessibleClass
{
- GtkContainerAccessibleClass parent_class;
+ GtkWidgetAccessibleClass parent_class;
};
GDK_AVAILABLE_IN_ALL
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index a0049976ce..370acc9aea 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -26,7 +26,6 @@
#include "gtkbutton.h"
#include "gtkcelllayout.h"
#include "gtkcellrenderer.h"
-#include "gtkcontainer.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcsscolorvalueprivate.h"
#include "gtkcssstylepropertyprivate.h"
@@ -322,7 +321,7 @@ typedef struct _GtkTreeViewClass GtkTreeViewClass;
struct _GtkTreeViewClass
{
- GtkContainerClass parent_class;
+ GtkWidgetClass parent_class;
void (* row_activated) (GtkTreeView *tree_view,
GtkTreePath *path,
@@ -364,7 +363,7 @@ struct _GtkTreeViewClass
struct _GtkTreeView
{
- GtkContainer parent;
+ GtkWidget parent;
GtkTreeModel *model;
@@ -684,12 +683,8 @@ static gboolean gtk_tree_view_grab_focus (GtkWidget *widget);
static void gtk_tree_view_css_changed (GtkWidget *widget,
GtkCssStyleChange *change);
-/* container signals */
-static void gtk_tree_view_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_tree_view_forall (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
+static void gtk_tree_view_remove (GtkTreeView *tree_view,
+ GtkWidget *widget);
/* Source side drag signals */
static void gtk_tree_view_dnd_finished_cb (GdkDrag *drag,
@@ -999,10 +994,10 @@ static GParamSpec *tree_view_props [LAST_PROP] = { NULL };
/* GType Methods
*/
-G_DEFINE_TYPE_WITH_CODE (GtkTreeView, gtk_tree_view, GTK_TYPE_CONTAINER,
- G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
- gtk_tree_view_buildable_init)
- G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE,
+G_DEFINE_TYPE_WITH_CODE (GtkTreeView, gtk_tree_view, GTK_TYPE_WIDGET,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
+ gtk_tree_view_buildable_init)
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE,
gtk_tree_view_scrollable_init))
static void
@@ -1010,7 +1005,6 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
{
GObjectClass *o_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
- GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
/* GObject signals */
o_class->set_property = gtk_tree_view_set_property;
@@ -1030,10 +1024,6 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
widget_class->grab_focus = gtk_tree_view_grab_focus;
widget_class->css_changed = gtk_tree_view_css_changed;
- /* GtkContainer signals */
- container_class->remove = gtk_tree_view_remove;
- container_class->forall = gtk_tree_view_forall;
-
class->move_cursor = gtk_tree_view_real_move_cursor;
class->select_all = gtk_tree_view_real_select_all;
class->unselect_all = gtk_tree_view_real_unselect_all;
@@ -7452,16 +7442,10 @@ gtk_tree_view_drag_data_received (GObject *source,
set_dest_row (drop, NULL, NULL, FALSE, FALSE, FALSE);
}
-
-/* GtkContainer Methods
- */
-
-
static void
-gtk_tree_view_remove (GtkContainer *container,
- GtkWidget *widget)
+gtk_tree_view_remove (GtkTreeView *tree_view,
+ GtkWidget *widget)
{
- GtkTreeView *tree_view = GTK_TREE_VIEW (container);
GtkTreeViewChild *child = NULL;
GList *tmp_list;
@@ -7501,25 +7485,6 @@ gtk_tree_view_remove (GtkContainer *container,
}
}
-static void
-gtk_tree_view_forall (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
-{
- GtkTreeView *tree_view = GTK_TREE_VIEW (container);
- GtkTreeViewChild *child = NULL;
- GList *tmp_list;
-
- tmp_list = tree_view->children;
- while (tmp_list)
- {
- child = tmp_list->data;
- tmp_list = tmp_list->next;
-
- (* callback) (child->widget, callback_data);
- }
-}
-
/* Returns TRUE is any of the columns contains a cell that can-focus.
* If this is not the case, a column-spanning focus rectangle will be
* drawn.
diff --git a/gtk/gtktreeview.h b/gtk/gtktreeview.h
index f4df3fc0b3..2604748958 100644
--- a/gtk/gtktreeview.h
+++ b/gtk/gtktreeview.h
@@ -22,7 +22,7 @@
#error "Only <gtk/gtk.h> can be included directly."
#endif
-#include <gtk/gtkcontainer.h>
+#include <gtk/gtkwidget.h>
#include <gtk/gtktreemodel.h>
#include <gtk/gtktreeviewcolumn.h>
#include <gtk/gtkentry.h>
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index a9165d4d2b..00f7280027 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -1344,7 +1344,7 @@ _gtk_tree_view_column_unset_tree_view (GtkTreeViewColumn *column)
if (priv->tree_view == NULL)
return;
- gtk_container_remove (GTK_CONTAINER (priv->tree_view), priv->button);
+ gtk_widget_unparent (priv->button);
if (priv->property_changed_signal)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]