1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.Action;
26 
27 private import gio.IconIF;
28 private import glib.ConstructionException;
29 private import glib.ListSG;
30 private import glib.Str;
31 private import gobject.Closure;
32 private import gobject.ObjectG;
33 private import gobject.Signals;
34 private import gtk.AccelGroup;
35 private import gtk.BuildableIF;
36 private import gtk.BuildableT;
37 private import gtk.Image;
38 private import gtk.Menu;
39 private import gtk.MenuItem;
40 private import gtk.ToolItem;
41 private import gtk.c.functions;
42 public  import gtk.c.types;
43 public  import gtkc.gtktypes;
44 private import std.algorithm;
45 
46 
47 /**
48  * > In GTK+ 3.10, GtkAction has been deprecated. Use #GAction
49  * > instead, and associate actions with #GtkActionable widgets. Use
50  * > #GMenuModel for creating menus with gtk_menu_new_from_model().
51  * 
52  * Actions represent operations that the user can be perform, along with
53  * some information how it should be presented in the interface. Each action
54  * provides methods to create icons, menu items and toolbar items
55  * representing itself.
56  * 
57  * As well as the callback that is called when the action gets activated,
58  * the following also gets associated with the action:
59  * 
60  * - a name (not translated, for path lookup)
61  * 
62  * - a label (translated, for display)
63  * 
64  * - an accelerator
65  * 
66  * - whether label indicates a stock id
67  * 
68  * - a tooltip (optional, translated)
69  * 
70  * - a toolbar label (optional, shorter than label)
71  * 
72  * 
73  * The action will also have some state information:
74  * 
75  * - visible (shown/hidden)
76  * 
77  * - sensitive (enabled/disabled)
78  * 
79  * Apart from regular actions, there are [toggle actions][GtkToggleAction],
80  * which can be toggled between two states and
81  * [radio actions][GtkRadioAction], of which only one in a group
82  * can be in the “active” state. Other actions can be implemented as #GtkAction
83  * subclasses.
84  * 
85  * Each action can have one or more proxy widgets. To act as an action proxy,
86  * widget needs to implement #GtkActivatable interface. Proxies mirror the state
87  * of the action and should change when the action’s state changes. Properties
88  * that are always mirrored by proxies are #GtkAction:sensitive and
89  * #GtkAction:visible. #GtkAction:gicon, #GtkAction:icon-name, #GtkAction:label,
90  * #GtkAction:short-label and #GtkAction:stock-id properties are only mirorred
91  * if proxy widget has #GtkActivatable:use-action-appearance property set to
92  * %TRUE.
93  * 
94  * When the proxy is activated, it should activate its action.
95  */
96 public class Action : ObjectG, BuildableIF
97 {
98 	/** the main Gtk struct */
99 	protected GtkAction* gtkAction;
100 
101 	/** Get the main Gtk struct */
102 	public GtkAction* getActionStruct(bool transferOwnership = false)
103 	{
104 		if (transferOwnership)
105 			ownedRef = false;
106 		return gtkAction;
107 	}
108 
109 	/** the main Gtk struct as a void* */
110 	protected override void* getStruct()
111 	{
112 		return cast(void*)gtkAction;
113 	}
114 
115 	protected override void setStruct(GObject* obj)
116 	{
117 		gtkAction = cast(GtkAction*)obj;
118 		super.setStruct(obj);
119 	}
120 
121 	/**
122 	 * Sets our main struct and passes it to the parent class.
123 	 */
124 	public this (GtkAction* gtkAction, bool ownedRef = false)
125 	{
126 		this.gtkAction = gtkAction;
127 		super(cast(GObject*)gtkAction, ownedRef);
128 	}
129 
130 	// add the Buildable capabilities
131 	mixin BuildableT!(GtkAction);
132 
133 	/**
134 	 * Creates a new GtkAction object. To add the action to a
135 	 * GtkActionGroup and set the accelerator for the action,
136 	 * call gtk_action_group_add_action_with_accel().
137 	 * See the section called UI Definitions for information on allowed action
138 	 * names.
139 	 * Since 2.4
140 	 * Params:
141 	 * name =  A unique name for the action
142 	 * label =  the label displayed in menu items and on buttons, or NULL
143 	 * tooltip =  a tooltip for the action, or NULL
144 	 * stockId =  the stock icon to display in widgets representing the
145 	 *  action.
146 	 * Throws: ConstructionException GTK+ fails to create the object.
147 	 */
148 	public this (string name, string label, string tooltip, StockID stockId)
149 	{
150 		this(name, label, tooltip, cast(string)stockId);
151 	}
152 
153 	/**
154 	 * Gets the stock id of action.
155 	 * Since 2.16
156 	 * Returns: the stock id
157 	 */
158 	public StockID getStockId()
159 	{
160 		return cast(StockID)Str.toString(gtk_action_get_stock_id(gtkAction));
161 	}
162 
163 	/**
164 	 * Sets the stock id on action
165 	 * Since 2.16
166 	 * Params:
167 	 * stockId =  the stock id
168 	 */
169 	public void setStockId(StockID stockId)
170 	{
171 		setStockId(stockId);
172 	}
173 
174 	/**
175 	 * This function is intended for use by action implementations to
176 	 * create icons displayed in the proxy widgets.
177 	 * Since 2.4
178 	 * Params:
179 	 * iconSize = the size of the icon that should be created. [type int]
180 	 * Returns: a widget that displays the icon for this action.
181 	 */
182 	public Image createIcon(GtkIconSize iconSize)
183 	{
184 		// GtkWidget * gtk_action_create_icon (GtkAction *action,  GtkIconSize icon_size);
185 		auto p = gtk_action_create_icon(gtkAction, iconSize);
186 		if(p is null)
187 		{
188 			return null;
189 		}
190 		return new Image(cast(GtkImage*) p);
191 	}
192 
193 	/**
194 	 * Creates a menu item widget that proxies for the given action.
195 	 * Since 2.4
196 	 * Returns: a menu item connected to the action.
197 	 */
198 	public MenuItem createMenuItem()
199 	{
200 		// GtkWidget * gtk_action_create_menu_item (GtkAction *action);
201 		auto p = gtk_action_create_menu_item(gtkAction);
202 		if(p is null)
203 		{
204 			return null;
205 		}
206 		return new MenuItem(cast(GtkMenuItem*) p);
207 	}
208 
209 	/**
210 	 * Creates a toolbar item widget that proxies for the given action.
211 	 * Since 2.4
212 	 * Returns: a toolbar item connected to the action.
213 	 */
214 	public ToolItem createToolItem()
215 	{
216 		// GtkWidget * gtk_action_create_tool_item (GtkAction *action);
217 		auto p = gtk_action_create_tool_item(gtkAction);
218 		if(p is null)
219 		{
220 			return null;
221 		}
222 		return new ToolItem(cast(GtkToolItem*) p);
223 	}
224 
225 	/**
226 	 * If action provides a GtkMenu widget as a submenu for the menu
227 	 * item or the toolbar item it creates, this function returns an
228 	 * instance of that menu.
229 	 * Since 2.12
230 	 * Returns: the menu item provided by the action, or NULL.
231 	 */
232 	public Menu createMenu()
233 	{
234 		// GtkWidget * gtk_action_create_menu (GtkAction *action);
235 		auto p = gtk_action_create_menu(gtkAction);
236 		if(p is null)
237 		{
238 			return null;
239 		}
240 		return new Menu(cast(GtkMenu*) p);
241 	}
242 
243 	/**
244 	 */
245 
246 	/** */
247 	public static GType getType()
248 	{
249 		return gtk_action_get_type();
250 	}
251 
252 	/**
253 	 * Creates a new #GtkAction object. To add the action to a
254 	 * #GtkActionGroup and set the accelerator for the action,
255 	 * call gtk_action_group_add_action_with_accel().
256 	 * See the [UI Definition section][XML-UI] for information on allowed action
257 	 * names.
258 	 *
259 	 * Deprecated: Use #GAction instead, associating it to a widget with
260 	 * #GtkActionable or creating a #GtkMenu with gtk_menu_new_from_model()
261 	 *
262 	 * Params:
263 	 *     name = A unique name for the action
264 	 *     label = the label displayed in menu items and on buttons,
265 	 *         or %NULL
266 	 *     tooltip = a tooltip for the action, or %NULL
267 	 *     stockId = the stock icon to display in widgets representing
268 	 *         the action, or %NULL
269 	 *
270 	 * Returns: a new #GtkAction
271 	 *
272 	 * Since: 2.4
273 	 *
274 	 * Throws: ConstructionException GTK+ fails to create the object.
275 	 */
276 	public this(string name, string label, string tooltip, string stockId)
277 	{
278 		auto p = gtk_action_new(Str.toStringz(name), Str.toStringz(label), Str.toStringz(tooltip), Str.toStringz(stockId));
279 
280 		if(p is null)
281 		{
282 			throw new ConstructionException("null returned by new");
283 		}
284 
285 		this(cast(GtkAction*) p, true);
286 	}
287 
288 	/**
289 	 * Emits the “activate” signal on the specified action, if it isn't
290 	 * insensitive. This gets called by the proxy widgets when they get
291 	 * activated.
292 	 *
293 	 * It can also be used to manually activate an action.
294 	 *
295 	 * Deprecated: Use g_action_group_activate_action() on a #GAction instead
296 	 *
297 	 * Since: 2.4
298 	 */
299 	public void activate()
300 	{
301 		gtk_action_activate(gtkAction);
302 	}
303 
304 	/**
305 	 * Disable activation signals from the action
306 	 *
307 	 * This is needed when updating the state of your proxy
308 	 * #GtkActivatable widget could result in calling gtk_action_activate(),
309 	 * this is a convenience function to avoid recursing in those
310 	 * cases (updating toggle state for instance).
311 	 *
312 	 * Deprecated: Use g_simple_action_set_enabled() to disable the
313 	 * #GSimpleAction instead
314 	 *
315 	 * Since: 2.16
316 	 */
317 	public void blockActivate()
318 	{
319 		gtk_action_block_activate(gtkAction);
320 	}
321 
322 	/**
323 	 * Installs the accelerator for @action if @action has an
324 	 * accel path and group. See gtk_action_set_accel_path() and
325 	 * gtk_action_set_accel_group()
326 	 *
327 	 * Since multiple proxies may independently trigger the installation
328 	 * of the accelerator, the @action counts the number of times this
329 	 * function has been called and doesn’t remove the accelerator until
330 	 * gtk_action_disconnect_accelerator() has been called as many times.
331 	 *
332 	 * Deprecated: Use #GAction and the accelerator group on an associated
333 	 * #GtkMenu instead
334 	 *
335 	 * Since: 2.4
336 	 */
337 	public void connectAccelerator()
338 	{
339 		gtk_action_connect_accelerator(gtkAction);
340 	}
341 
342 	/**
343 	 * Undoes the effect of one call to gtk_action_connect_accelerator().
344 	 *
345 	 * Deprecated: Use #GAction and the accelerator group on an associated
346 	 * #GtkMenu instead
347 	 *
348 	 * Since: 2.4
349 	 */
350 	public void disconnectAccelerator()
351 	{
352 		gtk_action_disconnect_accelerator(gtkAction);
353 	}
354 
355 	/**
356 	 * Returns the accel closure for this action.
357 	 *
358 	 * Deprecated: Use #GAction and #GtkMenu instead, which have no
359 	 * equivalent for getting the accel closure
360 	 *
361 	 * Returns: the accel closure for this action. The
362 	 *     returned closure is owned by GTK+ and must not be unreffed
363 	 *     or modified.
364 	 *
365 	 * Since: 2.8
366 	 */
367 	public Closure getAccelClosure()
368 	{
369 		auto p = gtk_action_get_accel_closure(gtkAction);
370 
371 		if(p is null)
372 		{
373 			return null;
374 		}
375 
376 		return ObjectG.getDObject!(Closure)(cast(GClosure*) p);
377 	}
378 
379 	/**
380 	 * Returns the accel path for this action.
381 	 *
382 	 * Deprecated: Use #GAction and the accelerator path on an associated
383 	 * #GtkMenu instead
384 	 *
385 	 * Returns: the accel path for this action, or %NULL
386 	 *     if none is set. The returned string is owned by GTK+
387 	 *     and must not be freed or modified.
388 	 *
389 	 * Since: 2.6
390 	 */
391 	public string getAccelPath()
392 	{
393 		return Str.toString(gtk_action_get_accel_path(gtkAction));
394 	}
395 
396 	/**
397 	 * Returns whether @action's menu item proxies will always
398 	 * show their image, if available.
399 	 *
400 	 * Deprecated: Use g_menu_item_get_attribute_value() on a #GMenuItem
401 	 * instead
402 	 *
403 	 * Returns: %TRUE if the menu item proxies will always show their image
404 	 *
405 	 * Since: 2.20
406 	 */
407 	public bool getAlwaysShowImage()
408 	{
409 		return gtk_action_get_always_show_image(gtkAction) != 0;
410 	}
411 
412 	/**
413 	 * Gets the gicon of @action.
414 	 *
415 	 * Deprecated: Use #GAction instead, and
416 	 * g_menu_item_get_attribute_value() to get an icon from a #GMenuItem
417 	 * associated with a #GAction
418 	 *
419 	 * Returns: The action’s #GIcon if one is set.
420 	 *
421 	 * Since: 2.16
422 	 */
423 	public IconIF getGicon()
424 	{
425 		auto p = gtk_action_get_gicon(gtkAction);
426 
427 		if(p is null)
428 		{
429 			return null;
430 		}
431 
432 		return ObjectG.getDObject!(IconIF)(cast(GIcon*) p);
433 	}
434 
435 	/**
436 	 * Gets the icon name of @action.
437 	 *
438 	 * Deprecated: Use #GAction instead, and
439 	 * g_menu_item_get_attribute_value() to get an icon from a #GMenuItem
440 	 * associated with a #GAction
441 	 *
442 	 * Returns: the icon name
443 	 *
444 	 * Since: 2.16
445 	 */
446 	public string getIconName()
447 	{
448 		return Str.toString(gtk_action_get_icon_name(gtkAction));
449 	}
450 
451 	/**
452 	 * Checks whether @action is important or not
453 	 *
454 	 * Deprecated: Use #GAction instead, and control and monitor whether
455 	 * labels are shown directly
456 	 *
457 	 * Returns: whether @action is important
458 	 *
459 	 * Since: 2.16
460 	 */
461 	public bool getIsImportant()
462 	{
463 		return gtk_action_get_is_important(gtkAction) != 0;
464 	}
465 
466 	/**
467 	 * Gets the label text of @action.
468 	 *
469 	 * Deprecated: Use #GAction instead, and get a label from a menu item
470 	 * with g_menu_item_get_attribute_value(). For #GtkActionable widgets, use the
471 	 * widget-specific API to get a label
472 	 *
473 	 * Returns: the label text
474 	 *
475 	 * Since: 2.16
476 	 */
477 	public string getLabel()
478 	{
479 		return Str.toString(gtk_action_get_label(gtkAction));
480 	}
481 
482 	/**
483 	 * Returns the name of the action.
484 	 *
485 	 * Deprecated: Use g_action_get_name() on a #GAction instead
486 	 *
487 	 * Returns: the name of the action. The string belongs to GTK+ and should not
488 	 *     be freed.
489 	 *
490 	 * Since: 2.4
491 	 */
492 	public string getName()
493 	{
494 		return Str.toString(gtk_action_get_name(gtkAction));
495 	}
496 
497 	/**
498 	 * Returns the proxy widgets for an action.
499 	 * See also gtk_activatable_get_related_action().
500 	 *
501 	 * Returns: a #GSList of proxy widgets. The list is owned by GTK+
502 	 *     and must not be modified.
503 	 *
504 	 * Since: 2.4
505 	 */
506 	public ListSG getProxies()
507 	{
508 		auto p = gtk_action_get_proxies(gtkAction);
509 
510 		if(p is null)
511 		{
512 			return null;
513 		}
514 
515 		return new ListSG(cast(GSList*) p);
516 	}
517 
518 	/**
519 	 * Returns whether the action itself is sensitive. Note that this doesn’t
520 	 * necessarily mean effective sensitivity. See gtk_action_is_sensitive()
521 	 * for that.
522 	 *
523 	 * Deprecated: Use g_action_get_enabled() on a #GAction
524 	 * instead
525 	 *
526 	 * Returns: %TRUE if the action itself is sensitive.
527 	 *
528 	 * Since: 2.4
529 	 */
530 	public bool getSensitive()
531 	{
532 		return gtk_action_get_sensitive(gtkAction) != 0;
533 	}
534 
535 	/**
536 	 * Gets the short label text of @action.
537 	 *
538 	 * Deprecated: Use #GAction instead, which has no equivalent of short
539 	 * labels
540 	 *
541 	 * Returns: the short label text.
542 	 *
543 	 * Since: 2.16
544 	 */
545 	public string getShortLabel()
546 	{
547 		return Str.toString(gtk_action_get_short_label(gtkAction));
548 	}
549 
550 	/**
551 	 * Gets the tooltip text of @action.
552 	 *
553 	 * Deprecated: Use #GAction instead, and get tooltips from associated
554 	 * #GtkActionable widgets with gtk_widget_get_tooltip_text()
555 	 *
556 	 * Returns: the tooltip text
557 	 *
558 	 * Since: 2.16
559 	 */
560 	public string getTooltip()
561 	{
562 		return Str.toString(gtk_action_get_tooltip(gtkAction));
563 	}
564 
565 	/**
566 	 * Returns whether the action itself is visible. Note that this doesn’t
567 	 * necessarily mean effective visibility. See gtk_action_is_sensitive()
568 	 * for that.
569 	 *
570 	 * Deprecated: Use #GAction instead, and control and monitor the state of
571 	 * #GtkActionable widgets directly
572 	 *
573 	 * Returns: %TRUE if the action itself is visible.
574 	 *
575 	 * Since: 2.4
576 	 */
577 	public bool getVisible()
578 	{
579 		return gtk_action_get_visible(gtkAction) != 0;
580 	}
581 
582 	/**
583 	 * Checks whether @action is visible when horizontal
584 	 *
585 	 * Deprecated: Use #GAction instead, and control and monitor the
586 	 * visibility of associated widgets and menu items directly
587 	 *
588 	 * Returns: whether @action is visible when horizontal
589 	 *
590 	 * Since: 2.16
591 	 */
592 	public bool getVisibleHorizontal()
593 	{
594 		return gtk_action_get_visible_horizontal(gtkAction) != 0;
595 	}
596 
597 	/**
598 	 * Checks whether @action is visible when horizontal
599 	 *
600 	 * Deprecated: Use #GAction instead, and control and monitor the
601 	 * visibility of associated widgets and menu items directly
602 	 *
603 	 * Returns: whether @action is visible when horizontal
604 	 *
605 	 * Since: 2.16
606 	 */
607 	public bool getVisibleVertical()
608 	{
609 		return gtk_action_get_visible_vertical(gtkAction) != 0;
610 	}
611 
612 	/**
613 	 * Returns whether the action is effectively sensitive.
614 	 *
615 	 * Deprecated: Use g_action_get_enabled() on a #GAction
616 	 * instead
617 	 *
618 	 * Returns: %TRUE if the action and its associated action group
619 	 *     are both sensitive.
620 	 *
621 	 * Since: 2.4
622 	 */
623 	public bool isSensitive()
624 	{
625 		return gtk_action_is_sensitive(gtkAction) != 0;
626 	}
627 
628 	/**
629 	 * Returns whether the action is effectively visible.
630 	 *
631 	 * Deprecated: Use #GAction instead, and control and monitor the state of
632 	 * #GtkActionable widgets directly
633 	 *
634 	 * Returns: %TRUE if the action and its associated action group
635 	 *     are both visible.
636 	 *
637 	 * Since: 2.4
638 	 */
639 	public bool isVisible()
640 	{
641 		return gtk_action_is_visible(gtkAction) != 0;
642 	}
643 
644 	/**
645 	 * Sets the #GtkAccelGroup in which the accelerator for this action
646 	 * will be installed.
647 	 *
648 	 * Deprecated: Use #GAction and the accelerator group on an associated
649 	 * #GtkMenu instead
650 	 *
651 	 * Params:
652 	 *     accelGroup = a #GtkAccelGroup or %NULL
653 	 *
654 	 * Since: 2.4
655 	 */
656 	public void setAccelGroup(AccelGroup accelGroup)
657 	{
658 		gtk_action_set_accel_group(gtkAction, (accelGroup is null) ? null : accelGroup.getAccelGroupStruct());
659 	}
660 
661 	/**
662 	 * Sets the accel path for this action.  All proxy widgets associated
663 	 * with the action will have this accel path, so that their
664 	 * accelerators are consistent.
665 	 *
666 	 * Note that @accel_path string will be stored in a #GQuark. Therefore, if you
667 	 * pass a static string, you can save some memory by interning it first with
668 	 * g_intern_static_string().
669 	 *
670 	 * Deprecated: Use #GAction and the accelerator path on an associated
671 	 * #GtkMenu instead
672 	 *
673 	 * Params:
674 	 *     accelPath = the accelerator path
675 	 *
676 	 * Since: 2.4
677 	 */
678 	public void setAccelPath(string accelPath)
679 	{
680 		gtk_action_set_accel_path(gtkAction, Str.toStringz(accelPath));
681 	}
682 
683 	/**
684 	 * Sets whether @action's menu item proxies will ignore the
685 	 * #GtkSettings:gtk-menu-images setting and always show their image, if available.
686 	 *
687 	 * Use this if the menu item would be useless or hard to use
688 	 * without their image.
689 	 *
690 	 * Deprecated: Use g_menu_item_set_icon() on a #GMenuItem instead, if the
691 	 * item should have an image
692 	 *
693 	 * Params:
694 	 *     alwaysShow = %TRUE if menuitem proxies should always show their image
695 	 *
696 	 * Since: 2.20
697 	 */
698 	public void setAlwaysShowImage(bool alwaysShow)
699 	{
700 		gtk_action_set_always_show_image(gtkAction, alwaysShow);
701 	}
702 
703 	/**
704 	 * Sets the icon of @action.
705 	 *
706 	 * Deprecated: Use #GAction instead, and g_menu_item_set_icon() to set an
707 	 * icon on a #GMenuItem associated with a #GAction, or gtk_container_add() to
708 	 * add a #GtkImage to a #GtkButton
709 	 *
710 	 * Params:
711 	 *     icon = the #GIcon to set
712 	 *
713 	 * Since: 2.16
714 	 */
715 	public void setGicon(IconIF icon)
716 	{
717 		gtk_action_set_gicon(gtkAction, (icon is null) ? null : icon.getIconStruct());
718 	}
719 
720 	/**
721 	 * Sets the icon name on @action
722 	 *
723 	 * Deprecated: Use #GAction instead, and g_menu_item_set_icon() to set an
724 	 * icon on a #GMenuItem associated with a #GAction, or gtk_container_add() to
725 	 * add a #GtkImage to a #GtkButton
726 	 *
727 	 * Params:
728 	 *     iconName = the icon name to set
729 	 *
730 	 * Since: 2.16
731 	 */
732 	public void setIconName(string iconName)
733 	{
734 		gtk_action_set_icon_name(gtkAction, Str.toStringz(iconName));
735 	}
736 
737 	/**
738 	 * Sets whether the action is important, this attribute is used
739 	 * primarily by toolbar items to decide whether to show a label
740 	 * or not.
741 	 *
742 	 * Deprecated: Use #GAction instead, and control and monitor whether
743 	 * labels are shown directly
744 	 *
745 	 * Params:
746 	 *     isImportant = %TRUE to make the action important
747 	 *
748 	 * Since: 2.16
749 	 */
750 	public void setIsImportant(bool isImportant)
751 	{
752 		gtk_action_set_is_important(gtkAction, isImportant);
753 	}
754 
755 	/**
756 	 * Sets the label of @action.
757 	 *
758 	 * Deprecated: Use #GAction instead, and set a label on a menu item with
759 	 * g_menu_item_set_label(). For #GtkActionable widgets, use the widget-specific
760 	 * API to set a label
761 	 *
762 	 * Params:
763 	 *     label = the label text to set
764 	 *
765 	 * Since: 2.16
766 	 */
767 	public void setLabel(string label)
768 	{
769 		gtk_action_set_label(gtkAction, Str.toStringz(label));
770 	}
771 
772 	/**
773 	 * Sets the :sensitive property of the action to @sensitive. Note that
774 	 * this doesn’t necessarily mean effective sensitivity. See
775 	 * gtk_action_is_sensitive()
776 	 * for that.
777 	 *
778 	 * Deprecated: Use g_simple_action_set_enabled() on a #GSimpleAction
779 	 * instead
780 	 *
781 	 * Params:
782 	 *     sensitive = %TRUE to make the action sensitive
783 	 *
784 	 * Since: 2.6
785 	 */
786 	public void setSensitive(bool sensitive)
787 	{
788 		gtk_action_set_sensitive(gtkAction, sensitive);
789 	}
790 
791 	/**
792 	 * Sets a shorter label text on @action.
793 	 *
794 	 * Deprecated: Use #GAction instead, which has no equivalent of short
795 	 * labels
796 	 *
797 	 * Params:
798 	 *     shortLabel = the label text to set
799 	 *
800 	 * Since: 2.16
801 	 */
802 	public void setShortLabel(string shortLabel)
803 	{
804 		gtk_action_set_short_label(gtkAction, Str.toStringz(shortLabel));
805 	}
806 
807 	/**
808 	 * Sets the stock id on @action
809 	 *
810 	 * Deprecated: Use #GAction instead, which has no equivalent of stock
811 	 * items
812 	 *
813 	 * Params:
814 	 *     stockId = the stock id
815 	 *
816 	 * Since: 2.16
817 	 */
818 	public void setStockId(string stockId)
819 	{
820 		gtk_action_set_stock_id(gtkAction, Str.toStringz(stockId));
821 	}
822 
823 	/**
824 	 * Sets the tooltip text on @action
825 	 *
826 	 * Deprecated: Use #GAction instead, and set tooltips on associated
827 	 * #GtkActionable widgets with gtk_widget_set_tooltip_text()
828 	 *
829 	 * Params:
830 	 *     tooltip = the tooltip text
831 	 *
832 	 * Since: 2.16
833 	 */
834 	public void setTooltip(string tooltip)
835 	{
836 		gtk_action_set_tooltip(gtkAction, Str.toStringz(tooltip));
837 	}
838 
839 	/**
840 	 * Sets the :visible property of the action to @visible. Note that
841 	 * this doesn’t necessarily mean effective visibility. See
842 	 * gtk_action_is_visible()
843 	 * for that.
844 	 *
845 	 * Deprecated: Use #GAction instead, and control and monitor the state of
846 	 * #GtkActionable widgets directly
847 	 *
848 	 * Params:
849 	 *     visible = %TRUE to make the action visible
850 	 *
851 	 * Since: 2.6
852 	 */
853 	public void setVisible(bool visible)
854 	{
855 		gtk_action_set_visible(gtkAction, visible);
856 	}
857 
858 	/**
859 	 * Sets whether @action is visible when horizontal
860 	 *
861 	 * Deprecated: Use #GAction instead, and control and monitor the
862 	 * visibility of associated widgets and menu items directly
863 	 *
864 	 * Params:
865 	 *     visibleHorizontal = whether the action is visible horizontally
866 	 *
867 	 * Since: 2.16
868 	 */
869 	public void setVisibleHorizontal(bool visibleHorizontal)
870 	{
871 		gtk_action_set_visible_horizontal(gtkAction, visibleHorizontal);
872 	}
873 
874 	/**
875 	 * Sets whether @action is visible when vertical
876 	 *
877 	 * Deprecated: Use #GAction instead, and control and monitor the
878 	 * visibility of associated widgets and menu items directly
879 	 *
880 	 * Params:
881 	 *     visibleVertical = whether the action is visible vertically
882 	 *
883 	 * Since: 2.16
884 	 */
885 	public void setVisibleVertical(bool visibleVertical)
886 	{
887 		gtk_action_set_visible_vertical(gtkAction, visibleVertical);
888 	}
889 
890 	/**
891 	 * Reenable activation signals from the action
892 	 *
893 	 * Deprecated: Use g_simple_action_set_enabled() to enable the
894 	 * #GSimpleAction instead
895 	 *
896 	 * Since: 2.16
897 	 */
898 	public void unblockActivate()
899 	{
900 		gtk_action_unblock_activate(gtkAction);
901 	}
902 
903 	protected class OnActivateDelegateWrapper
904 	{
905 		void delegate(Action) dlg;
906 		gulong handlerId;
907 
908 		this(void delegate(Action) dlg)
909 		{
910 			this.dlg = dlg;
911 			onActivateListeners ~= this;
912 		}
913 
914 		void remove(OnActivateDelegateWrapper source)
915 		{
916 			foreach(index, wrapper; onActivateListeners)
917 			{
918 				if (wrapper.handlerId == source.handlerId)
919 				{
920 					onActivateListeners[index] = null;
921 					onActivateListeners = std.algorithm.remove(onActivateListeners, index);
922 					break;
923 				}
924 			}
925 		}
926 	}
927 	OnActivateDelegateWrapper[] onActivateListeners;
928 
929 	/**
930 	 * The "activate" signal is emitted when the action is activated.
931 	 *
932 	 * Deprecated: Use #GSimpleAction::activate instead
933 	 *
934 	 * Since: 2.4
935 	 */
936 	gulong addOnActivate(void delegate(Action) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
937 	{
938 		auto wrapper = new OnActivateDelegateWrapper(dlg);
939 		wrapper.handlerId = Signals.connectData(
940 			this,
941 			"activate",
942 			cast(GCallback)&callBackActivate,
943 			cast(void*)wrapper,
944 			cast(GClosureNotify)&callBackActivateDestroy,
945 			connectFlags);
946 		return wrapper.handlerId;
947 	}
948 
949 	extern(C) static void callBackActivate(GtkAction* actionStruct, OnActivateDelegateWrapper wrapper)
950 	{
951 		wrapper.dlg(wrapper.outer);
952 	}
953 
954 	extern(C) static void callBackActivateDestroy(OnActivateDelegateWrapper wrapper, GClosure* closure)
955 	{
956 		wrapper.remove(wrapper);
957 	}
958 }