[gtk+/action-helper: 5/16] Add two users of gtk_widget_insert_action_group

commit c49ddf6c31a233511c4cc7ea5e837d7d2ccd7d51
Author: Lars Uebernickel <lars uebernickel canonical com>
Date:   Fri Aug 17 18:21:59 2012 -0400

    Add two users of gtk_widget_insert_action_group
    Each GtkWindow with an associated GtkApplication should add this as
    "app" to its action context.  Each GtkApplicationWindow is its own
    GActionGroup, and it should add itself to itself with the prefix "win".
    There is now some duplication here because we have the new GActionMuxer
    hierarchy managed by GtkWidget, but GtkApplicationWindow still carries
    its own muxer.  The redundancy will be removed in a future patch.

 gtk/gtkapplicationwindow.c |    2 ++
 gtk/gtkwindow.c            |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/gtk/gtkapplicationwindow.c b/gtk/gtkapplicationwindow.c
index fff5380..7061309 100644
--- a/gtk/gtkapplicationwindow.c
+++ b/gtk/gtkapplicationwindow.c
@@ -959,6 +959,8 @@ gtk_application_window_init (GtkApplicationWindow *window)
   window->priv->accels = gtk_accel_group_new ();
   gtk_window_add_accel_group (GTK_WINDOW (window), window->priv->accels);
+  gtk_widget_insert_action_group (GTK_WIDGET (window), "win", G_ACTION_GROUP (window->priv->actions));
   /* window->priv->actions is the one and only ref on the group, so when
    * we dispose, the action group will die, disconnecting all signals.
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index a07ddc5..0d62acc 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -2820,6 +2820,9 @@ gtk_window_set_application (GtkWindow      *window,
           gtk_application_add_window (priv->application, window);
+      /* don't use a normal cast: application may be NULL */
+      gtk_widget_insert_action_group (GTK_WIDGET (window), "app", (GActionGroup *) application);
       g_object_notify (G_OBJECT (window), "application");

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]