src/gnome-utils/gnc-main-window.c: Add gnc workaround function for

errorneous gtk_action_group_set_translation_domain. Fixes the
statusbar-tooltip error mentioned on 2006-01-07. Filed in gtk as
bug#326200.



git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12295 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2006-01-08 14:01:14 +00:00
parent e5a2e3b155
commit 8b2ba203b1
6 changed files with 66 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2006-01-08 Christian Stimming <stimming@tuhh.de>
* src/gnome-utils/gnc-main-window.c: Add gnc workaround function
for errorneous gtk_action_group_set_translation_domain. Fixes the
statusbar-tooltip error mentioned on 2006-01-07. Filed in gtk as
bug#326200.
2006-01-07 David Hampton <hampton@employees.org>
* src/report/standard-reports/account-summary.scm: Copy the table

View File

@ -369,7 +369,7 @@ gnc_embedded_window_new (const gchar *action_group_name,
/* Create menu and toolbar information */
priv->action_group = gtk_action_group_new (action_group_name);
gtk_action_group_set_translation_domain(priv->action_group, GETTEXT_PACKAGE);
gnc_gtk_action_group_set_translation_domain(priv->action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions (priv->action_group, action_entries,
n_action_entries, user_data);
gtk_ui_manager_insert_action_group (window->ui_merge, priv->action_group, 0);

View File

@ -2158,7 +2158,7 @@ gnc_main_window_merge_actions (GncMainWindow *window,
priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
entry = g_new0 (MergedActionEntry, 1);
entry->action_group = gtk_action_group_new (group_name);
gtk_action_group_set_translation_domain (entry->action_group, GETTEXT_PACKAGE);
gnc_gtk_action_group_set_translation_domain (entry->action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions (entry->action_group, actions, n_actions, data);
gtk_ui_manager_insert_action_group (window->ui_merge, entry->action_group, 0);
entry->merge_id = gtk_ui_manager_add_ui_from_file (window->ui_merge, pathname, &error);
@ -2466,7 +2466,7 @@ gnc_main_window_setup_window (GncMainWindow *window)
/* Create menu and toolbar information */
priv->action_group = gtk_action_group_new ("MainWindowActions");
gtk_action_group_set_translation_domain (priv->action_group, GETTEXT_PACKAGE);
gnc_gtk_action_group_set_translation_domain (priv->action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions (priv->action_group, gnc_menu_actions,
gnc_menu_n_actions, window);
gtk_action_group_add_toggle_actions (priv->action_group,
@ -3270,5 +3270,37 @@ gnc_main_window_button_press_cb (GtkWidget *whatever,
}
/* CS: Code copied from gtk/gtkactiongroup.c */
static gchar *
dgettext_swapped (const gchar *msgid,
const gchar *domainname)
{
/* CS: Pass this through dgettext if and only if msgid is
nonempty. */
return (msgid && *msgid) ? dgettext (domainname, msgid) : (gchar*) msgid;
}
/*
* This is copied into GnuCash from Gtk in order to fix problems when
* empty msgids were passed through gettext().
*
* See http://bugzilla.gnome.org/show_bug.cgi?id=326200 . If that bug
* is fixed in the gtk that we can rely open, then
* gnc_gtk_action_group_set_translation_domain can be replaced by
* gtk_action_group_set_translation_domain again.
*/
void
gnc_gtk_action_group_set_translation_domain (GtkActionGroup *action_group,
const gchar *domain)
{
g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
gtk_action_group_set_translate_func (action_group,
(GtkTranslateFunc)dgettext_swapped,
g_strdup (domain),
g_free);
}
/* CS: End of code copied from gtk/gtkactiongroup.c */
/** @} */
/** @} */

View File

@ -273,6 +273,28 @@ void gnc_main_window_set_progressbar_window( GncMainWindow *window );
gboolean gnc_main_window_button_press_cb (GtkWidget *whatever,
GdkEventButton *event,
GncPluginPage *page);
/**
* gnc_gtk_action_group_set_translation_domain:
* @action_group: a #GtkActionGroup
* @domain: the translation domain to use for dgettext() calls
*
* Sets the translation domain and uses dgettext() for translating the
* @label and @tooltip of #GtkActionEntry<!-- -->s added by
* gtk_action_group_add_actions().
*
* This is copied from gtk's gtk_action_group_set_translation_domain()
* into GnuCash in order to fix problems when empty msgids were passed
* through gettext().
*
* See http://bugzilla.gnome.org/show_bug.cgi?id=326200 . If that bug
* is fixed in the gtk that we can rely open, then
* gnc_gtk_action_group_set_translation_domain can be replaced by
* gtk_action_group_set_translation_domain again.
**/
void
gnc_gtk_action_group_set_translation_domain (GtkActionGroup *action_group,
const gchar *domain);
G_END_DECLS
#endif /* __GNC_MAIN_WINDOW_H */

View File

@ -438,7 +438,7 @@ gnc_plugin_menu_additions_add_to_window (GncPlugin *plugin,
per_window.window = window;
per_window.ui_manager = window->ui_merge;
per_window.group = gtk_action_group_new ("MenuAdditions" );
gtk_action_group_set_translation_domain (per_window.group, GETTEXT_PACKAGE);
gnc_gtk_action_group_set_translation_domain (per_window.group, GETTEXT_PACKAGE);
per_window.merge_id = gtk_ui_manager_new_merge_id(window->ui_merge);
gtk_ui_manager_insert_action_group(window->ui_merge, per_window.group, 0);

View File

@ -913,7 +913,7 @@ gnc_plugin_page_create_action_group (GncPluginPage *page, const gchar *group_nam
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
group = gtk_action_group_new(group_name);
gtk_action_group_set_translation_domain(group, GETTEXT_PACKAGE);
gnc_gtk_action_group_set_translation_domain(group, GETTEXT_PACKAGE);
priv->action_group = group;
return group;
}