mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 798807 - Keyboard shortcuts not working
Need to readd the accelerator keys when some register transaction actions are renamed to split actions as this is done by removing and adding a new menu model / item. As the register is also used for the schedule transaction editor the way the accelerator group is retrieved needs changing.
This commit is contained in:
parent
91ee2664a3
commit
96d28f2f02
@ -85,11 +85,15 @@ typedef struct GncEmbeddedWindowPrivate
|
||||
* the status bar. */
|
||||
GtkWidget *statusbar;
|
||||
|
||||
/** The group of all actions provided by the main window itself.
|
||||
/** The group of all actions provided by the embedded window itself.
|
||||
* This does not include any action provided by menu or content
|
||||
* plugins. */
|
||||
GSimpleActionGroup *simple_action_group;
|
||||
|
||||
/** The accelerator group of all actions provided by the embedded
|
||||
* window. */
|
||||
GtkAccelGroup *accel_group;
|
||||
|
||||
/** The currently selected page. */
|
||||
GncPluginPage *page;
|
||||
/** The parent of this embedded "window". This points to a real
|
||||
@ -331,7 +335,6 @@ gnc_embedded_window_new (const gchar *action_group_name,
|
||||
gchar *ui_fullname;
|
||||
GError *error = NULL;
|
||||
GtkBuilder *builder;
|
||||
GtkAccelGroup *accel_group;
|
||||
|
||||
ENTER("group %s, first %p, num %d, ui file %s, parent %p, add accelerators %d, user data %p",
|
||||
action_group_name, action_entries, n_action_entries, ui_filename,
|
||||
@ -380,9 +383,9 @@ gnc_embedded_window_new (const gchar *action_group_name,
|
||||
priv->parent_window = enclosing_win;
|
||||
|
||||
// need to add the accelerator keys
|
||||
accel_group = gtk_accel_group_new ();
|
||||
gtk_window_add_accel_group (GTK_WINDOW(enclosing_win), accel_group);
|
||||
gnc_add_accelerator_keys_for_menu (GTK_WIDGET(priv->menubar), priv->menubar_model, accel_group);
|
||||
priv->accel_group = gtk_accel_group_new ();
|
||||
gtk_window_add_accel_group (GTK_WINDOW(enclosing_win), priv->accel_group);
|
||||
gnc_add_accelerator_keys_for_menu (GTK_WIDGET(priv->menubar), priv->menubar_model, priv->accel_group);
|
||||
|
||||
g_free (ui_fullname);
|
||||
LEAVE("window %p", window);
|
||||
@ -462,7 +465,7 @@ gnc_embedded_window_get_toolbar (GncWindow *window)
|
||||
return priv->toolbar;
|
||||
}
|
||||
|
||||
/** Retrieve the display hash table associated with an embedded window object.
|
||||
/** Retrieve the menubar model associated with an embedded window object.
|
||||
* This function is called via a vector off a generic window
|
||||
* interface.
|
||||
*
|
||||
@ -479,6 +482,22 @@ gnc_embedded_window_get_menubar_model (GncWindow *window)
|
||||
return priv->menubar_model;
|
||||
}
|
||||
|
||||
/** Retrieve the accelerator group associated with an embedded window object.
|
||||
* This function is called via a vector off a generic window
|
||||
* interface.
|
||||
*
|
||||
* @param window_in A pointer to a generic window. */
|
||||
static GtkAccelGroup *
|
||||
gnc_embedded_window_get_accel_group (GncWindow *window)
|
||||
{
|
||||
GncEmbeddedWindowPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GNC_IS_EMBEDDED_WINDOW(window), NULL);
|
||||
|
||||
priv = GNC_EMBEDDED_WINDOW_GET_PRIVATE(window);
|
||||
|
||||
return priv->accel_group;
|
||||
}
|
||||
|
||||
/** Initialize the generic window interface for an embedded window.
|
||||
*
|
||||
@ -492,4 +511,5 @@ gnc_window_embedded_window_init (GncWindowIface *iface)
|
||||
iface->get_menubar = gnc_embedded_window_get_menubar;
|
||||
iface->get_toolbar = gnc_embedded_window_get_toolbar;
|
||||
iface->get_menubar_model = gnc_embedded_window_get_menubar_model;
|
||||
iface->get_accel_group = gnc_embedded_window_get_accel_group;
|
||||
}
|
||||
|
@ -5436,7 +5436,7 @@ gnc_main_window_get_toolbar (GncWindow *window)
|
||||
return priv->toolbar;
|
||||
}
|
||||
|
||||
/** Retrieve the display hash table associated with a main window object.
|
||||
/** Retrieve the menubar model associated with a main window object.
|
||||
* This function is called via a vector off a generic window
|
||||
* interface.
|
||||
*
|
||||
@ -5453,6 +5453,22 @@ gnc_main_window_get_menubar_model (GncWindow *window)
|
||||
return priv->menubar_model;
|
||||
}
|
||||
|
||||
/** Retrieve the accelerator group associated with a main window object.
|
||||
* This function is called via a vector off a generic window
|
||||
* interface.
|
||||
*
|
||||
* @param window_in A pointer to a generic window. */
|
||||
static GtkAccelGroup *
|
||||
gnc_main_window_get_accel_group (GncWindow *window)
|
||||
{
|
||||
GncMainWindowPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GNC_IS_MAIN_WINDOW(window), nullptr);
|
||||
|
||||
priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
|
||||
|
||||
return priv->accel_group;
|
||||
}
|
||||
|
||||
/** Initialize the generic window interface for a main window.
|
||||
*
|
||||
@ -5467,6 +5483,7 @@ gnc_window_main_window_init (GncWindowIface *iface)
|
||||
iface->get_menubar = gnc_main_window_get_menubar;
|
||||
iface->get_toolbar = gnc_main_window_get_toolbar;
|
||||
iface->get_menubar_model = gnc_main_window_get_menubar_model;
|
||||
iface->get_accel_group = gnc_main_window_get_accel_group;
|
||||
}
|
||||
|
||||
|
||||
|
@ -137,6 +137,17 @@ gnc_window_get_menubar_model (GncWindow *window)
|
||||
return GNC_WINDOW_GET_IFACE(window)->get_menubar_model (window);
|
||||
}
|
||||
|
||||
GtkAccelGroup *
|
||||
gnc_window_get_accel_group (GncWindow *window)
|
||||
{
|
||||
g_return_val_if_fail (GNC_WINDOW(window), NULL);
|
||||
|
||||
/* optional */
|
||||
if (GNC_WINDOW_GET_IFACE(window)->get_accel_group == NULL)
|
||||
return NULL;
|
||||
|
||||
return GNC_WINDOW_GET_IFACE(window)->get_accel_group (window);
|
||||
}
|
||||
/************************************************************
|
||||
* Auxiliary status bar functions *
|
||||
************************************************************/
|
||||
|
@ -66,6 +66,7 @@ typedef struct
|
||||
GtkWidget * (* get_menubar) (GncWindow *window);
|
||||
GtkWidget * (* get_toolbar) (GncWindow *window);
|
||||
GMenuModel * (* get_menubar_model) (GncWindow *window);
|
||||
GtkAccelGroup * (* get_accel_group) (GncWindow *window);
|
||||
void (* ui_set_sensitive) (GncWindow *window, gboolean sensitive);
|
||||
} GncWindowIface;
|
||||
|
||||
@ -85,6 +86,7 @@ GtkWidget *gnc_window_get_menubar (GncWindow *window);
|
||||
GtkWidget *gnc_window_get_toolbar (GncWindow *window);
|
||||
GtkWidget *gnc_window_get_statusbar (GncWindow *window);
|
||||
GMenuModel *gnc_window_get_menubar_model (GncWindow *window);
|
||||
GtkAccelGroup *gnc_window_get_accel_group (GncWindow *window);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -1103,6 +1103,11 @@ gnc_plugin_page_register_ui_update (gpointer various,
|
||||
gnc_plugin_add_menu_tooltip_callbacks (gnc_window_get_menubar (gnc_window),
|
||||
gnc_window_get_menubar_model (gnc_window),
|
||||
gnc_window_get_statusbar (gnc_window));
|
||||
|
||||
// need to add any accelerator keys, default or user added
|
||||
gnc_add_accelerator_keys_for_menu (gnc_window_get_menubar (gnc_window),
|
||||
gnc_window_get_menubar_model (gnc_window),
|
||||
gnc_window_get_accel_group (gnc_window));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user