forked from AuroraMiddleware/gtk
New function to translate a string with translate_func. (#135740)
Thu May 6 00:24:11 2004 Matthias Clasen <maclas@gmx.de> * gtk/gtkactiongroup.h: * gtk/gtkactiongroup.c (gtk_action_group_translate_string): New function to translate a string with translate_func. (#135740)
This commit is contained in:
parent
3d01ab5f5a
commit
262dc2d7d3
@ -1,3 +1,10 @@
|
||||
Thu May 6 00:24:11 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkactiongroup.h:
|
||||
* gtk/gtkactiongroup.c (gtk_action_group_translate_string):
|
||||
New function to translate a string with translate_func.
|
||||
(#135740)
|
||||
|
||||
Thu May 6 00:02:21 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkcombobox.c (gtk_combo_box_get_wrap_width):
|
||||
|
@ -1,3 +1,10 @@
|
||||
Thu May 6 00:24:11 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkactiongroup.h:
|
||||
* gtk/gtkactiongroup.c (gtk_action_group_translate_string):
|
||||
New function to translate a string with translate_func.
|
||||
(#135740)
|
||||
|
||||
Thu May 6 00:02:21 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkcombobox.c (gtk_combo_box_get_wrap_width):
|
||||
|
@ -1,3 +1,10 @@
|
||||
Thu May 6 00:24:11 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkactiongroup.h:
|
||||
* gtk/gtkactiongroup.c (gtk_action_group_translate_string):
|
||||
New function to translate a string with translate_func.
|
||||
(#135740)
|
||||
|
||||
Thu May 6 00:02:21 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkcombobox.c (gtk_combo_box_get_wrap_width):
|
||||
|
@ -1,3 +1,10 @@
|
||||
Thu May 6 00:24:11 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkactiongroup.h:
|
||||
* gtk/gtkactiongroup.c (gtk_action_group_translate_string):
|
||||
New function to translate a string with translate_func.
|
||||
(#135740)
|
||||
|
||||
Thu May 6 00:02:21 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtkcombobox.c (gtk_combo_box_get_wrap_width):
|
||||
|
@ -1,3 +1,7 @@
|
||||
Thu May 6 00:22:38 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtk-sections.txt: Add gtk_action_group_translate_string()
|
||||
|
||||
Thu May 6 00:04:03 2004 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtk-sections.txt: Add missing getters.
|
||||
|
@ -175,6 +175,7 @@ gtk_action_group_add_radio_actions
|
||||
gtk_action_group_add_radio_actions_full
|
||||
gtk_action_group_set_translate_func
|
||||
gtk_action_group_set_translation_domain
|
||||
gtk_action_group_translate_string
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_ACTION_GROUP
|
||||
GTK_ACTION_GROUP
|
||||
|
@ -738,15 +738,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;
|
||||
@ -758,16 +753,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,
|
||||
@ -847,15 +834,10 @@ gtk_action_group_add_toggle_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;
|
||||
@ -867,16 +849,8 @@ gtk_action_group_add_toggle_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_toggle_action_new (entries[i].name,
|
||||
label,
|
||||
@ -968,32 +942,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,
|
||||
@ -1087,6 +1048,36 @@ 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
|
||||
**/
|
||||
gchar *
|
||||
gtk_action_group_translate_string (GtkActionGroup *action_group,
|
||||
const gchar *string)
|
||||
{
|
||||
GtkTranslateFunc translate_func;
|
||||
gpointer translate_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;
|
||||
|
||||
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,
|
||||
|
@ -160,6 +160,8 @@ void gtk_action_group_set_translate_func (GtkActionGroup *
|
||||
GtkDestroyNotify notify);
|
||||
void gtk_action_group_set_translation_domain (GtkActionGroup *action_group,
|
||||
const gchar *domain);
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user