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

colordialogbutton: Sync color

See merge request GNOME/gtk!6107
This commit is contained in:
Matthias Clasen 2023-06-17 21:20:10 +00:00
commit d59fc3da3c
13 changed files with 70 additions and 1 deletions

View File

@ -95,6 +95,13 @@ do_entry_completion (GtkWidget *do_widget)
entry = gtk_entry_new ();
gtk_box_append (GTK_BOX (vbox), entry);
gtk_accessible_update_relation (GTK_ACCESSIBLE (entry),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
-1);
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE, GTK_ACCESSIBLE_AUTOCOMPLETE_LIST,
-1);
/* Create the completion object */
completion = gtk_entry_completion_new ();

View File

@ -43,6 +43,10 @@ do_entry_undo (GtkWidget *do_widget)
entry = gtk_entry_new ();
gtk_editable_set_enable_undo (GTK_EDITABLE (entry), TRUE);
gtk_box_append (GTK_BOX (vbox), entry);
gtk_accessible_update_relation (GTK_ACCESSIBLE (entry),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
-1);
}
if (!gtk_widget_get_visible (window))

View File

@ -22,11 +22,15 @@ validate_more_details (GtkEntry *entry,
{
gtk_widget_set_tooltip_text (GTK_WIDGET (entry), "Must have details first");
gtk_widget_add_css_class (GTK_WIDGET (entry), "error");
gtk_accessible_update_state (GTK_ACCESSIBLE (entry),
GTK_ACCESSIBLE_STATE_INVALID, GTK_ACCESSIBLE_INVALID_TRUE,
-1);
}
else
{
gtk_widget_set_tooltip_text (GTK_WIDGET (entry), "");
gtk_widget_remove_css_class (GTK_WIDGET (entry), "error");
gtk_accessible_reset_state (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_STATE_INVALID);
}
}
@ -44,10 +48,18 @@ mode_switch_state_set (GtkSwitch *sw,
{
gtk_widget_set_visible (label, FALSE);
gtk_switch_set_state (sw, state);
gtk_accessible_reset_relation (GTK_ACCESSIBLE (sw), GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE);
gtk_accessible_reset_state (GTK_ACCESSIBLE (sw), GTK_ACCESSIBLE_STATE_INVALID);
}
else
{
gtk_widget_set_visible (label, TRUE);
gtk_accessible_update_relation (GTK_ACCESSIBLE (sw),
GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE, label,
-1);
gtk_accessible_update_state (GTK_ACCESSIBLE (sw),
GTK_ACCESSIBLE_STATE_INVALID, GTK_ACCESSIBLE_INVALID_TRUE,
-1);
}
return TRUE;
@ -73,6 +85,9 @@ level_scale_value_changed (GtkRange *range,
{
gtk_switch_set_state (GTK_SWITCH (sw), FALSE);
}
gtk_accessible_reset_relation (GTK_ACCESSIBLE (sw), GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE);
gtk_accessible_reset_state (GTK_ACCESSIBLE (sw), GTK_ACCESSIBLE_STATE_INVALID);
}
GtkWidget *

View File

@ -249,7 +249,7 @@ do_pickers (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_set_visible (window, TRUE);
gtk_window_present (GTK_WINDOW (window));
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@ -141,6 +141,8 @@ gtk_color_dialog_button_init (GtkColorDialogButton *self)
GTK_PHASE_CAPTURE);
gtk_widget_add_controller (self->button, GTK_EVENT_CONTROLLER (source));
gtk_widget_add_css_class (self->button, "color");
gtk_color_dialog_button_set_rgba (self, &(GdkRGBA) { 0.75, 0.25, 0.25, 1.0 });
}
static void

View File

@ -1396,6 +1396,10 @@ gtk_entry_init (GtkEntry *entry)
GTK_EVENT_CONTROLLER (catchall));
priv->editing_canceled = FALSE;
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
GTK_ACCESSIBLE_PROPERTY_HAS_POPUP, TRUE,
-1);
}
static void

View File

@ -4951,6 +4951,10 @@ gtk_label_set_selectable (GtkLabel *self,
gtk_label_ensure_select_info (self);
self->select_info->selectable = TRUE;
gtk_label_update_cursor (self);
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_PROPERTY_HAS_POPUP, TRUE,
-1);
}
else
{
@ -4962,7 +4966,10 @@ gtk_label_set_selectable (GtkLabel *self,
self->select_info->selectable = FALSE;
gtk_label_clear_select_info (self);
}
gtk_accessible_reset_property (GTK_ACCESSIBLE (self), GTK_ACCESSIBLE_PROPERTY_HAS_POPUP);
}
if (setting != old_setting)
{
g_object_freeze_notify (G_OBJECT (self));
@ -5744,6 +5751,10 @@ gtk_label_do_popup (GtkLabel *self,
gtk_popover_set_has_arrow (GTK_POPOVER (self->popup_menu), FALSE);
gtk_widget_set_halign (self->popup_menu, GTK_ALIGN_START);
gtk_accessible_update_property (GTK_ACCESSIBLE (self->popup_menu),
GTK_ACCESSIBLE_PROPERTY_LABEL, _("Context menu"),
-1);
g_object_unref (model);
}

View File

@ -229,6 +229,10 @@ gtk_password_entry_init (GtkPasswordEntry *entry)
/* Transfer ownership to the GtkText widget */
g_object_unref (buffer);
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
GTK_ACCESSIBLE_PROPERTY_HAS_POPUP, TRUE,
-1);
}
static void

View File

@ -771,6 +771,10 @@ gtk_search_entry_init (GtkSearchEntry *entry)
GTK_EVENT_CONTROLLER (catchall));
gtk_widget_add_css_class (GTK_WIDGET (entry), I_("search"));
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
GTK_ACCESSIBLE_PROPERTY_HAS_POPUP, TRUE,
-1);
}
/**

View File

@ -2712,6 +2712,10 @@ gtk_text_do_popup (GtkText *self,
gtk_popover_set_has_arrow (GTK_POPOVER (priv->popup_menu), FALSE);
gtk_widget_set_halign (priv->popup_menu, GTK_ALIGN_START);
gtk_accessible_update_property (GTK_ACCESSIBLE (priv->popup_menu),
GTK_ACCESSIBLE_PROPERTY_LABEL, _("Context menu"),
-1);
g_object_unref (model);
}

View File

@ -2024,6 +2024,7 @@ gtk_text_view_init (GtkTextView *text_view)
gtk_accessible_update_property (GTK_ACCESSIBLE (widget),
GTK_ACCESSIBLE_PROPERTY_MULTI_LINE, TRUE,
GTK_ACCESSIBLE_PROPERTY_HAS_POPUP, TRUE,
-1);
}
@ -9089,6 +9090,10 @@ gtk_text_view_do_popup (GtkTextView *text_view,
gtk_popover_set_has_arrow (GTK_POPOVER (priv->popup_menu), FALSE);
gtk_widget_set_halign (priv->popup_menu, GTK_ALIGN_START);
gtk_accessible_update_property (GTK_ACCESSIBLE (priv->popup_menu),
GTK_ACCESSIBLE_PROPERTY_LABEL, _("Context menu"),
-1);
g_object_unref (model);
}

View File

@ -404,6 +404,8 @@ setup_cell_cb (GtkSignalListItemFactory *factory,
label = gtk_label_new (NULL);
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
gtk_label_set_width_chars (GTK_LABEL (label), 50);
gtk_widget_set_margin_start (label, 6);
gtk_widget_set_margin_end (label, 6);
gtk_list_item_set_child (list_item, label);
@ -486,6 +488,7 @@ gtk_inspector_a11y_set_object (GtkInspectorA11y *sl,
context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (sl->object));
if (context != NULL)
{
gtk_at_context_realize (context);
g_signal_connect_swapped (context, "state-change", G_CALLBACK (refresh_all), sl);
g_object_unref (context);
}

View File

@ -55,6 +55,8 @@
<property name="selectable">1</property>
<property name="halign">end</property>
<property name="valign">baseline</property>
<property name="ellipsize">end</property>
<property name="width-chars">50</property>
<layout>
<property name="row">1</property>
<property name="column">1</property>
@ -81,6 +83,8 @@
<property name="selectable">1</property>
<property name="halign">end</property>
<property name="valign">baseline</property>
<property name="ellipsize">end</property>
<property name="width-chars">50</property>
<layout>
<property name="row">2</property>
<property name="column">1</property>
@ -133,6 +137,8 @@
<property name="selectable">1</property>
<property name="halign">end</property>
<property name="valign">baseline</property>
<property name="ellipsize">end</property>
<property name="width-chars">50</property>
<layout>
<property name="row">4</property>
<property name="column">1</property>