Document actions

This commit is contained in:
Matthias Clasen 2020-04-10 23:59:21 -04:00
parent c5b4066714
commit 6b9ac1043b
9 changed files with 219 additions and 32 deletions

View File

@ -561,10 +561,13 @@ gtk_color_editor_class_init (GtkColorEditorClass *class)
gtk_widget_class_bind_template_callback (widget_class, entry_focus_changed);
gtk_widget_class_bind_template_callback (widget_class, pick_color);
/**
* GtkColorEditor|color.edit:
* @component: the component to edit, "h", "sv" or "a"
*
* Opens the edit popup for one of the color components.
*/
gtk_widget_class_install_action (widget_class, "color.edit", "s", popup_edit);
gtk_widget_class_install_action (widget_class, "color.edit", "s", popup_edit);
gtk_widget_class_install_action (widget_class, "color.edit", "s", popup_edit);
}
static void

View File

@ -497,6 +497,11 @@ gtk_color_swatch_class_init (GtkColorSwatchClass *class)
g_param_spec_boolean ("can-drop", P_("Can Drop"), P_("Whether the swatch should accept drops"),
FALSE, GTK_PARAM_READWRITE));
/**
* GtkColorSwatch|menu.popup:
*
* Opens the context menu.
*/
gtk_widget_class_install_action (widget_class, "menu.popup", NULL, swatch_popup_menu);
gtk_widget_class_add_binding_action (widget_class,

View File

@ -1023,6 +1023,11 @@ gtk_label_class_init (GtkLabelClass *class)
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, label_props);
/**
* GtkLabel|menu.popup:
*
* Opens the context menu.
*/
gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_label_popup_menu);
/*

View File

@ -228,9 +228,19 @@ gtk_link_button_class_init (GtkLinkButtonClass *klass)
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_LINK_BUTTON_ACCESSIBLE);
gtk_widget_class_set_css_name (widget_class, I_("button"));
/**
* GtkLinkButton|clipboard.copy:
*
* Copies the url to the clipboard.
*/
gtk_widget_class_install_action (widget_class, "clipboard.copy", NULL,
gtk_link_button_activate_clipboard_copy);
/**
* GtkLinkButton|menu.popup:
*
* Opens the context menu.
*/
gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_link_button_popup_menu);
gtk_widget_class_add_binding_action (widget_class,

View File

@ -1304,6 +1304,11 @@ gtk_notebook_class_init (GtkNotebookClass *class)
G_TYPE_FROM_CLASS (gobject_class),
_gtk_marshal_OBJECT__OBJECTv);
/**
* GtkNotebook|menu.popup:
*
* Opens the context menu.
*/
gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_notebook_popup_menu);
gtk_widget_class_add_binding_signal (widget_class,

View File

@ -2330,12 +2330,53 @@ gtk_places_view_class_init (GtkPlacesViewClass *klass)
gtk_widget_class_bind_template_callback (widget_class, on_listbox_row_activated);
gtk_widget_class_bind_template_callback (widget_class, on_recent_servers_listbox_row_activated);
/**
* GtkPlacesView|location.open:
*
* Opens the location in the current window.
*/
gtk_widget_class_install_action (widget_class, "location.open", NULL, open_cb);
/**
* GtkPlacesView|location.open-tab:
*
* Opens the location in a new tab.
*/
gtk_widget_class_install_action (widget_class, "location.open-tab", NULL, open_cb);
/**
* GtkPlacesView|location.open-window:
*
* Opens the location in a new window.
*/
gtk_widget_class_install_action (widget_class, "location.open-window", NULL, open_cb);
/**
* GtkPlacesView|location.mount:
*
* Mount the location.
*/
gtk_widget_class_install_action (widget_class, "location.mount", NULL, mount_cb);
/**
* GtkPlacesView|location.connect:
*
* Connect the location.
*/
gtk_widget_class_install_action (widget_class, "location.connect", NULL, mount_cb);
/**
* GtkPlacesView|location.unmount:
*
* Unmount the location.
*/
gtk_widget_class_install_action (widget_class, "location.unmount", NULL, unmount_cb);
/**
* GtkPlacesView|location.disconnect:
*
* Disconnect the location.
*/
gtk_widget_class_install_action (widget_class, "location.disconnect", NULL, unmount_cb);
gtk_widget_class_set_css_name (widget_class, I_("placesview"));

View File

@ -1194,9 +1194,82 @@ gtk_text_class_init (GtkTextClass *class)
NULL, NULL,
NULL,
G_TYPE_NONE, 0);
/*
* Actions
*/
/**
* GtkText|clipboard.cut:
*
* Copies the contents to the clipboard and deletes it from the widget.
*/
gtk_widget_class_install_action (widget_class, "clipboard.cut", NULL,
gtk_text_activate_clipboard_cut);
/**
* GtkText|clipboard.copy:
*
* Copies the contents to the clipboard.
*/
gtk_widget_class_install_action (widget_class, "clipboard.copy", NULL,
gtk_text_activate_clipboard_copy);
/**
* GtkText|clipboard.copy:
*
* Inserts the contents of the clipboard into the widget.
*/
gtk_widget_class_install_action (widget_class, "clipboard.paste", NULL,
gtk_text_activate_clipboard_paste);
/**
* GtkText|selection.delete:
*
* Deletes the current selection.
*/
gtk_widget_class_install_action (widget_class, "selection.delete", NULL,
gtk_text_activate_selection_delete);
/**
* GtkText|selection.select-all:
*
* Selects all of the widgets content.
*/
gtk_widget_class_install_action (widget_class, "selection.select-all", NULL,
gtk_text_activate_selection_select_all);
/**
* GtkText|misc.insert-emoji:
*
* Opens the Emoji chooser.
*/
gtk_widget_class_install_action (widget_class, "misc.insert-emoji", NULL,
gtk_text_activate_misc_insert_emoji);
gtk_widget_class_install_property_action (widget_class,
"misc.toggle-visibility",
"visibility");
/**
* GtkText|text.undo:
*
* Undoes the last change to the contents.
*/
gtk_widget_class_install_action (widget_class, "text.undo", NULL, gtk_text_real_undo);
/**
* GtkText|text.redo:
*
* Redoes the last change to the contents.
*/
gtk_widget_class_install_action (widget_class, "text.redo", NULL, gtk_text_real_redo);
/**
* GtkText|menu.popup:
*
* Opens the context menu.
*/
gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_text_popup_menu);
/*
@ -1411,22 +1484,6 @@ gtk_text_class_init (GtkTextClass *class)
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_TEXT_ACCESSIBLE);
gtk_widget_class_set_css_name (widget_class, I_("text"));
gtk_widget_class_install_action (widget_class, "clipboard.cut", NULL,
gtk_text_activate_clipboard_cut);
gtk_widget_class_install_action (widget_class, "clipboard.copy", NULL,
gtk_text_activate_clipboard_copy);
gtk_widget_class_install_action (widget_class, "clipboard.paste", NULL,
gtk_text_activate_clipboard_paste);
gtk_widget_class_install_action (widget_class, "selection.delete", NULL,
gtk_text_activate_selection_delete);
gtk_widget_class_install_action (widget_class, "selection.select-all", NULL,
gtk_text_activate_selection_select_all);
gtk_widget_class_install_action (widget_class, "misc.insert-emoji", NULL,
gtk_text_activate_misc_insert_emoji);
gtk_widget_class_install_property_action (widget_class,
"misc.toggle-visibility",
"visibility");
}
static void

View File

@ -1464,8 +1464,77 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
NULL,
G_TYPE_NONE, 0);
/*
* Actions
*/
/**
* GtkTextView|clipboard.cut:
*
* Copies the contents to the clipboard and deletes it from the widget.
*/
gtk_widget_class_install_action (widget_class, "clipboard.cut", NULL,
gtk_text_view_activate_clipboard_cut);
/**
* GtkTextView|clipboard.copy:
*
* Copies the contents to the clipboard.
*/
gtk_widget_class_install_action (widget_class, "clipboard.copy", NULL,
gtk_text_view_activate_clipboard_copy);
/**
* GtkTextView|clipboard.paste:
*
* Inserts the contents of the clipboard into the widget.
*/
gtk_widget_class_install_action (widget_class, "clipboard.paste", NULL,
gtk_text_view_activate_clipboard_paste);
/**
* GtkTextView|selection.delete:
*
* Deletes the current selection.
*/
gtk_widget_class_install_action (widget_class, "selection.delete", NULL,
gtk_text_view_activate_selection_delete);
/**
* GtkTextView|selection.select-all:
*
* Selects all of the widgets content.
*/
gtk_widget_class_install_action (widget_class, "selection.select-all", NULL,
gtk_text_view_activate_selection_select_all);
/**
* GtkTextView|misc.insert-emoji:
*
* Opens the Emoji chooser.
*/
gtk_widget_class_install_action (widget_class, "misc.insert-emoji", NULL,
gtk_text_view_activate_misc_insert_emoji);
/**
* GtkTextView|text.undo:
*
* Undoes the last change to the contents.
*/
gtk_widget_class_install_action (widget_class, "text.undo", NULL, gtk_text_view_real_undo);
/**
* GtkTextView|text.redo:
*
* Redoes the last change to the contents.
*/
gtk_widget_class_install_action (widget_class, "text.redo", NULL, gtk_text_view_real_redo);
/**
* GtkTextView|menu.popup:
*
* Opens the context menu.
*/
gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_text_view_popup_menu);
/*
@ -1755,19 +1824,6 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
quark_text_selection_data = g_quark_from_static_string ("gtk-text-view-text-selection-data");
quark_gtk_signal = g_quark_from_static_string ("gtk-signal");
quark_text_view_child = g_quark_from_static_string ("gtk-text-view-child");
gtk_widget_class_install_action (widget_class, "clipboard.cut", NULL,
gtk_text_view_activate_clipboard_cut);
gtk_widget_class_install_action (widget_class, "clipboard.copy", NULL,
gtk_text_view_activate_clipboard_copy);
gtk_widget_class_install_action (widget_class, "clipboard.paste", NULL,
gtk_text_view_activate_clipboard_paste);
gtk_widget_class_install_action (widget_class, "selection.delete", NULL,
gtk_text_view_activate_selection_delete);
gtk_widget_class_install_action (widget_class, "selection.select-all", NULL,
gtk_text_view_activate_selection_select_all);
gtk_widget_class_install_action (widget_class, "misc.insert-emoji", NULL,
gtk_text_view_activate_misc_insert_emoji);
}
static void

View File

@ -1057,6 +1057,11 @@ gtk_window_class_init (GtkWindowClass *klass)
* Key bindings
*/
/**
* GtkWindow|default.activate:
*
* Activate the default widget.
*/
gtk_widget_class_install_action (widget_class, "default.activate", NULL,
gtk_window_activate_default_activate);