ApplicationWindow: setup accels with widget muxer
Use the muxer from GtkWidget to setup the accels rather than our own local muxer (which will soon be removed).
This commit is contained in:
parent
fd9b7bbfac
commit
86d7c9d5b5
@ -22,6 +22,7 @@
|
|||||||
#include "gtkapplicationwindow.h"
|
#include "gtkapplicationwindow.h"
|
||||||
|
|
||||||
#include "gtkapplicationprivate.h"
|
#include "gtkapplicationprivate.h"
|
||||||
|
#include "gtkwidgetprivate.h"
|
||||||
#include "gtkwindowprivate.h"
|
#include "gtkwindowprivate.h"
|
||||||
#include "gtkmodelmenu.h"
|
#include "gtkmodelmenu.h"
|
||||||
#include "gactionmuxer.h"
|
#include "gactionmuxer.h"
|
||||||
@ -420,11 +421,6 @@ free_accel_closures (GtkApplicationWindow *window)
|
|||||||
window->priv->accel_closures = NULL;
|
window->priv->accel_closures = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
GtkApplicationWindow *window;
|
|
||||||
GActionGroup *actions;
|
|
||||||
} AccelData;
|
|
||||||
|
|
||||||
/* Hack. We iterate over the accel map instead of the actions,
|
/* Hack. We iterate over the accel map instead of the actions,
|
||||||
* in order to pull the parameters out of accel map entries
|
* in order to pull the parameters out of accel map entries
|
||||||
*/
|
*/
|
||||||
@ -435,9 +431,8 @@ add_accel_closure (gpointer data,
|
|||||||
GdkModifierType accel_mods,
|
GdkModifierType accel_mods,
|
||||||
gboolean changed)
|
gboolean changed)
|
||||||
{
|
{
|
||||||
AccelData *d = data;
|
GtkApplicationWindow *window = data;
|
||||||
GtkApplicationWindow *window = d->window;
|
GActionGroup *actions;
|
||||||
GActionGroup *actions = d->actions;
|
|
||||||
const gchar *path;
|
const gchar *path;
|
||||||
const gchar *p;
|
const gchar *p;
|
||||||
gchar *action_name;
|
gchar *action_name;
|
||||||
@ -465,6 +460,7 @@ add_accel_closure (gpointer data,
|
|||||||
parameter = NULL;
|
parameter = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actions = G_ACTION_GROUP (_gtk_widget_get_action_muxer (GTK_WIDGET (window)));
|
||||||
if (g_action_group_has_action (actions, action_name))
|
if (g_action_group_has_action (actions, action_name))
|
||||||
{
|
{
|
||||||
closure = (AccelClosure*) g_closure_new_object (sizeof (AccelClosure), g_object_ref (actions));
|
closure = (AccelClosure*) g_closure_new_object (sizeof (AccelClosure), g_object_ref (actions));
|
||||||
@ -485,14 +481,9 @@ add_accel_closure (gpointer data,
|
|||||||
static void
|
static void
|
||||||
gtk_application_window_update_accels (GtkApplicationWindow *window)
|
gtk_application_window_update_accels (GtkApplicationWindow *window)
|
||||||
{
|
{
|
||||||
AccelData data;
|
|
||||||
|
|
||||||
free_accel_closures (window);
|
free_accel_closures (window);
|
||||||
|
|
||||||
data.window = window;
|
gtk_accel_map_foreach (window, add_accel_closure);
|
||||||
data.actions = G_ACTION_GROUP (window->priv->muxer);
|
|
||||||
|
|
||||||
gtk_accel_map_foreach (&data, add_accel_closure);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user