Commit 6b7f5ada authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen
Browse files

Reinstate the accidentally lost addition of

2004-10-09  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkactiongroup.h:
	* gtk/gtkactiongroup.c: Reinstate the accidentally lost addition
	of gtk_action_group_translate_string().
parent 4ef4bd0c
2004-10-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkactiongroup.h:
* gtk/gtkactiongroup.c: Reinstate the accidentally lost addition
of gtk_action_group_translate_string().
* gtk/gtkaccelgroup.h: Declare gtk_accelerator_get_label.
2004-10-08 Matthias Clasen <mclasen@redhat.com>
......
2004-10-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkactiongroup.h:
* gtk/gtkactiongroup.c: Reinstate the accidentally lost addition
of gtk_action_group_translate_string().
* gtk/gtkaccelgroup.h: Declare gtk_accelerator_get_label.
2004-10-08 Matthias Clasen <mclasen@redhat.com>
......
2004-10-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkactiongroup.h:
* gtk/gtkactiongroup.c: Reinstate the accidentally lost addition
of gtk_action_group_translate_string().
* gtk/gtkaccelgroup.h: Declare gtk_accelerator_get_label.
2004-10-08 Matthias Clasen <mclasen@redhat.com>
......
2004-10-09 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkactiongroup.h:
* gtk/gtkactiongroup.c: Reinstate the accidentally lost addition
of gtk_action_group_translate_string().
* gtk/gtkaccelgroup.h: Declare gtk_accelerator_get_label.
2004-10-08 Matthias Clasen <mclasen@redhat.com>
......
......@@ -744,15 +744,10 @@ gtk_action_group_add_actions_full (GtkActionGroup *action_group,
* gtk_action_group_add_..._actions_full() functions.
*/
guint i;
GtkTranslateFunc translate_func;
gpointer translate_data;
SharedData *shared_data;
g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
translate_func = action_group->private_data->translate_func;
translate_data = action_group->private_data->translate_data;
shared_data = g_new0 (SharedData, 1);
shared_data->ref_count = 1;
shared_data->data = user_data;
......@@ -764,16 +759,8 @@ gtk_action_group_add_actions_full (GtkActionGroup *action_group,
const gchar *label;
const gchar *tooltip;
if (translate_func)
{
label = translate_func (entries[i].label, translate_data);
tooltip = translate_func (entries[i].tooltip, translate_data);
}
else
{
label = entries[i].label;
tooltip = entries[i].tooltip;
}
label = gtk_action_group_translate_string (action_group, entries[i].label);
tooltip = gtk_action_group_translate_string (action_group, entries[i].tooltip);
action = gtk_action_new (entries[i].name,
label,
......@@ -853,15 +840,10 @@ gtk_action_group_add_toggle_actions_full (GtkActionGroup *action_gro
* gtk_action_group_add_..._actions_full() functions.
*/
guint i;
GtkTranslateFunc translate_func;
gpointer translate_data;
SharedData *shared_data;
g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
translate_func = action_group->private_data->translate_func;
translate_data = action_group->private_data->translate_data;
shared_data = g_new0 (SharedData, 1);
shared_data->ref_count = 1;
shared_data->data = user_data;
......@@ -873,16 +855,8 @@ gtk_action_group_add_toggle_actions_full (GtkActionGroup *action_gro
const gchar *label;
const gchar *tooltip;
if (translate_func)
{
label = translate_func (entries[i].label, translate_data);
tooltip = translate_func (entries[i].tooltip, translate_data);
}
else
{
label = entries[i].label;
tooltip = entries[i].tooltip;
}
label = gtk_action_group_translate_string (action_group, entries[i].label);
tooltip = gtk_action_group_translate_string (action_group, entries[i].tooltip);
action = gtk_toggle_action_new (entries[i].name,
label,
......@@ -974,32 +948,19 @@ gtk_action_group_add_radio_actions_full (GtkActionGroup *action_group
* gtk_action_group_add_..._actions_full() functions.
*/
guint i;
GtkTranslateFunc translate_func;
gpointer translate_data;
GSList *group = NULL;
GtkRadioAction *first_action = NULL;
g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
translate_func = action_group->private_data->translate_func;
translate_data = action_group->private_data->translate_data;
for (i = 0; i < n_entries; i++)
{
GtkRadioAction *action;
const gchar *label;
const gchar *tooltip;
if (translate_func)
{
label = translate_func (entries[i].label, translate_data);
tooltip = translate_func (entries[i].tooltip, translate_data);
}
else
{
label = entries[i].label;
tooltip = entries[i].tooltip;
}
label = gtk_action_group_translate_string (action_group, entries[i].label);
tooltip = gtk_action_group_translate_string (action_group, entries[i].tooltip);
action = gtk_radio_action_new (entries[i].name,
label,
......@@ -1093,6 +1054,37 @@ gtk_action_group_set_translation_domain (GtkActionGroup *action_group,
g_free);
}
/**
* gtk_action_group_translate_string:
* @action_group: a #GtkActionGroup
* @string: a string
*
* Translates a string using the specified translate_func(). This
* is mainly intended for language bindings.
*
* Returns: the translation of @string
*
* Since: 2.6
**/
G_CONST_RETURN gchar *
gtk_action_group_translate_string (GtkActionGroup *action_group,
const gchar *string)
{
GtkTranslateFunc translate_func;
gpointer translate_data;
g_return_val_if_fail (GTK_IS_ACTION_GROUP (action_group), string);
translate_func = action_group->private_data->translate_func;
translate_data = action_group->private_data->translate_data;
if (translate_func)
return translate_func (string, translate_data);
else
return string;
}
/* Protected for use by GtkAction */
void
_gtk_action_group_emit_connect_proxy (GtkActionGroup *action_group,
......
......@@ -159,7 +159,8 @@ void gtk_action_group_set_translate_func (GtkActionGroup
GtkDestroyNotify notify);
void gtk_action_group_set_translation_domain (GtkActionGroup *action_group,
const gchar *domain);
G_CONST_RETURN gchar *gtk_action_group_translate_string (GtkActionGroup *action_group,
const gchar *string);
/* Protected for use by GtkAction */
void _gtk_action_group_emit_connect_proxy (GtkActionGroup *action_group,
......
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