summaryrefslogtreecommitdiff
path: root/gtk/gtkapplication.c
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2013-07-09 22:33:22 -0400
committerRyan Lortie <desrt@desrt.ca>2013-10-15 09:24:11 -0400
commitabcddd3ae08a6bfefec0d4298288adc8f672c924 (patch)
tree5ded9dacef52d3f55cb595adb529894ee0607490 /gtk/gtkapplication.c
parent3f0b9a7574a48fcbdd57e13ccf4a298dc7fc007b (diff)
downloadgtk+-abcddd3ae08a6bfefec0d4298288adc8f672c924.tar.gz
GtkWindow: change muxer setup with application
Previously, GtkWindow would add the "app" action group to its own toplevel muxer. Change the setup so that GtkApplication creates the toplevel muxer and adds itself to it as "app". Use this muxer as the parent muxer of any GtkWindow associated with the application. This saves a small amount of memory and will allow for accels to be propagated from the application through to all of the windows.
Diffstat (limited to 'gtk/gtkapplication.c')
-rw-r--r--gtk/gtkapplication.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c
index dfd6924c79..b4c9b51066 100644
--- a/gtk/gtkapplication.c
+++ b/gtk/gtkapplication.c
@@ -143,6 +143,7 @@ struct _GtkApplicationPrivate
GMenuModel *menubar;
gboolean register_session;
+ GtkActionMuxer *muxer;
#ifdef GDK_WINDOWING_X11
guint next_id;
@@ -396,19 +397,24 @@ gtk_application_focus_in_event_cb (GtkWindow *window,
}
static void
-gtk_application_startup (GApplication *application)
+gtk_application_startup (GApplication *g_application)
{
+ GtkApplication *application = GTK_APPLICATION (g_application);
+
G_APPLICATION_CLASS (gtk_application_parent_class)
- ->startup (application);
+ ->startup (g_application);
+
+ application->priv->muxer = gtk_action_muxer_new ();
+ gtk_action_muxer_insert (application->priv->muxer, "app", G_ACTION_GROUP (application));
gtk_init (0, 0);
#ifdef GDK_WINDOWING_X11
- gtk_application_startup_x11 (GTK_APPLICATION (application));
+ gtk_application_startup_x11 (application);
#endif
#ifdef GDK_WINDOWING_QUARTZ
- gtk_application_startup_quartz (GTK_APPLICATION (application));
+ gtk_application_startup_quartz (application);
#endif
}
@@ -1688,3 +1694,16 @@ gtk_application_is_inhibited (GtkApplication *application,
}
#endif
+
+GtkActionMuxer *
+gtk_application_get_parent_muxer_for_window (GtkWindow *window)
+{
+ GtkApplication *application;
+
+ application = gtk_window_get_application (window);
+
+ if (!application)
+ return NULL;
+
+ return application->priv->muxer;
+}