]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkaction.c
range: don't draw origin when the slider is invisible
[~andy/gtk] / gtk / gtkaction.c
index 8902684c72de6c6e97c80519a3b058a9075b2236..6bb0ae9d7b6eb3a07063bf6d4fb70f515aa56e48 100644 (file)
@@ -14,9 +14,7 @@
  * Library General Public License for more details.
  *
  * You should have received a copy of the GNU Library General Public
- * License along with the Gnome Library; see the file COPYING.LIB.  If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -86,7 +84,7 @@
 #include "gtkmarshalers.h"
 #include "gtkmenuitem.h"
 #include "gtkstock.h"
-#include "gtktearoffmenuitem.h"
+#include "deprecated/gtktearoffmenuitem.h"
 #include "gtktoolbutton.h"
 #include "gtktoolbar.h"
 #include "gtkprivate.h"
@@ -94,8 +92,6 @@
 #include "gtkactivatable.h"
 
 
-#define GTK_ACTION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_ACTION, GtkActionPrivate))
-
 struct _GtkActionPrivate 
 {
   const gchar *name; /* interned */
@@ -441,7 +437,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;
@@ -506,10 +504,11 @@ gtk_action_buildable_get_name (GtkBuildable *buildable)
 /**
  * gtk_action_new:
  * @name: A unique name for the action
- * @label: (allow-none): the label displayed in menu items and on buttons, or %NULL
+ * @label: (allow-none): the label displayed in menu items and on buttons,
+ *         or %NULL
  * @tooltip: (allow-none): a tooltip for the action, or %NULL
- * @stock_id: the stock icon to display in widgets representing the
- *   action, or %NULL
+ * @stock_id: (allow-none): the stock icon to display in widgets representing
+ *            the action, or %NULL
  *
  * Creates a new #GtkAction object. To add the action to a
  * #GtkActionGroup and set the accelerator for the action,
@@ -715,6 +714,7 @@ static void
 remove_proxy (GtkAction *action,
              GtkWidget *proxy)
 {
+  g_object_unref (proxy);
   action->private_data->proxies = g_slist_remove (action->private_data->proxies, proxy);
 }
 
@@ -724,6 +724,8 @@ connect_proxy (GtkAction *action,
 {
   action->private_data->proxies = g_slist_prepend (action->private_data->proxies, proxy);
 
+  g_object_ref_sink (proxy);
+
   if (action->private_data->action_group)
     _gtk_action_group_emit_connect_proxy (action->private_data->action_group, action, proxy);
 
@@ -789,18 +791,20 @@ _gtk_action_emit_activate (GtkAction *action)
 {
   GtkActionGroup *group = action->private_data->action_group;
 
-  if (group != NULL) 
+  if (group != NULL)
     {
+      g_object_ref (action);
       g_object_ref (group);
       _gtk_action_group_emit_pre_activate (group, action);
     }
 
-    g_signal_emit (action, action_signals[ACTIVATE], 0);
+  g_signal_emit (action, action_signals[ACTIVATE], 0);
 
-  if (group != NULL) 
+  if (group != NULL)
     {
       _gtk_action_group_emit_post_activate (group, action);
       g_object_unref (group);
+      g_object_unref (action);
     }
 }
 
@@ -873,7 +877,7 @@ gtk_action_unblock_activate (GtkAction *action)
  * This function is intended for use by action implementations to
  * create icons displayed in the proxy widgets.
  *
- * Returns: a widget that displays the icon for this action.
+ * Returns: (transfer none): a widget that displays the icon for this action.
  *
  * Since: 2.4
  */
@@ -899,7 +903,7 @@ gtk_action_create_icon (GtkAction *action, GtkIconSize icon_size)
  *
  * Creates a menu item widget that proxies for the given action.
  *
- * Returns: a menu item connected to the action.
+ * Returns: (transfer none): a menu item connected to the action.
  *
  * Since: 2.4
  */
@@ -924,7 +928,7 @@ gtk_action_create_menu_item (GtkAction *action)
  *
  * Creates a toolbar item widget that proxies for the given action.
  *
- * Returns: a toolbar item connected to the action.
+ * Returns: (transfer none): a toolbar item connected to the action.
  *
  * Since: 2.4
  */
@@ -994,7 +998,7 @@ gtk_action_get_proxies (GtkAction *action)
  *
  * Since: 2.4
  **/
-G_CONST_RETURN gchar *
+const gchar *
 gtk_action_get_name (GtkAction *action)
 {
   g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
@@ -1291,7 +1295,7 @@ gtk_action_set_label (GtkAction     *action,
  *
  * Since: 2.16
  */
-G_CONST_RETURN gchar * 
+const gchar *
 gtk_action_get_label (GtkAction *action)
 {
   g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
@@ -1337,7 +1341,7 @@ gtk_action_set_short_label (GtkAction   *action,
  *
  * Since: 2.16
  */
-G_CONST_RETURN gchar * 
+const gchar *
 gtk_action_get_short_label (GtkAction *action)
 {
   g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
@@ -1469,7 +1473,7 @@ gtk_action_set_tooltip (GtkAction   *action,
  *
  * Since: 2.16
  */
-G_CONST_RETURN gchar * 
+const gchar *
 gtk_action_get_tooltip (GtkAction *action)
 {
   g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
@@ -1527,7 +1531,7 @@ gtk_action_set_stock_id (GtkAction   *action,
  *
  * Since: 2.16
  */
-G_CONST_RETURN gchar * 
+const gchar *
 gtk_action_get_stock_id (GtkAction *action)
 {
   g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
@@ -1569,7 +1573,7 @@ gtk_action_set_icon_name (GtkAction   *action,
  *
  * Since: 2.16
  */
-G_CONST_RETURN gchar * 
+const gchar *
 gtk_action_get_icon_name (GtkAction *action)
 {
   g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
@@ -1609,7 +1613,7 @@ gtk_action_set_gicon (GtkAction *action,
  *
  * Gets the gicon of @action.
  *
- * Returns: The action's #GIcon if one is set.
+ * Returns: (transfer none): The action's #GIcon if one is set.
  *
  * Since: 2.16
  */
@@ -1686,7 +1690,7 @@ gtk_action_set_accel_path (GtkAction   *action,
  *   if none is set. The returned string is owned by GTK+ 
  *   and must not be freed or modified.
  */
-G_CONST_RETURN gchar *
+const gchar *
 gtk_action_get_accel_path (GtkAction *action)
 {
   g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
@@ -1705,8 +1709,9 @@ gtk_action_get_accel_path (GtkAction *action)
  *
  * Since: 2.8
  *
- * Returns: the accel closure for this action. The returned closure is
- *          owned by GTK+ and must not be unreffed or modified.
+ * Returns: (transfer none): the accel closure for this action. The
+ *          returned closure is owned by GTK+ and must not be unreffed
+ *          or modified.
  */
 GClosure *
 gtk_action_get_accel_closure (GtkAction *action)
@@ -1811,7 +1816,8 @@ gtk_action_disconnect_accelerator (GtkAction *action)
  * item or the toolbar item it creates, this function returns an
  * instance of that menu.
  *
- * Return value: the menu item provided by the action, or %NULL.
+ * Return value: (transfer none): the menu item provided by the
+ *               action, or %NULL.
  *
  * Since: 2.12
  */