summaryrefslogtreecommitdiff
path: root/gtk/gtkaction.h
diff options
context:
space:
mode:
authorMatthias Clasen <maclas@gmx.de>2003-09-17 23:58:28 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2003-09-17 23:58:28 +0000
commit0ceb0db081e18718f7df81092fbc64788f22b9e3 (patch)
tree93b8695504be9469a33c086ef35beded26b34062 /gtk/gtkaction.h
parenta7ad2a46634aa17687521d055bf2f47e1c9738f8 (diff)
downloadgtk+-0ceb0db081e18718f7df81092fbc64788f22b9e3.tar.gz
Install accelerators on actions, not on proxies, support accelerator-only
2003-09-18 Matthias Clasen <maclas@gmx.de> Install accelerators on actions, not on proxies, support accelerator-only actions: * gtk/gtkmenu.c (get_accel_path): New function to get the accel path and its lock status either via _gtk_widget_get_accel_path() or by looking at the accel_path stored in the menu item itself and determining its lock status by peeking into the contained accel label. This was already (accidentally) committed a week ago. * gtk/gtkaction.h (gtk_action_set_accel_group): (gtk_action_[dis]connect_accelerator): New functions. * gtk/gtkaction.c (struct _GtkActionPrivate): Add accel_group, accel_closure and accel_count. We must have a reference to the accel_group, since we need it in connect_proxy. The count is necessary to ensure that the accelerator isn't removed before the last proxy requesting it has been unmerged. (connect_proxy): Connect the accelerator to the action now, only set the accel_path on the menuitem. (remove_proxy): Disconnect the accelerator from the action, not from the menuitem. (gtk_action_set_accel_group): Set the accel group. (gtk_action_[dis]connect_accelerator): Count the number of times this functions have been called and install/remove the accelerator if the count leaves/reaches zero. * gtk/gtkuimanager.h (GtkUIManagerItemType): Add GTK_UI_MANAGER_ACCELERATOR. * gtk/gtkuimanager.c (NodeType): Add NODE_TYPE_ACCELERATOR. (start_element_handler): Create NODE_TYPE_ACCELERATOR nodes from <accelerator> elements. (gtk_ui_manager_add_ui): Create NODE_TYPE_ACCELERATOR nodes when type is GTK_UI_MANAGER_ACCELERATOR. (update_node): Set the accel group on actions before creating their proxies. Don't set the accel group on created menus. For NODE_TYPE_ACCELERATOR nodes, [dis]connect the actions' accelerator. (print_node): Also emit <accelerator> elements. * tests/testmerge.c (dump_accels): Add a "Dump Accels" button.
Diffstat (limited to 'gtk/gtkaction.h')
-rw-r--r--gtk/gtkaction.h43
1 files changed, 22 insertions, 21 deletions
diff --git a/gtk/gtkaction.h b/gtk/gtkaction.h
index 5e6c05bc49..8832298360 100644
--- a/gtk/gtkaction.h
+++ b/gtk/gtkaction.h
@@ -78,31 +78,32 @@ struct _GtkActionClass
void (*_gtk_reserved4) (void);
};
-GType gtk_action_get_type (void);
-const gchar* gtk_action_get_name (GtkAction *action);
-void gtk_action_activate (GtkAction *action);
-GtkWidget * gtk_action_create_icon (GtkAction *action,
- GtkIconSize icon_size);
-GtkWidget * gtk_action_create_menu_item (GtkAction *action);
-GtkWidget * gtk_action_create_tool_item (GtkAction *action);
-void gtk_action_connect_proxy (GtkAction *action,
- GtkWidget *proxy);
-void gtk_action_disconnect_proxy (GtkAction *action,
- GtkWidget *proxy);
-GSList * gtk_action_get_proxies (GtkAction *action);
-
+GType gtk_action_get_type (void);
+const gchar* gtk_action_get_name (GtkAction *action);
+void gtk_action_activate (GtkAction *action);
+GtkWidget* gtk_action_create_icon (GtkAction *action,
+ GtkIconSize icon_size);
+GtkWidget* gtk_action_create_menu_item (GtkAction *action);
+GtkWidget* gtk_action_create_tool_item (GtkAction *action);
+void gtk_action_connect_proxy (GtkAction *action,
+ GtkWidget *proxy);
+void gtk_action_disconnect_proxy (GtkAction *action,
+ GtkWidget *proxy);
+GSList* gtk_action_get_proxies (GtkAction *action);
+void gtk_action_connect_accelerator (GtkAction *action);
+void gtk_action_disconnect_accelerator (GtkAction *action);
/* protected ... for use by child actions */
-void gtk_action_block_activate_from (GtkAction *action,
- GtkWidget *proxy);
-void gtk_action_unblock_activate_from (GtkAction *action,
- GtkWidget *proxy);
-
+void gtk_action_block_activate_from (GtkAction *action,
+ GtkWidget *proxy);
+void gtk_action_unblock_activate_from (GtkAction *action,
+ GtkWidget *proxy);
/* protected ... for use by action groups */
-void gtk_action_set_accel_path (GtkAction *action,
- const gchar *accel_path);
-
+void gtk_action_set_accel_path (GtkAction *action,
+ const gchar *accel_path);
+void gtk_action_set_accel_group (GtkAction *action,
+ GtkAccelGroup *accel_group);
#endif /* __GTK_ACTION_H__ */