]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkaction.c
[l10n] Updated Estonian translation
[~andy/gtk] / gtk / gtkaction.c
index 1cb1cecaae053a18f70b1abfc3ede1a70dd7a7c3..dfa89ae8dbd25c2fdb330fcccef744681ed5cc09 100644 (file)
@@ -32,7 +32,7 @@
  * SECTION:gtkaction
  * @Short_description: An action which can be triggered by a menu or toolbar item
  * @Title: GtkAction
- * @See_also: #GtkActionGroup, #GtkUIManager
+ * @See_also: #GtkActionGroup, #GtkUIManager, #GtkActivatable
  *
  * Actions represent operations that the user can be perform, along with
  * some information how it should be presented in the interface. Each action
  * can be in the "active" state. Other actions can be implemented as #GtkAction
  * subclasses.
  *
- * Each action can have one or more proxy menu item, toolbar button or
- * other proxy widgets.  Proxies mirror the state of the action (text
- * label, tooltip, icon, visible, sensitive, etc), and should change when
- * the action's state changes. When the proxy is activated, it should
- * activate its action.
+ * Each action can have one or more proxy widgets. To act as an action proxy,
+ * widget needs to implement #GtkActivatable interface. Proxies mirror the state
+ * of the action and should change when the action's state changes. Properties
+ * that are always mirrored by proxies are #GtkAction:sensitive and
+ * #GtkAction:visible. #GtkAction:gicon, #GtkAction:icon-name, #GtkAction:label,
+ * #GtkAction:short-label and #GtkAction:stock-id properties are only mirorred
+ * if proxy widget has #GtkActivatable:use-action-appearance property set to
+ * %TRUE.
+ *
+ * When the proxy is activated, it should activate its action.
  */
 
 #include "config.h"
 #include "gtkprivate.h"
 #include "gtkbuildable.h"
 #include "gtkactivatable.h"
-#include "gtkalias.h"
-
 
