forked from AuroraMiddleware/gtk
viewport: Use dispose instead of destroy
The destroy vfunc is going away.
This commit is contained in:
parent
7639d3daa0
commit
9f4cea190a
@ -110,7 +110,7 @@ static void gtk_viewport_get_property (GObject *object,
|
|||||||
guint prop_id,
|
guint prop_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
static void gtk_viewport_destroy (GtkWidget *widget);
|
static void gtk_viewport_dispose (GObject *object);
|
||||||
static void gtk_viewport_size_allocate (GtkWidget *widget,
|
static void gtk_viewport_size_allocate (GtkWidget *widget,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
@ -289,11 +289,34 @@ gtk_viewport_get_request_mode (GtkWidget *widget)
|
|||||||
return GTK_SIZE_REQUEST_CONSTANT_SIZE;
|
return GTK_SIZE_REQUEST_CONSTANT_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define ADJUSTMENT_POINTER(orientation) \
|
||||||
|
(((orientation) == GTK_ORIENTATION_HORIZONTAL) ? \
|
||||||
|
&viewport->hadjustment : &viewport->vadjustment)
|
||||||
|
|
||||||
|
static void
|
||||||
|
viewport_disconnect_adjustment (GtkViewport *viewport,
|
||||||
|
GtkOrientation orientation)
|
||||||
|
{
|
||||||
|
GtkAdjustment **adjustmentp = ADJUSTMENT_POINTER (orientation);
|
||||||
|
|
||||||
|
if (*adjustmentp)
|
||||||
|
{
|
||||||
|
g_signal_handlers_disconnect_by_func (*adjustmentp,
|
||||||
|
gtk_viewport_adjustment_value_changed,
|
||||||
|
viewport);
|
||||||
|
g_object_unref (*adjustmentp);
|
||||||
|
*adjustmentp = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_viewport_dispose (GObject *object)
|
gtk_viewport_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
GtkViewport *viewport = GTK_VIEWPORT (object);
|
GtkViewport *viewport = GTK_VIEWPORT (object);
|
||||||
|
|
||||||
|
viewport_disconnect_adjustment (viewport, GTK_ORIENTATION_HORIZONTAL);
|
||||||
|
viewport_disconnect_adjustment (viewport, GTK_ORIENTATION_VERTICAL);
|
||||||
|
|
||||||
clear_focus_change_handler (viewport);
|
clear_focus_change_handler (viewport);
|
||||||
|
|
||||||
g_clear_pointer (&viewport->child, gtk_widget_unparent);
|
g_clear_pointer (&viewport->child, gtk_widget_unparent);
|
||||||
@ -337,7 +360,6 @@ gtk_viewport_class_init (GtkViewportClass *class)
|
|||||||
gobject_class->set_property = gtk_viewport_set_property;
|
gobject_class->set_property = gtk_viewport_set_property;
|
||||||
gobject_class->get_property = gtk_viewport_get_property;
|
gobject_class->get_property = gtk_viewport_get_property;
|
||||||
|
|
||||||
widget_class->destroy = gtk_viewport_destroy;
|
|
||||||
widget_class->size_allocate = gtk_viewport_size_allocate;
|
widget_class->size_allocate = gtk_viewport_size_allocate;
|
||||||
widget_class->measure = gtk_viewport_measure;
|
widget_class->measure = gtk_viewport_measure;
|
||||||
widget_class->root = gtk_viewport_root;
|
widget_class->root = gtk_viewport_root;
|
||||||
@ -495,37 +517,6 @@ gtk_viewport_new (GtkAdjustment *hadjustment,
|
|||||||
return viewport;
|
return viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ADJUSTMENT_POINTER(orientation) \
|
|
||||||
(((orientation) == GTK_ORIENTATION_HORIZONTAL) ? \
|
|
||||||
&viewport->hadjustment : &viewport->vadjustment)
|
|
||||||
|
|
||||||
static void
|
|
||||||
viewport_disconnect_adjustment (GtkViewport *viewport,
|
|
||||||
GtkOrientation orientation)
|
|
||||||
{
|
|
||||||
GtkAdjustment **adjustmentp = ADJUSTMENT_POINTER (orientation);
|
|
||||||
|
|
||||||
if (*adjustmentp)
|
|
||||||
{
|
|
||||||
g_signal_handlers_disconnect_by_func (*adjustmentp,
|
|
||||||
gtk_viewport_adjustment_value_changed,
|
|
||||||
viewport);
|
|
||||||
g_object_unref (*adjustmentp);
|
|
||||||
*adjustmentp = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_viewport_destroy (GtkWidget *widget)
|
|
||||||
{
|
|
||||||
GtkViewport *viewport = GTK_VIEWPORT (widget);
|
|
||||||
|
|
||||||
viewport_disconnect_adjustment (viewport, GTK_ORIENTATION_HORIZONTAL);
|
|
||||||
viewport_disconnect_adjustment (viewport, GTK_ORIENTATION_VERTICAL);
|
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_viewport_parent_class)->destroy (widget);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
viewport_set_adjustment (GtkViewport *viewport,
|
viewport_set_adjustment (GtkViewport *viewport,
|
||||||
GtkOrientation orientation,
|
GtkOrientation orientation,
|
||||||
|
Loading…
Reference in New Issue
Block a user