Commit 2aa325a5 authored by Jehan's avatar Jehan
Browse files

libgimpwidgets: new gimp_spin_scale_get_mnemonic_keyval() function.

This solves part of #8524, for properties displaying as spin scale, which have a
mnemonic, yet our code was not able to tell so.
parent e4ace369
......@@ -2106,9 +2106,12 @@ gimp_procedure_dialog_check_mnemonic (GimpProcedureDialog *dialog,
g_list_free (labels);
}
if (label &&
(mnemonic = gtk_label_get_mnemonic_keyval (GTK_LABEL (label))) &&
mnemonic != GDK_KEY_VoidSymbol)
if (label)
mnemonic = gtk_label_get_mnemonic_keyval (GTK_LABEL (label));
else if (GIMP_IS_SPIN_SCALE (widget))
mnemonic = gimp_spin_scale_get_mnemonic_keyval (GIMP_SPIN_SCALE (widget));
if (mnemonic != GDK_KEY_VoidSymbol)
{
duplicate = g_hash_table_lookup (dialog->priv->core_mnemonics, GINT_TO_POINTER (mnemonic));
if (duplicate && g_strcmp0 (duplicate, id ? id : core_id) != 0)
......
......@@ -1484,3 +1484,20 @@ gimp_spin_scale_get_constrain_drag (GimpSpinScale *scale)
return GET_PRIVATE (scale)->constrain_drag;
}
/**
* gimp_spin_scale_get_mnemonic_keyval:
* @scale: the #GimpSpinScale.
*
* If @scale has been set with a mnemonic key in its label text, this function
* returns the keyval used for the mnemonic accelerator.
*
* Returns: the keyval usable for accelerators, or [const@Gdk.KEY_VoidSymbol].
*/
const guint
gimp_spin_scale_get_mnemonic_keyval (GimpSpinScale *scale)
{
g_return_val_if_fail (GIMP_IS_SPIN_SCALE (scale), GDK_KEY_VoidSymbol);
return GET_PRIVATE (scale)->mnemonic_keyval;
}
......@@ -52,32 +52,33 @@ struct _GimpSpinScaleClass
};
GType gimp_spin_scale_get_type (void) G_GNUC_CONST;
GType gimp_spin_scale_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_spin_scale_new (GtkAdjustment *adjustment,
const gchar *label,
gint digits);
GtkWidget * gimp_spin_scale_new (GtkAdjustment *adjustment,
const gchar *label,
gint digits);
void gimp_spin_scale_set_label (GimpSpinScale *scale,
const gchar *label);
const gchar * gimp_spin_scale_get_label (GimpSpinScale *scale);
void gimp_spin_scale_set_label (GimpSpinScale *scale,
const gchar *label);
const gchar * gimp_spin_scale_get_label (GimpSpinScale *scale);
void gimp_spin_scale_set_scale_limits (GimpSpinScale *scale,
gdouble lower,
gdouble upper);
void gimp_spin_scale_unset_scale_limits (GimpSpinScale *scale);
gboolean gimp_spin_scale_get_scale_limits (GimpSpinScale *scale,
gdouble *lower,
gdouble *upper);
void gimp_spin_scale_set_scale_limits (GimpSpinScale *scale,
gdouble lower,
gdouble upper);
void gimp_spin_scale_unset_scale_limits (GimpSpinScale *scale);
gboolean gimp_spin_scale_get_scale_limits (GimpSpinScale *scale,
gdouble *lower,
gdouble *upper);
void gimp_spin_scale_set_gamma (GimpSpinScale *scale,
gdouble gamma);
gdouble gimp_spin_scale_get_gamma (GimpSpinScale *scale);
void gimp_spin_scale_set_gamma (GimpSpinScale *scale,
gdouble gamma);
gdouble gimp_spin_scale_get_gamma (GimpSpinScale *scale);
void gimp_spin_scale_set_constrain_drag (GimpSpinScale *scale,
gboolean constrain);
gboolean gimp_spin_scale_get_constrain_drag (GimpSpinScale *scale);
void gimp_spin_scale_set_constrain_drag (GimpSpinScale *scale,
gboolean constrain);
gboolean gimp_spin_scale_get_constrain_drag (GimpSpinScale *scale);
const guint gimp_spin_scale_get_mnemonic_keyval (GimpSpinScale *scale);
G_END_DECLS
......
......@@ -454,6 +454,7 @@ EXPORTS
gimp_spin_scale_get_constrain_drag
gimp_spin_scale_get_gamma
gimp_spin_scale_get_label
gimp_spin_scale_get_mnemonic_keyval
gimp_spin_scale_get_scale_limits
gimp_spin_scale_get_type
gimp_spin_scale_new
......
Supports Markdown
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