Merge branch 'assorted-menu-fixes' into 'master'

Assorted menu fixes

See merge request GNOME/gtk!1704
This commit is contained in:
Matthias Clasen 2020-04-17 14:12:20 +00:00
commit 7caed3a462
3 changed files with 11 additions and 2 deletions

View File

@ -1736,6 +1736,7 @@ activate (GApplication *app)
gint i;
GPermission *permission;
GAction *action;
GError *error = NULL;
g_object_get (gtk_settings_get_default (),
"gtk-theme-name", &current_theme,
@ -1768,7 +1769,11 @@ activate (GApplication *app)
NULL);
gtk_builder_set_scope (builder, scope);
g_object_unref (scope);
gtk_builder_add_from_resource (builder, "/org/gtk/WidgetFactory4/widget-factory.ui", NULL);
if (!gtk_builder_add_from_resource (builder, "/org/gtk/WidgetFactory4/widget-factory.ui", &error))
{
g_critical ("%s", error->message);
g_clear_error (&error);
}
window = (GtkWindow *)gtk_builder_get_object (builder, "window");
gtk_application_add_window (GTK_APPLICATION (app), window);

View File

@ -2271,7 +2271,7 @@ microphone-sensitivity-medium-symbolic</property>
<child>
<object class="GtkMenuButton">
<property name="icon-name">view-more-symbolic</property>
<property name="popover">new_style_menu</property>
<property name="menu-model">new_style_menu_model</property>
</object>
</child>
</object>

View File

@ -572,6 +572,9 @@ update_visibility (GtkModelButton *self)
gtk_widget_set_hexpand (self->label,
gtk_widget_get_visible (self->label) && !has_icon);
if (self->accel_label)
gtk_widget_set_visible (self->accel_label, has_text && (!self->iconic || !has_icon));
if (self->image)
{
gtk_widget_set_visible (self->image, has_icon && (self->iconic || !has_text));
@ -792,6 +795,7 @@ gtk_model_button_set_accel (GtkModelButton *button,
g_free (button->accel);
button->accel = g_strdup (accel);
update_accel (button, button->accel);
update_visibility (button);
g_object_notify_by_pspec (G_OBJECT (button), properties[PROP_ACCEL]);
}