Drop code to work around gtk bug 326200 (bugzilla)

This bug has been fixed in 2006 and I have verified the version of gtk we
currently depend on carries this fix.
This commit is contained in:
Geert Janssens
2018-11-03 18:20:55 +01:00
parent 0467dd0b92
commit 2283df719a
7 changed files with 8 additions and 65 deletions

View File

@@ -382,7 +382,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);
gnc_gtk_action_group_set_translation_domain(priv->action_group, GETTEXT_PACKAGE);
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

@@ -3197,7 +3197,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);
gnc_gtk_action_group_set_translation_domain (entry->action_group, GETTEXT_PACKAGE);
gtk_action_group_set_translation_domain (entry->action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions (entry->action_group, actions, n_actions, data);
if (toggle_actions != NULL && n_toggle_actions > 0)
{
@@ -3645,7 +3645,7 @@ gnc_main_window_setup_window (GncMainWindow *window)
/* Create menu and toolbar information */
priv->action_group = gtk_action_group_new ("MainWindowActions");
gnc_gtk_action_group_set_translation_domain (priv->action_group, GETTEXT_PACKAGE);
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,
@@ -4877,39 +4877,6 @@ gnc_main_window_button_press_cb (GtkWidget *whatever,
return FALSE;
}
/* 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().
*
* TODO: See https://bugzilla.gnome.org/show_bug.cgi?id=326200 . If that bug
* is fixed in the gtk that we can rely on, 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 */
void
gnc_main_window_all_action_set_sensitive (const gchar *action_name,
gboolean sensitive)

View File

@@ -356,28 +356,6 @@ void gnc_main_window_save_all_windows(GKeyFile *keyfile);
*/
void gnc_main_window_restore_default_state(GncMainWindow *window);
/**
* gnc_gtk_action_group_set_translation_domain:
* @param action_group a #GtkActionGroup
* @param domain the translation domain to use for dgettext() calls
*
* Sets the translation domain and uses dgettext() for translating the
* @a label and @a 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 https://bugs.gnucash.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);
/** Tell a window to finish any outstanding activities. This function
* will call gnc_plugin_page_finish_pending for each installed page.

View File

@@ -41,7 +41,6 @@
#include "guile-util.h"
#include "gnc-engine.h"
#include "gnc-main-window.h"
#include "gnc-plugin-menu-additions.h"
#include "gnc-window.h"
#include "gnc-ui.h"
@@ -452,7 +451,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" );
gnc_gtk_action_group_set_translation_domain (per_window.group, GETTEXT_PACKAGE);
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

@@ -1024,7 +1024,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);
gnc_gtk_action_group_set_translation_domain(group, GETTEXT_PACKAGE);
gtk_action_group_set_translation_domain(group, GETTEXT_PACKAGE);
priv->action_group = group;
return group;
}

View File

@@ -49,7 +49,7 @@
#include "gnc-event.h"
#include "gnc-filepath-utils.h"
#include "gnc-gnome-utils.h"
#include "gnc-main-window.h"
//#include "gnc-main-window.h"
#include "gnc-plugin-page-register.h"
#include "gnc-prefs.h"
#include "gnc-ui.h"
@@ -1765,7 +1765,7 @@ recnWindowWithBalance (GtkWidget *parent, Account *account, gnc_numeric new_endi
action_group = gtk_action_group_new ("ReconcileWindowActions");
recnData->action_group = action_group;
gnc_gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE);
gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions (action_group, recnWindow_actions,
recnWindow_n_actions, recnData);
action =

View File

@@ -49,7 +49,6 @@
#include "gnc-event.h"
#include "gnc-filepath-utils.h"
#include "gnc-gnome-utils.h"
#include "gnc-main-window.h"
#include "gnc-plugin-page-register2.h"
#include "gnc-prefs.h"
#include "gnc-ui.h"
@@ -1706,7 +1705,7 @@ recnWindow2WithBalance (GtkWidget *parent, Account *account,
action_group = gtk_action_group_new ("ReconcileWindowActions");
recnData->action_group = action_group;
gnc_gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions (action_group, recnWindow2_actions,
recnWindow2_n_actions, recnData);
action =