treeview: Derive from GtkWidget

Drop the GtkContainer vfuncs.
This commit is contained in:
Matthias Clasen 2020-05-05 07:27:04 -04:00
parent 52b1a347d8
commit 3697c57e56
5 changed files with 16 additions and 59 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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,
static void gtk_tree_view_remove (GtkTreeView *tree_view,
GtkWidget *widget);
static void gtk_tree_view_forall (GtkContainer *container,
GtkCallback callback,
gpointer callback_data);
/* Source side drag signals */
static void gtk_tree_view_dnd_finished_cb (GdkDrag *drag,
@ -999,7 +994,7 @@ static GParamSpec *tree_view_props [LAST_PROP] = { NULL };
/* GType Methods
*/
G_DEFINE_TYPE_WITH_CODE (GtkTreeView, gtk_tree_view, GTK_TYPE_CONTAINER,
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,
@ -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,
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.

View File

@ -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>

View File

@ -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)
{