Commit ea3ea771 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

shortcut: show a different message when the shortcut is already assigned

parent 50dbde53
......@@ -153,36 +153,60 @@ row_data_update_shortcut (RowData *row_data,
modifiers);
if (shortcut != NULL) {
char *label;
char *msg;
GtkWidget *dialog;
gboolean reassign;
label = gtk_accelerator_get_label (keycode, modifiers);
msg = g_strdup_printf (_("The %s shortcut is already assigned to the action «%s». Do you want to reassign it to «%s» instead?"),
label,
shortcut->description,
row_data->shortcut->description);
dialog = _gtk_yesno_dialog_new (parent,
GTK_DIALOG_MODAL,
msg,
_GTK_LABEL_CANCEL,
_("Reassign"));
reassign = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES;
gtk_widget_destroy (GTK_WIDGET (dialog));
if (reassign) {
gth_shortcut_set_key (shortcut, 0, 0);
row_data_update_accel_label (find_row_by_shortcut (row_data->browser_data, shortcut));
if (g_strcmp0 (shortcut->action_name, row_data->shortcut->action_name) != 0) {
char *label;
char *msg;
GtkWidget *dialog;
gboolean reassign;
label = gtk_accelerator_get_label (keycode, modifiers);
msg = g_strdup_printf (_("The key combination «%s» is already assigned to the action «%s». Do you want to reassign it to «%s» instead?"),
label,
shortcut->description,
row_data->shortcut->description);
dialog = _gtk_yesno_dialog_new (parent,
GTK_DIALOG_MODAL,
msg,
_GTK_LABEL_CANCEL,
_("Reassign"));
reassign = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES;
gtk_widget_destroy (GTK_WIDGET (dialog));
if (reassign) {
gth_shortcut_set_key (shortcut, 0, 0);
row_data_update_accel_label (find_row_by_shortcut (row_data->browser_data, shortcut));
}
g_free (msg);
g_free (label);
if (! reassign)
return FALSE;
}
else {
char *label;
char *msg;
GtkWidget *dialog;
label = gtk_accelerator_get_label (keycode, modifiers);
msg = g_strdup_printf (_("The key combination «%s» is already assigned to this action."), label);
dialog = _gtk_message_dialog_new (parent,
GTK_DIALOG_MODAL,
_GTK_ICON_NAME_DIALOG_INFO,
msg,
NULL,
_GTK_LABEL_CLOSE, GTK_RESPONSE_CANCEL,
NULL);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog));
g_free (msg);
g_free (label);
g_free (msg);
g_free (label);
if (! reassign)
return FALSE;
}
}
gth_shortcut_set_key (row_data->shortcut, keycode, modifiers);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment