[gtkmm] Gtk::ApplicationWindow: Disambiguate activate_action()
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Gtk::ApplicationWindow: Disambiguate activate_action()
- Date: Tue, 26 Jul 2022 16:51:12 +0000 (UTC)
commit aecbdbf33298853581f493ddb8b948f4a99975fa
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Tue Jul 26 18:48:38 2022 +0200
Gtk::ApplicationWindow: Disambiguate activate_action()
A call to activate_action() is a call to Gtk::Widget::activate_action(),
not a call to Gio::ActionGroup::activate_action().
Fixes #122
gtk/src/applicationwindow.hg | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/gtk/src/applicationwindow.hg b/gtk/src/applicationwindow.hg
index bc66df4b..fce17931 100644
--- a/gtk/src/applicationwindow.hg
+++ b/gtk/src/applicationwindow.hg
@@ -31,11 +31,10 @@ class GTKMM_API ShortcutsWindow;
/** A Gtk::Window subclass with Gtk::Application support.
*
- * ApplicationWindow is a Gtk::Window subclass that offers some
+ * %ApplicationWindow is a Gtk::Window subclass that offers some
* extra functionality for better integration with Gtk::Application
* features. Notably, it can handle both the application menu as well
- * as the menubar. See set_app_menu() and
- * set_menubar().
+ * as the menubar. See set_app_menu() and set_menubar().
*
* This class derives from Gio::ActionGroup and Gio::ActionMap,
* to let you add window-specific actions that will be exported by the
@@ -43,9 +42,10 @@ class GTKMM_API ShortcutsWindow;
* 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 Gio::MenuModel.
+ * referring to them from a Gio::MenuModel, or in activate_action().
+ * Gio::ActionGroup::activate_action() does not accept prefixes.
*
- * Note that widgets that are placed inside a Gtk::ApplicationWindow
+ * Note that widgets that are placed inside a %Gtk::ApplicationWindow
* can also activate these actions, if they implement the
* Gtk::Actionable interface.
*
@@ -54,7 +54,7 @@ class GTKMM_API ShortcutsWindow;
* be held when activating actions locally (if GDK threads are enabled).
*
* The settings Gtk::Settings::property_gtk_shell_shows_app_menu() and
- * Gtk::Settings::property_gtk_shell_shows_menubar() tell GTK+ whether the
+ * Gtk::Settings::property_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;
@@ -62,11 +62,9 @@ class GTKMM_API ShortcutsWindow;
* will display the application menu, but not the menubar.
*
* If the desktop environment does not display the menubar, then
- * Gtk::ApplicationWindow will automatically show a Gtk::MenuBar for it.
- * (see the <a
href="http://developer.gnome.org/gtk3/stable/GtkApplication.html#GtkApplication.description">GtkApplication
documentation</a> for some screenshots of how this
- * looks on different platforms).
- * This behaviour can be overridden with the Gtk::ApplicationWindow::property_show_menubar()
- * property. If the desktop environment does not display the application
+ * %Gtk::ApplicationWindow will automatically show a menubar for it.
+ * This behaviour can be overridden with property_show_menubar().
+ * If the desktop environment does not display the application
* menu, then it will automatically be included in the menubar.
*/
class GTKMM_API ApplicationWindow
@@ -79,6 +77,14 @@ class GTKMM_API ApplicationWindow
_IMPLEMENTS_INTERFACE(Gio::ActionMap)
_UNMANAGEABLE
public:
+ // Disambiguate calls to activate_action().
+ // g_action_group_activate_action() and gtk_widget_activate_action() are
+ // very similar, but gtk_widget_activate_action() requires a "win." prefix.
+ // If you prefer g_action_group_activate_action(), call
+ // Gio::ActionGroup::activate_action().
+ // https://discourse.gnome.org/t/which-activate-action-shall-be-chosen-in-gtkapplicationwindow/10555/2
+ using Widget::activate_action;
+
_CTOR_DEFAULT
explicit ApplicationWindow(const Glib::RefPtr<Application>& application);
dnl // Don't ignore gtk_application_window_new(). h2def.py erroneously classifies
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]