Commit 4ddff97c1c5144654c4cc93e5bc6db74c5665b5d
1 parent
caded473
Exists in
master
and in
1 other branch
Fixing accelerator edit.
Showing
5 changed files
with
9 additions
and
21 deletions
Show diff stats
src/dialogs/settings/accelerator.c
| @@ -550,7 +550,7 @@ static gboolean add_accel(GtkTreeModel *model, GtkTreePath G_GNUC_UNUSED(*path), | @@ -550,7 +550,7 @@ static gboolean add_accel(GtkTreeModel *model, GtkTreePath G_GNUC_UNUSED(*path), | ||
| 550 | } | 550 | } |
| 551 | 551 | ||
| 552 | // Allways create the "main" accelerator to keep the action active. | 552 | // Allways create the "main" accelerator to keep the action active. |
| 553 | - V3270Accelerator * acc = v3270_accelerator_copy(accel); | 553 | + V3270Accelerator * acc = v3270_accelerator_clone(accel); |
| 554 | acc->key = keymap[0].key; | 554 | acc->key = keymap[0].key; |
| 555 | acc->mods = keymap[0].mods; | 555 | acc->mods = keymap[0].mods; |
| 556 | *accelerators = g_slist_prepend(*accelerators,acc); | 556 | *accelerators = g_slist_prepend(*accelerators,acc); |
| @@ -558,7 +558,7 @@ static gboolean add_accel(GtkTreeModel *model, GtkTreePath G_GNUC_UNUSED(*path), | @@ -558,7 +558,7 @@ static gboolean add_accel(GtkTreeModel *model, GtkTreePath G_GNUC_UNUSED(*path), | ||
| 558 | // The alternative one is created only when set. | 558 | // The alternative one is created only when set. |
| 559 | if(keymap[1].key) | 559 | if(keymap[1].key) |
| 560 | { | 560 | { |
| 561 | - acc = v3270_accelerator_copy(accel); | 561 | + acc = v3270_accelerator_clone(accel); |
| 562 | acc->key = keymap[1].key; | 562 | acc->key = keymap[1].key; |
| 563 | acc->mods = keymap[1].mods; | 563 | acc->mods = keymap[1].mods; |
| 564 | *accelerators = g_slist_prepend(*accelerators,acc); | 564 | *accelerators = g_slist_prepend(*accelerators,acc); |
src/include/v3270/actions.h
| @@ -98,7 +98,7 @@ | @@ -98,7 +98,7 @@ | ||
| 98 | /// @return A newly-allocated string representing the accelerator. | 98 | /// @return A newly-allocated string representing the accelerator. |
| 99 | LIB3270_EXPORT gchar * v3270_accelerator_get_label(const V3270Accelerator * accel); | 99 | LIB3270_EXPORT gchar * v3270_accelerator_get_label(const V3270Accelerator * accel); |
| 100 | 100 | ||
| 101 | - LIB3270_EXPORT V3270Accelerator * v3270_accelerator_copy(const V3270Accelerator *accel); | 101 | + LIB3270_EXPORT V3270Accelerator * v3270_accelerator_clone(const V3270Accelerator *accel); |
| 102 | LIB3270_EXPORT const V3270Accelerator * v3270_accelerator_map_lookup_entry(GtkWidget *widget, guint keyval, GdkModifierType state); | 102 | LIB3270_EXPORT const V3270Accelerator * v3270_accelerator_map_lookup_entry(GtkWidget *widget, guint keyval, GdkModifierType state); |
| 103 | 103 | ||
| 104 | G_END_DECLS | 104 | G_END_DECLS |
src/terminal/keyboard/accelerator.c
| @@ -36,7 +36,7 @@ | @@ -36,7 +36,7 @@ | ||
| 36 | 36 | ||
| 37 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 37 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 38 | 38 | ||
| 39 | - V3270Accelerator * v3270_accelerator_copy(const V3270Accelerator *accel) | 39 | + V3270Accelerator * v3270_accelerator_clone(const V3270Accelerator *accel) |
| 40 | { | 40 | { |
| 41 | V3270Accelerator * rc = NULL; | 41 | V3270Accelerator * rc = NULL; |
| 42 | 42 | ||
| @@ -187,10 +187,7 @@ | @@ -187,10 +187,7 @@ | ||
| 187 | case V3270_ACCELERATOR_TYPE_PFKEY: | 187 | case V3270_ACCELERATOR_TYPE_PFKEY: |
| 188 | 188 | ||
| 189 | if( ((V3270PFKeyAccelerator *)accel)->description ) | 189 | if( ((V3270PFKeyAccelerator *)accel)->description ) |
| 190 | - return ((V3270PFKeyAccelerator *)accel)->description; | ||
| 191 | - | ||
| 192 | - if( ((V3270PFKeyAccelerator *)accel)->name ) | ||
| 193 | - return ((V3270PFKeyAccelerator *)accel)->name; | 190 | + return gettext(((V3270PFKeyAccelerator *)accel)->description); |
| 194 | 191 | ||
| 195 | break; | 192 | break; |
| 196 | 193 |
src/terminal/keyboard/init.c
| @@ -218,7 +218,6 @@ | @@ -218,7 +218,6 @@ | ||
| 218 | accelerator->parent.arg = (gconstpointer) accelerator; | 218 | accelerator->parent.arg = (gconstpointer) accelerator; |
| 219 | accelerator->parent.activate = G_CALLBACK(fire_pfkey_action); | 219 | accelerator->parent.activate = G_CALLBACK(fire_pfkey_action); |
| 220 | 220 | ||
| 221 | - debug("****************************%p [%s]",accelerator,accelerator->name); | ||
| 222 | widget->accelerators = g_slist_prepend(widget->accelerators,accelerator); | 221 | widget->accelerators = g_slist_prepend(widget->accelerators,accelerator); |
| 223 | 222 | ||
| 224 | } | 223 | } |
src/terminal/keyboard/keyfile.c
| @@ -154,23 +154,15 @@ | @@ -154,23 +154,15 @@ | ||
| 154 | debug("Creating special accelerator %s",v3270_accelerator_get_name(accel)); | 154 | debug("Creating special accelerator %s",v3270_accelerator_get_name(accel)); |
| 155 | 155 | ||
| 156 | // Remap PFKey accelerator | 156 | // Remap PFKey accelerator |
| 157 | - V3270PFKeyAccelerator *pfAccel = g_new0(V3270PFKeyAccelerator,1); | ||
| 158 | - | ||
| 159 | - pfAccel->keycode = (unsigned short) pfkey; | ||
| 160 | - pfAccel->name = ((V3270PFKeyAccelerator *) accel)->name; | ||
| 161 | - pfAccel->parent.type = V3270_ACCELERATOR_TYPE_PFKEY; | ||
| 162 | - pfAccel->parent.key = accel->key; | ||
| 163 | - pfAccel->parent.mods = accel->mods; | ||
| 164 | - pfAccel->parent.arg = (gconstpointer) pfAccel; | ||
| 165 | - pfAccel->parent.activate = G_CALLBACK(fire_pfkey_action); | ||
| 166 | - | ||
| 167 | - terminal->accelerators = g_slist_prepend(terminal->accelerators,pfAccel); | 157 | + V3270Accelerator * acc = v3270_accelerator_clone(accel); |
| 158 | + ((V3270PFKeyAccelerator *) acc)->keycode = (unsigned short) pfkey; | ||
| 159 | + terminal->accelerators = g_slist_prepend(terminal->accelerators,acc); | ||
| 168 | 160 | ||
| 169 | } | 161 | } |
| 170 | else | 162 | else |
| 171 | { | 163 | { |
| 172 | // Standard accelerator. | 164 | // Standard accelerator. |
| 173 | - V3270Accelerator * acc = v3270_accelerator_copy(accel); | 165 | + V3270Accelerator * acc = v3270_accelerator_clone(accel); |
| 174 | gtk_accelerator_parse(keycodes[ix],&acc->key,&acc->mods); | 166 | gtk_accelerator_parse(keycodes[ix],&acc->key,&acc->mods); |
| 175 | acc->key = gdk_keyval_to_lower(acc->key); | 167 | acc->key = gdk_keyval_to_lower(acc->key); |
| 176 | terminal->accelerators = g_slist_prepend(terminal->accelerators,acc); | 168 | terminal->accelerators = g_slist_prepend(terminal->accelerators,acc); |