[Gnucash-changes] r12295 - gnucash/trunk -
src/gnome-utils/gnc-main-window.c: Add gnc workaround function for
Christian Stimming
cstim at cvs.gnucash.org
Sun Jan 8 09:01:16 EST 2006
Author: cstim
Date: 2006-01-08 09:01:14 -0500 (Sun, 08 Jan 2006)
New Revision: 12295
Trac: http://svn.gnucash.org/trac/changeset/12295
Modified:
gnucash/trunk/ChangeLog
gnucash/trunk/src/gnome-utils/gnc-embedded-window.c
gnucash/trunk/src/gnome-utils/gnc-main-window.c
gnucash/trunk/src/gnome-utils/gnc-main-window.h
gnucash/trunk/src/gnome-utils/gnc-plugin-menu-additions.c
gnucash/trunk/src/gnome-utils/gnc-plugin-page.c
Log:
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.
Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog 2006-01-07 19:13:29 UTC (rev 12294)
+++ gnucash/trunk/ChangeLog 2006-01-08 14:01:14 UTC (rev 12295)
@@ -1,3 +1,10 @@
+2006-01-08 Christian Stimming <stimming at 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 at employees.org>
* src/report/standard-reports/account-summary.scm: Copy the table
Modified: gnucash/trunk/src/gnome-utils/gnc-embedded-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-embedded-window.c 2006-01-07 19:13:29 UTC (rev 12294)
+++ gnucash/trunk/src/gnome-utils/gnc-embedded-window.c 2006-01-08 14:01:14 UTC (rev 12295)
@@ -369,7 +369,7 @@
/* 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);
Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.c 2006-01-07 19:13:29 UTC (rev 12294)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.c 2006-01-08 14:01:14 UTC (rev 12295)
@@ -2158,7 +2158,7 @@
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 @@
/* 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 @@
}
+/* 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 */
+
/** @} */
/** @} */
Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.h
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.h 2006-01-07 19:13:29 UTC (rev 12294)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.h 2006-01-08 14:01:14 UTC (rev 12295)
@@ -273,6 +273,28 @@
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 */
Modified: gnucash/trunk/src/gnome-utils/gnc-plugin-menu-additions.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-plugin-menu-additions.c 2006-01-07 19:13:29 UTC (rev 12294)
+++ gnucash/trunk/src/gnome-utils/gnc-plugin-menu-additions.c 2006-01-08 14:01:14 UTC (rev 12295)
@@ -438,7 +438,7 @@
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);
Modified: gnucash/trunk/src/gnome-utils/gnc-plugin-page.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-plugin-page.c 2006-01-07 19:13:29 UTC (rev 12294)
+++ gnucash/trunk/src/gnome-utils/gnc-plugin-page.c 2006-01-08 14:01:14 UTC (rev 12295)
@@ -913,7 +913,7 @@
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;
}
More information about the gnucash-changes
mailing list