0.1.0 fixes
This commit is contained in:
18
src/main.cpp
18
src/main.cpp
@@ -74,7 +74,12 @@ static void refresh_footer() {
|
||||
std::string text;
|
||||
if (!daemonView.reachable) {
|
||||
text = _("Daemon: not reachable");
|
||||
// Hint for users who installed the package but did not (or could not)
|
||||
// enable the daemon service during installation.
|
||||
gtk_widget_set_tooltip_text(daemonLabel,
|
||||
_("Run: systemctl --user enable --now gkeymapper-daemon"));
|
||||
} else {
|
||||
gtk_widget_set_tooltip_text(daemonLabel, nullptr);
|
||||
text = _("Daemon: running");
|
||||
text += " · ";
|
||||
if (daemonView.device.empty()) {
|
||||
@@ -685,14 +690,16 @@ void build_ui(GtkApplication* app, bool show) {
|
||||
|
||||
// GTK draws the check mark of the selected entry right behind the text of a
|
||||
// dropdown row, so every entry carries a trailing space. The catalogs keep
|
||||
// the bare words; the space is added here, where the model is built.
|
||||
// the bare words; the space is added here, where the model is built. The
|
||||
// strings are copied by gtk_drop_down_new_from_strings, so the array can be
|
||||
// freed once every dropdown has been created.
|
||||
const char* typeOptions[] = { _("Key"), _("Command"), _("Disabled"),
|
||||
_("Key (hold)"), nullptr };
|
||||
g_autoptr(GtkStringList) typeModel = gtk_string_list_new(nullptr);
|
||||
char** typeShown = g_new(char*, 5);
|
||||
for (int i = 0; typeOptions[i] != nullptr; ++i) {
|
||||
g_autofree gchar* shown = g_strconcat(typeOptions[i], " ", nullptr);
|
||||
gtk_string_list_append(typeModel, shown);
|
||||
typeShown[i] = g_strconcat(typeOptions[i], " ", nullptr);
|
||||
}
|
||||
typeShown[4] = nullptr;
|
||||
|
||||
rows.resize(kNumKeys);
|
||||
for (int i = 0; i < kNumKeys; ++i) {
|
||||
@@ -706,7 +713,7 @@ void build_ui(GtkApplication* app, bool show) {
|
||||
rows[i].keyLabel = keyLabel;
|
||||
|
||||
// Type dropdown (fixed width so rows don't jump between languages)
|
||||
GtkWidget* drop = gtk_drop_down_new(G_LIST_MODEL(typeModel), nullptr);
|
||||
GtkWidget* drop = gtk_drop_down_new_from_strings((const char* const*)typeShown);
|
||||
gtk_drop_down_set_selected(GTK_DROP_DOWN(drop), 0);
|
||||
gtk_widget_set_size_request(drop, 150, -1);
|
||||
gtk_grid_attach(GTK_GRID(grid), drop, 1, i + 1, 1, 1);
|
||||
@@ -731,6 +738,7 @@ void build_ui(GtkApplication* app, bool show) {
|
||||
|
||||
update_row_state(&rows[i]);
|
||||
}
|
||||
g_strfreev(typeShown);
|
||||
|
||||
// Start from the rows the replaced instance had on screen, or - when this is
|
||||
// the only instance - from the saved mappings. Without either the rows are
|
||||
|
||||
Reference in New Issue
Block a user