/*
* Copyright © 2011 Canonical Limited
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the licence, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see .
*
* Author: Ryan Lortie
*/
#include "config.h"
#include "gtkapplicationwindow.h"
#include "gtkapplicationprivate.h"
#include "gtkwidgetprivate.h"
#include "gtkwindowprivate.h"
#include "gtkheaderbar.h"
#include "gtkmenubar.h"
#include "gtkintl.h"
#include "gtksettings.h"
#include "gtkshortcutswindowprivate.h"
#if defined(HAVE_GIO_UNIX) && !defined(__APPLE__)
#include
#endif
/**
* SECTION:gtkapplicationwindow
* @title: GtkApplicationWindow
* @short_description: GtkWindow subclass with GtkApplication support
*
* #GtkApplicationWindow is a #GtkWindow subclass that offers some
* extra functionality for better integration with #GtkApplication
* features. Notably, it can handle both the application menu as well
* as the menubar. See gtk_application_set_app_menu() and
* gtk_application_set_menubar().
*
* This class implements the #GActionGroup and #GActionMap interfaces,
* to let you add window-specific actions that will be exported by the
* associated #GtkApplication, together with its application-wide
* actions. Window-specific actions are prefixed with the “win.”
* prefix and application-wide actions are prefixed with the “app.”
* prefix. Actions must be addressed with the prefixed name when
* referring to them from a #GMenuModel.
*
* Note that widgets that are placed inside a #GtkApplicationWindow
* can also activate these actions, if they implement the
* #GtkActionable interface.
*
* As with #GtkApplication, the GDK lock will be acquired when
* processing actions arriving from other processes and should therefore
* be held when activating actions locally (if GDK threads are enabled).
*
* The settings #GtkSettings:gtk-shell-shows-app-menu and
* #GtkSettings:gtk-shell-shows-menubar tell GTK+ whether the
* desktop environment is showing the application menu and menubar
* models outside the application as part of the desktop shell.
* For instance, on OS X, both menus will be displayed remotely;
* on Windows neither will be. gnome-shell (starting with version 3.4)
* will display the application menu, but not the menubar.
*
* If the desktop environment does not display the menubar, then
* #GtkApplicationWindow will automatically show a #GtkMenuBar for it.
* This behaviour can be overridden with the #GtkApplicationWindow:show-menubar
* property. If the desktop environment does not display the application
* menu, then it will automatically be included in the menubar or in the
* windows client-side decorations.
*
* ## A GtkApplicationWindow with a menubar
*
* |[
* app = gtk_application_new ();
*
* builder = gtk_builder_new_from_string (
* ""
* " "
* "",
* -1);
*
* menubar = G_MENU_MODEL (gtk_builder_get_object (builder,
* "menubar"));
* gtk_application_set_menubar (G_APPLICATION (app), menubar);
* g_object_unref (builder);
*
* ...
*
* window = gtk_application_window_new (app);
* ]|
*
* ## Handling fallback yourself
*
* [A simple example](https://git.gnome.org/browse/gtk+/tree/examples/sunny.c)
*
* The XML format understood by #GtkBuilder for #GMenuModel consists
* of a toplevel `