Disable tooltips for GTK 4.6.4 - 4.6.6

A bug in GTK caused the application to crash in some tooltip-related conditions
https://gitlab.gnome.org/GNOME/gtk/-/issues/4941
This commit is contained in:
fiaxh 2022-07-29 19:54:54 +02:00
parent 517363dfc9
commit 6bfa70fc70
12 changed files with 28 additions and 15 deletions

View File

@ -16,7 +16,6 @@
<child>
<object class="GtkButton" id="file_button">
<property name="icon-name">mail-attachment-symbolic</property>
<property name="tooltip-text" translatable="1">Send a file</property>
<property name="margin-top">2</property>
<property name="valign">start</property>
<style>

View File

@ -15,7 +15,6 @@
<property name="hexpand">1</property>
<child>
<object class="GtkMenuButton" id="add_button">
<property name="tooltip_text" translatable="1">Start Conversation</property>
<property name="has-frame">False</property>
<child>
<object class="GtkImage">

View File

@ -8,7 +8,6 @@
</style>
<child>
<object class="GtkMenuButton" id="add_button">
<property name="tooltip_text" translatable="True">Start Conversation</property>
<child>
<object class="GtkImage">
<property name="icon-name">list-add-symbolic</property>

View File

@ -37,8 +37,8 @@ public class ListRow : Widget {
string display_name = Util.get_conversation_display_name(stream_interactor, conv);
if (show_account && stream_interactor.get_accounts().size > 1) {
via_label.label = @"via $(account.bare_jid)";
this.has_tooltip = true;
set_tooltip_text(jid.to_string());
this.has_tooltip = Util.use_tooltips();
set_tooltip_text(Util.string_if_tooltips_active(jid.to_string()));
} else if (display_name != jid.bare_jid.to_string()){
via_label.label = jid.bare_jid.to_string();
} else {

View File

@ -41,6 +41,8 @@ public class View : Box {
});
emoji_button.set_popover(chooser);
file_button.tooltip_text = Util.string_if_tooltips_active(_("Send a file"));
Util.force_css(frame, "* { border-radius: 3px; }");
return this;

View File

@ -145,7 +145,7 @@ public class ConversationItemSkeleton : Plugins.ConversationItemWidgetInterface,
if (item.encryption == Encryption.NONE) {
if (conversation.encryption != Encryption.NONE) {
encryption_image.icon_name = "dino-changes-allowed-symbolic";
encryption_image.tooltip_text = _("Unencrypted");
encryption_image.tooltip_text = Util.string_if_tooltips_active(_("Unencrypted"));
Util.force_error_color(encryption_image);
encryption_image.visible = true;
} else if (conversation.encryption == Encryption.NONE) {
@ -177,7 +177,7 @@ public class ConversationItemSkeleton : Plugins.ConversationItemWidgetInterface,
received_image.icon_name = "dialog-warning-symbolic";
Util.force_error_color(received_image);
Util.force_error_color(time_label);
string error_text = _("Unable to send message");
string error_text = Util.string_if_tooltips_active(_("Unable to send message"));
received_image.tooltip_text = error_text;
time_label.tooltip_text = error_text;
break;

View File

@ -24,6 +24,8 @@ public static HeaderBar get_conversation_list_titlebar_csd() {
}
private static void create_add_menu(MenuButton add_button, MenuButton menu_button) {
add_button.tooltip_text = Util.string_if_tooltips_active(_("Start Conversation"));
Builder add_builder = new Builder.from_resource("/im/dino/Dino/menu_add.ui");
MenuModel add_menu_model = add_builder.get_object("menu_add") as MenuModel;
add_button.set_menu_model(add_menu_model);

View File

@ -70,15 +70,15 @@ public class ConversationSelectorRow : ListBoxRow {
// Set tooltip
switch (conversation.type_) {
case Conversation.Type.CHAT:
has_tooltip = true;
has_tooltip = Util.use_tooltips();
query_tooltip.connect ((x, y, keyboard_tooltip, tooltip) => {
tooltip.set_custom(generate_tooltip());
tooltip.set_custom(Util.widget_if_tooltips_active(generate_tooltip()));
return true;
});
break;
case Conversation.Type.GROUPCHAT:
has_tooltip = true;
set_tooltip_text(conversation.counterpart.bare_jid.to_string());
has_tooltip = Util.use_tooltips();
set_tooltip_text(Util.string_if_tooltips_active(conversation.counterpart.bare_jid.to_string()));
break;
case Conversation.Type.GROUPCHAT_PM:
break;

View File

@ -23,9 +23,9 @@ class MenuEntry : Plugins.ConversationTitlebarEntry, Object {
button.sensitive = true;
this.conversation = conversation;
if (conversation.type_ == Conversation.Type.GROUPCHAT) {
button.tooltip_text = "Channel details";
button.tooltip_text = Util.string_if_tooltips_active("Channel details");
} else {
button.tooltip_text = "Conversation details";
button.tooltip_text = Util.string_if_tooltips_active("Conversation details");
}
}

View File

@ -11,7 +11,7 @@ class OccupantsEntry : Plugins.ConversationTitlebarEntry, Object {
StreamInteractor stream_interactor;
private Conversation? conversation;
private MenuButton button = new MenuButton() { icon_name="system-users-symbolic", tooltip_text=_("Members") };
private MenuButton button = new MenuButton() { icon_name="system-users-symbolic", tooltip_text=Util.string_if_tooltips_active(_("Members")) };
private OccupantMenu.View menu = null;

View File

@ -9,7 +9,7 @@ public class SearchMenuEntry : Plugins.ConversationTitlebarEntry, Object {
public string id { get { return "search"; } }
public double order { get { return 1; } }
public ToggleButton button = new ToggleButton() { tooltip_text=_("Search messages") };
public ToggleButton button = new ToggleButton() { tooltip_text=Util.string_if_tooltips_active(_("Search messages")) };
public SearchMenuEntry() {
button.set_icon_name("system-search-symbolic");

View File

@ -440,4 +440,16 @@ public bool use_csd() {
return ((Application) GLib.Application.get_default()).use_csd();
}
public Widget? widget_if_tooltips_active(Widget w) {
return use_tooltips() ? w : null;
}
public string? string_if_tooltips_active(string s) {
return use_tooltips() ? s : null;
}
public bool use_tooltips() {
return Gtk.MINOR_VERSION != 6 || (Gtk.MICRO_VERSION < 4 || Gtk.MICRO_VERSION > 6);
}
}