[gtk/child-properties] toolbar: Remove the homogeneous and expand child properties
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/child-properties] toolbar: Remove the homogeneous and expand child properties
- Date: Thu, 28 Mar 2019 00:05:02 +0000 (UTC)
commit a443145a4d03b807d8e568d342769f4e38b462ec
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Mar 27 20:02:48 2019 -0400
toolbar: Remove the homogeneous and expand child properties
Replace these with GtkToolItem properties homogeneous
and expand-item.
gtk/gtktoolbar.c | 86 +------------------------------------------------------
gtk/gtktoolitem.c | 34 ++++++++++++++++++++--
2 files changed, 33 insertions(+), 87 deletions(-)
---
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 6c455cb3d4..e160874573 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -76,7 +76,7 @@
* to the toolbar, add an instance of #GtkToolButton.
*
* Toolbar items can be visually grouped by adding instances of
- * #GtkSeparatorToolItem to the toolbar. If the GtkToolbar child property
+ * #GtkSeparatorToolItem to the toolbar. If the GtkToolItem property
* “expand” is #TRUE and the property #GtkSeparatorToolItem:draw is set to
* #FALSE, the effect is to force all following items to the end of the toolbar.
*
@@ -150,13 +150,6 @@ enum {
PROP_TOOLTIPS,
};
-/* Child properties */
-enum {
- CHILD_PROP_0,
- CHILD_PROP_EXPAND,
- CHILD_PROP_HOMOGENEOUS
-};
-
/* Signals */
enum {
ORIENTATION_CHANGED,
@@ -195,16 +188,6 @@ static void gtk_toolbar_move_focus (GtkWidget *widget,
GtkDirectionType dir);
static void gtk_toolbar_display_changed (GtkWidget *widget,
GdkDisplay *previous_display);
-static void gtk_toolbar_set_child_property (GtkContainer *container,
- GtkWidget *child,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gtk_toolbar_get_child_property (GtkContainer *container,
- GtkWidget *child,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
static void gtk_toolbar_finalize (GObject *object);
static void gtk_toolbar_dispose (GObject *object);
static void gtk_toolbar_add (GtkContainer *container,
@@ -386,8 +369,6 @@ gtk_toolbar_class_init (GtkToolbarClass *klass)
container_class->remove = gtk_toolbar_remove;
container_class->forall = gtk_toolbar_forall;
container_class->child_type = gtk_toolbar_child_type;
- container_class->get_child_property = gtk_toolbar_get_child_property;
- container_class->set_child_property = gtk_toolbar_set_child_property;
klass->orientation_changed = gtk_toolbar_orientation_changed;
klass->style_changed = gtk_toolbar_real_style_changed;
@@ -494,23 +475,6 @@ gtk_toolbar_class_init (GtkToolbarClass *klass)
TRUE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
- /* child properties */
- gtk_container_class_install_child_property (container_class,
- CHILD_PROP_EXPAND,
- g_param_spec_boolean ("expand",
- P_("Expand"),
- P_("Whether the item should receive extra
space when the toolbar grows"),
- FALSE,
- GTK_PARAM_READWRITE));
-
- gtk_container_class_install_child_property (container_class,
- CHILD_PROP_HOMOGENEOUS,
- g_param_spec_boolean ("homogeneous",
- P_("Homogeneous"),
- P_("Whether the item should be the same
size as other homogeneous items"),
- FALSE,
- GTK_PARAM_READWRITE));
-
binding_set = gtk_binding_set_by_class (klass);
add_arrow_bindings (binding_set, GDK_KEY_Left, GTK_DIR_LEFT);
@@ -2002,54 +1966,6 @@ gtk_toolbar_set_drop_highlight_item (GtkToolbar *toolbar,
gtk_toolbar_begin_sliding (toolbar);
}
-static void
-gtk_toolbar_get_child_property (GtkContainer *container,
- GtkWidget *child,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GtkToolItem *item = GTK_TOOL_ITEM (child);
-
- switch (property_id)
- {
- case CHILD_PROP_HOMOGENEOUS:
- g_value_set_boolean (value, gtk_tool_item_get_homogeneous (item));
- break;
-
- case CHILD_PROP_EXPAND:
- g_value_set_boolean (value, gtk_tool_item_get_expand (item));
- break;
-
- default:
- GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
- break;
- }
-}
-
-static void
-gtk_toolbar_set_child_property (GtkContainer *container,
- GtkWidget *child,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- switch (property_id)
- {
- case CHILD_PROP_HOMOGENEOUS:
- gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (child), g_value_get_boolean (value));
- break;
-
- case CHILD_PROP_EXPAND:
- gtk_tool_item_set_expand (GTK_TOOL_ITEM (child), g_value_get_boolean (value));
- break;
-
- default:
- GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
- break;
- }
-}
-
static void
gtk_toolbar_add (GtkContainer *container,
GtkWidget *widget)
diff --git a/gtk/gtktoolitem.c b/gtk/gtktoolitem.c
index ab0f78b7ef..d21389d138 100644
--- a/gtk/gtktoolitem.c
+++ b/gtk/gtktoolitem.c
@@ -68,6 +68,8 @@ enum {
PROP_VISIBLE_HORIZONTAL,
PROP_VISIBLE_VERTICAL,
PROP_IS_IMPORTANT,
+ PROP_HOMOGENEOUS,
+ PROP_EXPAND_ITEM,
};
@@ -144,6 +146,22 @@ gtk_tool_item_class_init (GtkToolItemClass *klass)
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
+ g_object_class_install_property (object_class,
+ PROP_EXPAND_ITEM,
+ g_param_spec_boolean ("expand-item",
+ P_("Expand Item"),
+ P_("Whether the item should receive extra space
when the toolbar grows"),
+ FALSE,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
+
+ g_object_class_install_property (object_class,
+ PROP_HOMOGENEOUS,
+ g_param_spec_boolean ("homogeneous",
+ P_("Homogeneous"),
+ P_("Whether the item should be the same size as
other homogeneous items"),
+ FALSE,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
+
/**
* GtkToolItem::create-menu-proxy:
* @tool_item: the object the signal was emitted on
@@ -261,6 +279,12 @@ gtk_tool_item_set_property (GObject *object,
case PROP_IS_IMPORTANT:
gtk_tool_item_set_is_important (toolitem, g_value_get_boolean (value));
break;
+ case PROP_EXPAND_ITEM:
+ gtk_tool_item_set_expand (toolitem, g_value_get_boolean (value));
+ break;
+ case PROP_HOMOGENEOUS:
+ gtk_tool_item_set_homogeneous (toolitem, g_value_get_boolean (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -286,6 +310,12 @@ gtk_tool_item_get_property (GObject *object,
case PROP_IS_IMPORTANT:
g_value_set_boolean (value, toolitem->priv->is_important);
break;
+ case PROP_EXPAND_ITEM:
+ g_value_set_boolean (value, toolitem->priv->expand);
+ break;
+ case PROP_HOMOGENEOUS:
+ g_value_set_boolean (value, toolitem->priv->homogeneous);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -508,7 +538,7 @@ gtk_tool_item_set_expand (GtkToolItem *tool_item,
if (tool_item->priv->expand != expand)
{
tool_item->priv->expand = expand;
- gtk_widget_child_notify (GTK_WIDGET (tool_item), "expand");
+ g_object_notify (G_OBJECT (tool_item), "expand-item");
gtk_widget_queue_resize (GTK_WIDGET (tool_item));
}
}
@@ -550,7 +580,7 @@ gtk_tool_item_set_homogeneous (GtkToolItem *tool_item,
if (tool_item->priv->homogeneous != homogeneous)
{
tool_item->priv->homogeneous = homogeneous;
- gtk_widget_child_notify (GTK_WIDGET (tool_item), "homogeneous");
+ g_object_notify (G_OBJECT (tool_item), "homogeneous");
gtk_widget_queue_resize (GTK_WIDGET (tool_item));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]