Merge branch 'matthiasc/for-master' into 'master'

Matthiasc/for master

See merge request GNOME/gtk!2657
This commit is contained in:
Matthias Clasen 2020-10-04 13:56:30 +00:00
commit 9007d153c8
11 changed files with 90 additions and 6 deletions

View File

@ -517,7 +517,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkEntry" id="entry2">
<property name="sensitive">0</property>
<property name="invisible-char">•</property>
<property name="text" translatable="yes">entry</property>
</object>
</child>
@ -528,7 +527,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</style>
<child>
<object class="GtkEntry" id="entry24">
<property name="invisible-char">•</property>
<property name="enable-emoji-completion">1</property>
<property name="text" translatable="yes">entry</property>
<property name="hexpand">1</property>
</object>
@ -1012,6 +1011,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="restrict-to-fill-level">0</property>
<property name="fill-level">75</property>
<property name="digits">-1</property>
<property name="draw-value">1</property>
<property name="halign">end</property>
</object>
</child>
@ -1024,6 +1024,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="restrict-to-fill-level">0</property>
<property name="fill-level">75</property>
<property name="digits">-1</property>
<property name="draw-value">1</property>
<property name="halign">start</property>
</object>
</child>

View File

@ -891,6 +891,15 @@ gtk_search_entry_handle_event() has been dropped and replaced by
gtk_search_entry_set_key_capture_widget() and
gtk_event_controller_key_forward().
### Adapt to GtkScale changes
The default value of #GtkScale:draw-value has been changed to %FALSE.
If you want your scales to draw values, you will have to set this
property explicitly now.
gtk4-builder-tool can help with this conversion, with the --3to4 option
of the simplify command.
### Stop using gtk_window_activate_default()
The handling of default widgets has been changed, and activating

View File

@ -474,7 +474,7 @@ add_emoji_variation (GtkWidget *box,
if (modifier != 0)
g_object_set_data (G_OBJECT (child), "modifier", GUINT_TO_POINTER (modifier));
gtk_box_append (GTK_BOX (child), label);
gtk_flow_box_child_set_child (GTK_FLOW_BOX_CHILD (child), label);
gtk_flow_box_insert (GTK_FLOW_BOX (box), child, -1);
}
@ -504,7 +504,7 @@ add_emoji (GtkWidget *list,
child = g_object_new (GTK_TYPE_LIST_BOX_ROW, "css-name", "emoji-completion-row", NULL);
gtk_widget_set_focus_on_click (child, FALSE);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_append (GTK_BOX (child), box);
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (child), box);
gtk_box_append (GTK_BOX (box), label);
g_object_set_data (G_OBJECT (child), "base", label);

View File

@ -684,7 +684,7 @@ gtk_scale_class_init (GtkScaleClass *class)
g_param_spec_boolean ("draw-value",
P_("Draw Value"),
P_("Whether the current value is displayed as a string next to the slider"),
TRUE,
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
properties[PROP_HAS_ORIGIN] =
@ -839,7 +839,6 @@ gtk_scale_init (GtkScale *scale)
_gtk_range_set_has_origin (range, TRUE);
gtk_scale_set_draw_value (scale, TRUE);
gtk_range_set_round_digits (range, priv->digits);
gtk_range_set_flippable (range, TRUE);

View File

@ -1770,6 +1770,45 @@ rewrite_radio_button (Element *element,
}
}
static gboolean
has_prop (Element *element,
MyParserData *data,
const char *prop_name)
{
GList *l;
for (l = element->children; l; l = l->next)
{
Element *child = l->data;
if (g_str_equal (child->element_name, "property") &&
has_attribute (child, "name", prop_name))
return TRUE;
}
return FALSE;
}
static void
rewrite_scale (Element *element,
MyParserData *data)
{
if (!has_prop (element, data, "draw-value") &&
!has_prop (element, data, "draw_value"))
{
Element *child;
child = g_new0 (Element, 1);
child->parent = element;
child->element_name = g_strdup ("property");
child->attribute_names = g_new0 (char *, 2);
child->attribute_names[0] = g_strdup ("name");
child->attribute_values = g_new0 (char *, 2);
child->attribute_values[0] = g_strdup ("draw-value");
child->data = g_strdup ("1");
element->children = g_list_prepend (element->children, child);
}
}
/* returns TRUE to remove the element from the parent */
static gboolean
simplify_element (Element *element,
@ -1919,6 +1958,10 @@ rewrite_element (Element *element,
g_str_equal (get_class_name (element), "GtkRadioButton"))
rewrite_radio_button (element, data);
if (element_is_object_or_template (element) &&
g_str_equal (get_class_name (element), "GtkScale"))
rewrite_scale (element, data);
if (g_str_equal (element->element_name, "property"))
maybe_rename_property (element, data);

View File

@ -23,6 +23,7 @@
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="adjustment">adjustment1</property>
<property name="draw-value">1</property>
</object>
</child>
<child>
@ -31,6 +32,7 @@
<property name="orientation">horizontal</property>
<property name="adjustment">adjustment1</property>
<property name="value-pos">bottom</property>
<property name="draw-value">1</property>
</object>
</child>
<child>

View File

@ -1014,6 +1014,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="restrict-to-fill-level">0</property>
<property name="fill-level">75</property>
<property name="digits">-1</property>
<property name="draw-value">1</property>
<property name="halign">end</property>
</object>
</child>
@ -1026,6 +1027,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="restrict-to-fill-level">0</property>
<property name="fill-level">75</property>
<property name="digits">-1</property>
<property name="draw-value">1</property>
<property name="halign">start</property>
</object>
</child>

View File

@ -1015,6 +1015,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="restrict-to-fill-level">0</property>
<property name="fill-level">75</property>
<property name="digits">-1</property>
<property name="draw-value">1</property>
<property name="halign">end</property>
</object>
</child>
@ -1027,6 +1028,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="restrict-to-fill-level">0</property>
<property name="fill-level">75</property>
<property name="digits">-1</property>
<property name="draw-value">1</property>
<property name="halign">start</property>
</object>
</child>

View File

@ -1015,6 +1015,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="restrict-to-fill-level">0</property>
<property name="fill-level">75</property>
<property name="digits">-1</property>
<property name="draw-value">1</property>
<property name="halign">end</property>
</object>
</child>
@ -1027,6 +1028,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="restrict-to-fill-level">0</property>
<property name="fill-level">75</property>
<property name="digits">-1</property>
<property name="draw-value">1</property>
<property name="halign">start</property>
</object>
</child>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkScale">
<property name="draw-value">1</property>
<property name="visible">0</property>
</object>
<object class="GtkScale">
<property name="visible">0</property>
<property name="draw-value">1</property>
</object>
<object class="GtkScale">
<property name="visible">0</property>
</object>
</interface>

View File

@ -0,0 +1,10 @@
<interface>
<object class="GtkScale">
</object>
<object class="GtkScale">
<property name="draw-value">1</property>
</object>
<object class="GtkScale">
<property name="draw_value">0</property>
</object>
</interface>