-#define GTK_ACTION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_ACTION, GtkActionPrivate))
 
 struct _GtkActionPrivate 
 {
@@ -437,7 +439,9 @@ gtk_action_class_init (GtkActionClass *klass)
 static void
 gtk_action_init (GtkAction *action)
 {
-  action->private_data = GTK_ACTION_GET_PRIVATE (action);
+  action->private_data = G_TYPE_INSTANCE_GET_PRIVATE (action,
+                                                      GTK_TYPE_ACTION,
+                                                      GtkActionPrivate);
 
   action->private_data->name = NULL;
   action->private_data->label = NULL;
@@ -959,64 +963,12 @@ _gtk_action_remove_from_proxy_list (GtkAction     *action,
   GTK_ACTION_GET_CLASS (action)->disconnect_proxy (action, proxy);
 }
 
-/**
- * gtk_action_connect_proxy:
- * @action: the action object
- * @proxy: the proxy widget
- *
- * Connects a widget to an action object as a proxy.  Synchronises 
- * various properties of the action with the widget (such as label 
- * text, icon, tooltip, etc), and attaches a callback so that the 
- * action gets activated when the proxy widget does.
- *
- * If the widget is already connected to an action, it is disconnected
- * first.
- *
- * Since: 2.4
- *
- * Deprecated: 2.16: Use gtk_activatable_set_related_action() instead.
- */
-void
-gtk_action_connect_proxy (GtkAction *action,
-                         GtkWidget *proxy)
-{
-  g_return_if_fail (GTK_IS_ACTION (action));
-  g_return_if_fail (GTK_IS_WIDGET (proxy));
-  g_return_if_fail (GTK_IS_ACTIVATABLE (proxy));
-
-  gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (proxy), TRUE);
-
-  gtk_activatable_set_related_action (GTK_ACTIVATABLE (proxy), action);
-}
-
-/**
- * gtk_action_disconnect_proxy:
- * @action: the action object
- * @proxy: the proxy widget
- *
- * Disconnects a proxy widget from an action.  
- * Does <emphasis>not</emphasis> destroy the widget, however.
- *
- * Since: 2.4
- *
- * Deprecated: 2.16: Use gtk_activatable_set_related_action() instead.
- */
-void
-gtk_action_disconnect_proxy (GtkAction *action,
-                            GtkWidget *proxy)
-{
-  g_return_if_fail (GTK_IS_ACTION (action));
-  g_return_if_fail (GTK_IS_WIDGET (proxy));
-
-  gtk_activatable_set_related_action (GTK_ACTIVATABLE (proxy), NULL);
-}
-
 /**
  * gtk_action_get_proxies:
  * @action: the action object
  * 
  * Returns the proxy widgets for an action.
- * See also gtk_widget_get_action().
+ * See also gtk_activatable_get_related_action().
  *
  * Return value: (element-type GtkWidget) (transfer none): a #GSList of proxy widgets. The list is owned by GTK+
  * and must not be modified.
@@ -1031,32 +983,6 @@ gtk_action_get_proxies (GtkAction *action)
   return action->private_data->proxies;
 }
 
-
-/**
- * gtk_widget_get_action:
- * @widget: a #GtkWidget
- *
- * Returns the #GtkAction that @widget is a proxy for. 
- * See also gtk_action_get_proxies().
- *
- * Returns: the action that a widget is a proxy for, or
- *  %NULL, if it is not attached to an action.
- *
- * Since: 2.10
- *
- * Deprecated: 2.16: Use gtk_activatable_get_related_action() instead.
- */
-GtkAction*
-gtk_widget_get_action (GtkWidget *widget)
-{
-  g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-
-  if (GTK_IS_ACTIVATABLE (widget))
-    return gtk_activatable_get_related_action (GTK_ACTIVATABLE (widget));
-
-  return NULL;
-}
-
 /**
  * gtk_action_get_name:
  * @action: the action object
@@ -1695,62 +1621,6 @@ gtk_action_get_gicon (GtkAction *action)
   return action->private_data->gicon;
 }
 
-/**
- * gtk_action_block_activate_from:
- * @action: the action object
- * @proxy: a proxy widget
- *
- * Disables calls to the gtk_action_activate()
- * function by signals on the given proxy widget.  This is used to
- * break notification loops for things like check or radio actions.
- *
- * This function is intended for use by action implementations.
- * 
- * Since: 2.4
- *
- * Deprecated: 2.16: activatables are now responsible for activating the
- * action directly so this doesnt apply anymore.
- */
-void
-gtk_action_block_activate_from (GtkAction *action, 
-                               GtkWidget *proxy)
-{
-  g_return_if_fail (GTK_IS_ACTION (action));
-  
-  g_signal_handlers_block_by_func (proxy, G_CALLBACK (gtk_action_activate),
-                                  action);
-
-  gtk_action_block_activate (action);
-}
-
-/**
- * gtk_action_unblock_activate_from:
- * @action: the action object
- * @proxy: a proxy widget
- *
- * Re-enables calls to the gtk_action_activate()
- * function by signals on the given proxy widget.  This undoes the
- * blocking done by gtk_action_block_activate_from().
- *
- * This function is intended for use by action implementations.
- * 
- * Since: 2.4
- *
- * Deprecated: 2.16: activatables are now responsible for activating the
- * action directly so this doesnt apply anymore.
- */
-void
-gtk_action_unblock_activate_from (GtkAction *action, 
-                                 GtkWidget *proxy)
-{
-  g_return_if_fail (GTK_IS_ACTION (action));
-
-  g_signal_handlers_unblock_by_func (proxy, G_CALLBACK (gtk_action_activate),
-                                    action);
-
-  gtk_action_unblock_activate (action);
-}
-
 static void
 closure_accel_activate (GClosure     *closure,
                         GValue       *return_value,
@@ -1955,6 +1825,3 @@ gtk_action_create_menu (GtkAction *action)
 
   return NULL;
 }
-
-#define __GTK_ACTION_C__
-#include "gtkaliasdef.c"