fix: row titles mean their mnemonics instead of drawing the underscore
Fifteen display strings in the two preference forms were written as GTK mnemonics -- `_Directory`, `_Server`, `Multicast _group`, `_Theme` and the rest -- but the property that makes GTK read them was never set, so GTK drew the underscore literally: `_Directory` in the row, not a D with a line under it. Two switches are involved, FALSE by default in each case. `GtkLabel`/`GtkButton` take `use-underline`; the rows take `AdwPreferencesRow:use-underline`, "whether an embedded underline in the title indicates a mnemonic". The two buttons in the source form already set it (so their mnemonics worked and showed no underscore); the thirteen rows did not. All thirteen now do. The row classes that carry the property are not all related -- AdwEntryRow has its own, while AdwSpinRow, AdwComboRow and AdwSwitchRow get it through AdwActionRow -- so the probe reads it by name on a GObject (g_object_class_find_property, then g_object_get) rather than casting to one row type; a cast to a `GtkWidget*` where the type is only forward-declared does not compile at all. `_Cancel` and `_Connect` both claimed C in the same form, so Alt+C could only reach one of them: that marker was unreachable, which is worse than absent because it is in the source to be trusted. `_Connect` becomes `Conn_ect`, freeing C for Cancel. [prefs-probe] reads the count (4/4) on the real widgets; check_ui validates the property against the GIR for every object in every .ui file, inherited properties included.
This commit is contained in:
1 parent
2d9f327da7
commit
f00d161900
8 files changed
+78
-1
No files matched your search
@@ -29,6 +29,23 @@
|
||||
|
||||
#include "settings.hpp"
|
||||
|
||||
/// Whether a row asks for `use-underline` -- the property (default FALSE) that makes a `_` in a row's title
|
||||
/// a mnemonic. Without it GTK draws the underscore as a literal character, which is what `_Directory` and the
|
||||
/// other row titles did.
|
||||
///
|
||||
/// Asked for by *name* on a plain `GObject`: the row classes that carry the property are not all related
|
||||
/// (`AdwEntryRow`'s `use-underline` is its own, `AdwSpinRow`/`AdwComboRow`/`AdwSwitchRow`'s come through
|
||||
/// `AdwActionRow`), so a common getter or a cast to one row type would miss half of them -- and passing a
|
||||
/// row as a `GtkWidget*` where the type is only forward-declared does not even compile. A class without the
|
||||
/// property answers false rather than crashing.
|
||||
inline bool row_underlines(GObject* row) {
|
||||
if (row == nullptr) return false;
|
||||
if (g_object_class_find_property(G_OBJECT_GET_CLASS(row), "use-underline") == nullptr) return false;
|
||||
gboolean on = FALSE;
|
||||
g_object_get(row, "use-underline", &on, nullptr);
|
||||
return on != FALSE;
|
||||
}
|
||||
|
||||
namespace udpscope {
|
||||
namespace ui_impl {
|
||||
|
||||
|
||||
Reference in new issue
Block a user