st: Remove BoxLayout child meta

They were deprecated last cycle in favor of ClutterActor's own
expand/align properties, time to retire them for good.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1274
This commit is contained in:
Florian Müllner 2020-05-21 01:11:04 +02:00 committed by Georges Basile Stavracas Neto
parent 0f947d4ff9
commit 0ab34fe21f
4 changed files with 1 additions and 288 deletions

View File

@ -4,7 +4,6 @@ st_headers = [
'st-bin.h',
'st-border-image.h',
'st-box-layout.h',
'st-box-layout-child.h',
'st-button.h',
'st-clipboard.h',
'st-drawing-area.h',
@ -116,7 +115,6 @@ st_sources = [
'st-bin.c',
'st-border-image.c',
'st-box-layout.c',
'st-box-layout-child.c',
'st-button.c',
'st-clipboard.c',
'st-drawing-area.c',

View File

@ -1,221 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* st-box-layout-child.c: box layout child actor
*
* Copyright 2009 Intel Corporation
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU Lesser General Public License,
* version 2.1, as published by the Free Software Foundation.
*
* This program is distributed in the hope 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 program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:st-box-layout-child
* @short_description: meta data associated with a #StBoxLayout child.
*
* #StBoxLayoutChild is a #ClutterChildMeta implementation that stores the
* child properties for children inside a #StBoxLayout.
*/
#include "st-box-layout-child.h"
#include "st-private.h"
G_DEFINE_TYPE (StBoxLayoutChild, st_box_layout_child, CLUTTER_TYPE_CHILD_META)
enum
{
PROP_0,
PROP_EXPAND,
PROP_X_FILL,
PROP_Y_FILL,
PROP_X_ALIGN,
PROP_Y_ALIGN
};
static ClutterLayoutMeta *
get_layout_meta (StBoxLayoutChild *self)
{
ClutterChildMeta *meta = CLUTTER_CHILD_META (self);
ClutterActor *actor = clutter_child_meta_get_actor (meta);
ClutterContainer *container = clutter_child_meta_get_container (meta);
ClutterLayoutManager *layout = clutter_actor_get_layout_manager (CLUTTER_ACTOR (container));
return clutter_layout_manager_get_child_meta (layout, container, actor);
}
static void
st_box_layout_child_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
StBoxLayoutChild *child = ST_BOX_LAYOUT_CHILD (object);
GObject *meta = G_OBJECT (get_layout_meta (child));
gboolean expand, fill;
ClutterBoxAlignment layout_align;
StAlign align;
switch (property_id)
{
case PROP_EXPAND:
g_object_get (meta, "expand", &expand, NULL);
g_value_set_boolean (value, expand);
break;
case PROP_X_FILL:
g_object_get (meta, "x-fill", &fill, NULL);
g_value_set_boolean (value, fill);
break;
case PROP_Y_FILL:
g_object_get (meta, "y-fill", &fill, NULL);
g_value_set_boolean (value, fill);
break;
case PROP_X_ALIGN:
case PROP_Y_ALIGN:
g_object_get (meta, g_param_spec_get_name (pspec), &layout_align, NULL);
switch (layout_align)
{
case CLUTTER_BOX_ALIGNMENT_START:
align = ST_ALIGN_START;
break;
case CLUTTER_BOX_ALIGNMENT_CENTER:
align = ST_ALIGN_MIDDLE;
break;
case CLUTTER_BOX_ALIGNMENT_END:
align = ST_ALIGN_END;
break;
default:
g_assert_not_reached ();
}
g_value_set_enum (value, align);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
st_box_layout_child_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
StBoxLayoutChild *child = ST_BOX_LAYOUT_CHILD (object);
GObject *meta = G_OBJECT (get_layout_meta (child));
ClutterBoxAlignment align;
switch (property_id)
{
case PROP_EXPAND:
g_object_set (meta, "expand", g_value_get_boolean (value), NULL);
break;
case PROP_X_FILL:
child->x_fill_set = TRUE;
g_object_set (meta, "x-fill", g_value_get_boolean (value), NULL);
break;
case PROP_Y_FILL:
child->y_fill_set = TRUE;
g_object_set (meta, "y-fill", g_value_get_boolean (value), NULL);
break;
case PROP_X_ALIGN:
case PROP_Y_ALIGN:
switch (g_value_get_enum (value))
{
case ST_ALIGN_START:
align = CLUTTER_BOX_ALIGNMENT_START;
break;
case ST_ALIGN_MIDDLE:
align = CLUTTER_BOX_ALIGNMENT_CENTER;
break;
case ST_ALIGN_END:
align = CLUTTER_BOX_ALIGNMENT_END;
break;
default:
g_assert_not_reached ();
}
g_object_set (meta, g_param_spec_get_name (pspec), align, NULL);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
st_box_layout_child_constructed (GObject *object)
{
StBoxLayoutChild *child = ST_BOX_LAYOUT_CHILD (object);
GObject *meta = G_OBJECT (get_layout_meta (child));
if (!child->x_fill_set)
g_object_set (meta, "x-fill", TRUE, NULL);
if (!child->y_fill_set)
g_object_set (meta, "y-fill", TRUE, NULL);
G_OBJECT_CLASS (st_box_layout_child_parent_class)->constructed (object);
}
static void
st_box_layout_child_class_init (StBoxLayoutChildClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
object_class->get_property = st_box_layout_child_get_property;
object_class->set_property = st_box_layout_child_set_property;
object_class->constructed = st_box_layout_child_constructed;
pspec = g_param_spec_boolean ("expand", "Expand",
"Allocate the child extra space",
FALSE,
ST_PARAM_READWRITE | G_PARAM_DEPRECATED);
g_object_class_install_property (object_class, PROP_EXPAND, pspec);
pspec = g_param_spec_boolean ("x-fill", "x-fill",
"Whether the child should receive priority "
"when the container is allocating spare space "
"on the horizontal axis",
TRUE,
ST_PARAM_READWRITE | G_PARAM_DEPRECATED);
g_object_class_install_property (object_class, PROP_X_FILL, pspec);
pspec = g_param_spec_boolean ("y-fill", "y-fill",
"Whether the child should receive priority "
"when the container is allocating spare space "
"on the vertical axis",
TRUE,
ST_PARAM_READWRITE | G_PARAM_DEPRECATED);
g_object_class_install_property (object_class, PROP_Y_FILL, pspec);
pspec = g_param_spec_enum ("x-align",
"X Alignment",
"X alignment of the widget within the cell",
ST_TYPE_ALIGN,
ST_ALIGN_MIDDLE,
ST_PARAM_READWRITE | G_PARAM_DEPRECATED);
g_object_class_install_property (object_class, PROP_X_ALIGN, pspec);
pspec = g_param_spec_enum ("y-align",
"Y Alignment",
"Y alignment of the widget within the cell",
ST_TYPE_ALIGN,
ST_ALIGN_MIDDLE,
ST_PARAM_READWRITE | G_PARAM_DEPRECATED);
g_object_class_install_property (object_class, PROP_Y_ALIGN, pspec);
}
static void
st_box_layout_child_init (StBoxLayoutChild *self)
{
}

View File

@ -1,52 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* st-box-layout-child.h: box layout child actor
*
* Copyright 2009 Intel Corporation
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU Lesser General Public License,
* version 2.1, as published by the Free Software Foundation.
*
* This program is distributed in the hope 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 program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _ST_BOX_LAYOUT_CHILD_H
#define _ST_BOX_LAYOUT_CHILD_H
#include <clutter/clutter.h>
#include "st-enum-types.h"
#include "st-box-layout.h"
G_BEGIN_DECLS
#define ST_TYPE_BOX_LAYOUT_CHILD st_box_layout_child_get_type()
G_DECLARE_FINAL_TYPE (StBoxLayoutChild, st_box_layout_child, ST, BOX_LAYOUT_CHILD, ClutterChildMeta)
typedef struct _StBoxLayoutChild StBoxLayoutChild;
typedef struct _StBoxLayoutChildPrivate StBoxLayoutChildPrivate;
/**
* StBoxLayoutChild:
*
* The contents of this structure are private and should only be accessed
* through the public API.
*/
struct _StBoxLayoutChild
{
/*< private >*/
ClutterChildMeta parent;
gboolean x_fill_set;
gboolean y_fill_set;
};
G_END_DECLS
#endif /* _ST_BOX_LAYOUT_CHILD_H */

View File

@ -53,11 +53,8 @@
#include "st-private.h"
#include "st-scrollable.h"
#include "st-box-layout-child.h"
static void st_box_container_iface_init (ClutterContainerIface *iface);
enum {
PROP_0,
@ -71,16 +68,7 @@ struct _StBoxLayoutPrivate
StAdjustment *vadjustment;
};
G_DEFINE_TYPE_WITH_CODE (StBoxLayout, st_box_layout, ST_TYPE_VIEWPORT,
G_ADD_PRIVATE (StBoxLayout)
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER,
st_box_container_iface_init));
static void
st_box_container_iface_init (ClutterContainerIface *iface)
{
iface->child_meta_type = ST_TYPE_BOX_LAYOUT_CHILD;
}
G_DEFINE_TYPE_WITH_PRIVATE (StBoxLayout, st_box_layout, ST_TYPE_VIEWPORT);
static void