mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-12 13:30:19 +00:00
Merge branch 'modelbutton-tooltip' into 'main'
widgetfactory: Add text to iconic model buttons Closes #5220 See merge request GNOME/gtk!5136
This commit is contained in:
commit
741567868e
@ -3345,10 +3345,12 @@ bad things might happen.</property>
|
|||||||
<attribute name="display-hint">circular-buttons</attribute>
|
<attribute name="display-hint">circular-buttons</attribute>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="verb-icon">printer-symbolic</attribute>
|
<attribute name="verb-icon">printer-symbolic</attribute>
|
||||||
|
<attribute name="label" translatable="yes">Print all the things!</attribute>
|
||||||
<attribute name="action">win.print</attribute>
|
<attribute name="action">win.print</attribute>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="verb-icon">emblem-shared-symbolic</attribute>
|
<attribute name="verb-icon">emblem-shared-symbolic</attribute>
|
||||||
|
<attribute name="label" translatable="yes">Share all the things!</attribute>
|
||||||
<attribute name="action">app.share</attribute>
|
<attribute name="action">app.share</attribute>
|
||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
@ -3363,14 +3365,17 @@ bad things might happen.</property>
|
|||||||
<attribute name="label" translatable="yes">Edit</attribute>
|
<attribute name="label" translatable="yes">Edit</attribute>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="verb-icon">edit-cut-symbolic</attribute>
|
<attribute name="verb-icon">edit-cut-symbolic</attribute>
|
||||||
|
<attribute name="label" translatable="yes">Cut</attribute>
|
||||||
<attribute name="action">app.cut</attribute>
|
<attribute name="action">app.cut</attribute>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="verb-icon">edit-copy-symbolic</attribute>
|
<attribute name="verb-icon">edit-copy-symbolic</attribute>
|
||||||
|
<attribute name="label" translatable="yes">Copy</attribute>
|
||||||
<attribute name="action">app.copy</attribute>
|
<attribute name="action">app.copy</attribute>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="verb-icon">edit-paste-symbolic</attribute>
|
<attribute name="verb-icon">edit-paste-symbolic</attribute>
|
||||||
|
<attribute name="label" translatable="yes">Paste</attribute>
|
||||||
<attribute name="action">app.paste</attribute>
|
<attribute name="action">app.paste</attribute>
|
||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
|
@ -640,6 +640,22 @@ update_visibility (GtkModelButton *self)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_tooltip (GtkModelButton *self)
|
||||||
|
{
|
||||||
|
if (self->iconic)
|
||||||
|
{
|
||||||
|
if (gtk_label_get_use_markup (GTK_LABEL (self->label)))
|
||||||
|
gtk_widget_set_tooltip_markup (GTK_WIDGET (self), gtk_label_get_text (GTK_LABEL (self->label)));
|
||||||
|
else
|
||||||
|
gtk_widget_set_tooltip_text (GTK_WIDGET (self), gtk_label_get_text (GTK_LABEL (self->label)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_widget_set_tooltip_text (GTK_WIDGET (self), NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_model_button_set_icon (GtkModelButton *self,
|
gtk_model_button_set_icon (GtkModelButton *self,
|
||||||
GIcon *icon)
|
GIcon *icon)
|
||||||
@ -662,6 +678,8 @@ gtk_model_button_set_icon (GtkModelButton *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_visibility (self);
|
update_visibility (self);
|
||||||
|
update_tooltip (self);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ICON]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ICON]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -669,9 +687,9 @@ static void
|
|||||||
gtk_model_button_set_text (GtkModelButton *button,
|
gtk_model_button_set_text (GtkModelButton *button,
|
||||||
const char *text)
|
const char *text)
|
||||||
{
|
{
|
||||||
gtk_label_set_text_with_mnemonic (GTK_LABEL (button->label),
|
gtk_label_set_text_with_mnemonic (GTK_LABEL (button->label), text ? text : "");
|
||||||
text ? text : "");
|
|
||||||
update_visibility (button);
|
update_visibility (button);
|
||||||
|
update_tooltip (button);
|
||||||
|
|
||||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
|
gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
|
||||||
GTK_ACCESSIBLE_RELATION_LABELLED_BY, button->label, NULL,
|
GTK_ACCESSIBLE_RELATION_LABELLED_BY, button->label, NULL,
|
||||||
@ -690,6 +708,8 @@ gtk_model_button_set_use_markup (GtkModelButton *button,
|
|||||||
|
|
||||||
gtk_label_set_use_markup (GTK_LABEL (button->label), use_markup);
|
gtk_label_set_use_markup (GTK_LABEL (button->label), use_markup);
|
||||||
update_visibility (button);
|
update_visibility (button);
|
||||||
|
update_tooltip (button);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (button), properties[PROP_USE_MARKUP]);
|
g_object_notify_by_pspec (G_OBJECT (button), properties[PROP_USE_MARKUP]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -769,6 +789,7 @@ gtk_model_button_set_iconic (GtkModelButton *self,
|
|||||||
|
|
||||||
update_node_name (self);
|
update_node_name (self);
|
||||||
update_visibility (self);
|
update_visibility (self);
|
||||||
|
update_tooltip (self);
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ICONIC]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ICONIC]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user