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