GtkPaned: Use G_PARAM_EXPLICIT_NOTIFY

This commit is contained in:
Matthias Clasen 2014-06-09 09:16:06 -04:00
parent c93355616f
commit 22cc9749c9

View File

@ -335,10 +335,8 @@ gtk_paned_class_init (GtkPanedClass *class)
g_param_spec_int ("position", g_param_spec_int ("position",
P_("Position"), P_("Position"),
P_("Position of paned separator in pixels (0 means all the way to the left/top)"), P_("Position of paned separator in pixels (0 means all the way to the left/top)"),
0, 0, G_MAXINT, 0,
G_MAXINT, GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
0,
GTK_PARAM_READWRITE));
g_object_class_install_property (object_class, g_object_class_install_property (object_class,
PROP_POSITION_SET, PROP_POSITION_SET,
@ -346,21 +344,14 @@ gtk_paned_class_init (GtkPanedClass *class)
P_("Position Set"), P_("Position Set"),
P_("TRUE if the Position property should be used"), P_("TRUE if the Position property should be used"),
FALSE, FALSE,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("handle-size",
P_("Handle Size"),
P_("Width of handle"),
0,
G_MAXINT,
5,
GTK_PARAM_READABLE));
/** /**
* GtkPaned:min-position: * GtkPaned:min-position:
* *
* The smallest possible value for the position property. This property is derived from the * The smallest possible value for the position property.
* size and shrinkability of the widget's children. * This property is derived from the size and shrinkability
* of the widget's children.
* *
* Since: 2.4 * Since: 2.4
*/ */
@ -369,16 +360,15 @@ gtk_paned_class_init (GtkPanedClass *class)
g_param_spec_int ("min-position", g_param_spec_int ("min-position",
P_("Minimal Position"), P_("Minimal Position"),
P_("Smallest possible value for the \"position\" property"), P_("Smallest possible value for the \"position\" property"),
0, 0, G_MAXINT, 0,
G_MAXINT, GTK_PARAM_READABLE|G_PARAM_EXPLICIT_NOTIFY));
0,
GTK_PARAM_READABLE));
/** /**
* GtkPaned:max-position: * GtkPaned:max-position:
* *
* The largest possible value for the position property. This property is derived from the * The largest possible value for the position property.
* size and shrinkability of the widget's children. * This property is derived from the size and shrinkability
* of the widget's children.
* *
* Since: 2.4 * Since: 2.4
*/ */
@ -387,9 +377,16 @@ gtk_paned_class_init (GtkPanedClass *class)
g_param_spec_int ("max-position", g_param_spec_int ("max-position",
P_("Maximal Position"), P_("Maximal Position"),
P_("Largest possible value for the \"position\" property"), P_("Largest possible value for the \"position\" property"),
0, G_MAXINT, G_MAXINT,
GTK_PARAM_READABLE|G_PARAM_EXPLICIT_NOTIFY));
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("handle-size",
P_("Handle Size"),
P_("Width of handle"),
0, 0,
G_MAXINT, G_MAXINT,
G_MAXINT, 5,
GTK_PARAM_READABLE)); GTK_PARAM_READABLE));
/** /**
@ -818,6 +815,8 @@ gtk_paned_set_property (GObject *object,
switch (prop_id) switch (prop_id)
{ {
case PROP_ORIENTATION: case PROP_ORIENTATION:
if (priv->orientation != g_value_get_enum (value))
{
priv->orientation = g_value_get_enum (value); priv->orientation = g_value_get_enum (value);
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (paned)); _gtk_orientable_set_style_classes (GTK_ORIENTABLE (paned));
@ -837,13 +836,19 @@ gtk_paned_set_property (GObject *object,
/* state_flags_changed updates the cursor */ /* state_flags_changed updates the cursor */
gtk_paned_state_flags_changed (GTK_WIDGET (paned), 0); gtk_paned_state_flags_changed (GTK_WIDGET (paned), 0);
gtk_widget_queue_resize (GTK_WIDGET (paned)); gtk_widget_queue_resize (GTK_WIDGET (paned));
g_object_notify_by_pspec (object, pspec);
}
break; break;
case PROP_POSITION: case PROP_POSITION:
gtk_paned_set_position (paned, g_value_get_int (value)); gtk_paned_set_position (paned, g_value_get_int (value));
break; break;
case PROP_POSITION_SET: case PROP_POSITION_SET:
if (priv->position_set != g_value_get_boolean (value))
{
priv->position_set = g_value_get_boolean (value); priv->position_set = g_value_get_boolean (value);
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (paned)); gtk_widget_queue_resize_no_redraw (GTK_WIDGET (paned));
g_object_notify_by_pspec (object, pspec);
}
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);