summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--docs/reference/ChangeLog4
-rw-r--r--docs/reference/gtk/gtk-sections.txt19
-rw-r--r--gtk/gtk.symbols18
-rw-r--r--gtk/gtkaction.c314
-rw-r--r--gtk/gtkaction.h29
6 files changed, 362 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index 96681e5541..030f2829cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-20 Matthias Clasen <mclasen@redhat.com>
+
+ * gtk/gtk.symbols:
+ * gtk/gtkaction.[hc]: Add setters and getters for GtkAction
+ properties, in preparation for bug 560228.
+
2009-01-21 Christian Dywan <christian@twotoasts.de>
Bug 567413 – GtkComboBoxEntry doesn't emit "changed" signal
diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog
index dd3da2b828..3659d7c4d6 100644
--- a/docs/reference/ChangeLog
+++ b/docs/reference/ChangeLog
@@ -1,5 +1,9 @@
2009-01-20 Matthias Clasen <mclasen@redhat.com>
+ * gtk/gtk-sections.txt: Add new GtkAction api
+
+2009-01-20 Matthias Clasen <mclasen@redhat.com>
+
* gtk/gtk-sections.txt: Add new scale api
2009-01-19 Matthias Clasen <mclasen@redhat.com>
diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt
index 597e65a740..13181c5bb7 100644
--- a/docs/reference/gtk/gtk-sections.txt
+++ b/docs/reference/gtk/gtk-sections.txt
@@ -194,6 +194,25 @@ gtk_action_get_accel_path
gtk_action_set_accel_path
gtk_action_get_accel_closure
gtk_action_set_accel_group
+gtk_action_set_label
+gtk_action_get_label
+gtk_action_set_short_label
+gtk_action_get_short_label
+gtk_action_set_tooltip
+gtk_action_get_tooltip
+gtk_action_set_stock_id
+gtk_action_get_stock_id
+gtk_action_set_gicon
+gtk_action_get_gicon
+gtk_action_set_icon_name
+gtk_action_get_icon_name
+gtk_action_set_visible_horizontal
+gtk_action_get_visible_horizontal
+gtk_action_set_visible_vertical
+gtk_action_get_visible_vertical
+gtk_action_set_is_important
+gtk_action_get_is_important
+
<SUBSECTION Standard>
GTK_TYPE_ACTION
GTK_ACTION
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 096b8fe01e..777cb0aac7 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -169,6 +169,24 @@ gtk_action_set_accel_path
gtk_action_set_sensitive
gtk_action_set_visible
gtk_action_unblock_activate_from
+gtk_action_set_label
+gtk_action_get_label
+gtk_action_set_short_label
+gtk_action_get_short_label
+gtk_action_set_tooltip
+gtk_action_get_tooltip
+gtk_action_set_stock_id
+gtk_action_get_stock_id
+gtk_action_set_gicon
+gtk_action_get_gicon
+gtk_action_set_icon_name
+gtk_action_get_icon_name
+gtk_action_set_visible_horizontal
+gtk_action_get_visible_horizontal
+gtk_action_set_visible_vertical
+gtk_action_get_visible_vertical
+gtk_action_set_is_important
+gtk_action_get_is_important
#endif
#endif
diff --git a/gtk/gtkaction.c b/gtk/gtkaction.c
index cc6858b478..59c52d3552 100644
--- a/gtk/gtkaction.c
+++ b/gtk/gtkaction.c
@@ -135,26 +135,8 @@ static void gtk_action_get_property (GObject *object,
GParamSpec *pspec);
static void gtk_action_set_action_group (GtkAction *action,
GtkActionGroup *action_group);
-static void gtk_action_set_is_important (GtkAction *action,
- gboolean is_important);
-static void gtk_action_set_label (GtkAction *action,
- const gchar *label);
-static void gtk_action_set_short_label (GtkAction *action,
- const gchar *label);
-static void gtk_action_set_visible_horizontal (GtkAction *action,
- gboolean visible_horizontal);
-static void gtk_action_set_visible_vertical (GtkAction *action,
- gboolean visible_vertical);
-static void gtk_action_set_tooltip (GtkAction *action,
- const gchar *tooltip);
-static void gtk_action_set_stock_id (GtkAction *action,
- const gchar *stock_id);
-static void gtk_action_set_icon_name (GtkAction *action,
- const gchar *icon_name);
static void gtk_action_sync_tooltip (GtkAction *action,
GtkWidget *proxy);
-static void gtk_action_set_gicon (GtkAction *action,
- GIcon *icon);
static GtkWidget *create_menu_item (GtkAction *action);
static GtkWidget *create_tool_item (GtkAction *action);
@@ -221,6 +203,12 @@ gtk_action_class_init (GtkActionClass *klass)
"that activate this action."),
NULL,
GTK_PARAM_READWRITE));
+
+ /**
+ * GtkAction:short-label:
+ *
+ * A shorter label that may be used on toolbar buttons.
+ */
g_object_class_install_property (gobject_class,
PROP_SHORT_LABEL,
g_param_spec_string ("short-label",
@@ -228,6 +216,8 @@ gtk_action_class_init (GtkActionClass *klass)
P_("A shorter label that may be used on toolbar buttons."),
NULL,
GTK_PARAM_READWRITE));
+
+
g_object_class_install_property (gobject_class,
PROP_TOOLTIP,
g_param_spec_string ("tooltip",
@@ -235,6 +225,12 @@ gtk_action_class_init (GtkActionClass *klass)
P_("A tooltip for this action."),
NULL,
GTK_PARAM_READWRITE));
+
+ /**
+ * GtkAction:stock-id:
+ *
+ * The stock icon displayed in widgets representing this action.
+ */
g_object_class_install_property (gobject_class,
PROP_STOCK_ID,
g_param_spec_string ("stock-id",
@@ -1363,14 +1359,26 @@ gtk_action_set_visible (GtkAction *action,
g_object_notify (G_OBJECT (action), "visible");
}
}
-
-static void
+/**
+ * gtk_action_set_is_important:
+ * @action: the action object
+ * @is_important: %TRUE to make the action important
+ *
+ * Sets whether the action is important, this attribute is used
+ * primarily by toolbar items to decide whether to show a label
+ * or not.
+ *
+ * Since: 2.16
+ */
+void
gtk_action_set_is_important (GtkAction *action,
gboolean is_important)
{
GSList *p;
GtkWidget *proxy;
+ g_return_if_fail (GTK_IS_ACTION (action));
+
is_important = is_important != FALSE;
if (action->private_data->is_important != is_important)
@@ -1390,7 +1398,34 @@ gtk_action_set_is_important (GtkAction *action,
}
}
-static void
+/**
+ * gtk_action_get_is_important:
+ * @action: a #GtkAction
+ *
+ * Checks whether @action is important or not
+ *
+ * Returns: whether @action is important
+ *
+ * Since: 2.16
+ */
+gboolean
+gtk_action_get_is_important (GtkAction *action)
+{
+ g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);
+
+ return action->private_data->is_important;
+}
+
+/**
+ * gtk_action_set_label:
+ * @action: a #GtkAction
+ * @label: the label text to set
+ *
+ * Sets the label of @action.
+ *
+ * Since: 2.16
+ */
+void
gtk_action_set_label (GtkAction *action,
const gchar *label)
{
@@ -1398,6 +1433,8 @@ gtk_action_set_label (GtkAction *action,
GtkWidget *proxy, *child;
gchar *tmp;
+ g_return_if_fail (GTK_IS_ACTION (action));
+
tmp = action->private_data->label;
action->private_data->label = g_strdup (label);
g_free (tmp);
@@ -1435,7 +1472,34 @@ gtk_action_set_label (GtkAction *action,
}
}
-static void
+/**
+ * gtk_action_get_label:
+ * @action: a #GtkAction
+ *
+ * Gets the label text of @action.
+ *
+ * Returns: the label text
+ *
+ * Since: 2.16
+ */
+G_CONST_RETURN gchar *
+gtk_action_get_label (GtkAction *action)
+{
+ g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
+
+ return action->private_data->label;
+}
+
+/**
+ * gtk_action_set_short_label:
+ * @action: a #GtkAction
+ * @label: the label text to set
+ *
+ * Sets a shorter label on @action.
+ *
+ * Since: 2.16
+ */
+void
gtk_action_set_short_label (GtkAction *action,
const gchar *label)
{
@@ -1443,6 +1507,8 @@ gtk_action_set_short_label (GtkAction *action,
GtkWidget *proxy, *child;
gchar *tmp;
+ g_return_if_fail (GTK_IS_ACTION (action));
+
tmp = action->private_data->short_label;
action->private_data->short_label = g_strdup (label);
g_free (tmp);
@@ -1477,13 +1543,42 @@ gtk_action_set_short_label (GtkAction *action,
g_object_notify (G_OBJECT (action), "short-label");
}
-static void
+/**
+ * gtk_action_get_short_label:
+ * @action: a #GtkAction
+ * @label: the label text to set
+ *
+ * Sets a shorter label on @action.
+ *
+ * Since: 2.16
+ */
+G_CONST_RETURN gchar *
+gtk_action_get_short_label (GtkAction *action)
+{
+ g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
+
+ g_object_notify (G_OBJECT (action), "short-label");
+ return action->private_data->short_label;
+}
+
+/**
+ * gtk_action_set_visible_horizontal:
+ * @action: a #GtkAction
+ * @visible_horizontal: whether the action is visible horizontally
+ *
+ * Sets whether @action is visible when horizontal
+ *
+ * Since: 2.16
+ */
+void
gtk_action_set_visible_horizontal (GtkAction *action,
gboolean visible_horizontal)
{
GSList *p;
GtkWidget *proxy;
+ g_return_if_fail (GTK_IS_ACTION (action));
+
visible_horizontal = visible_horizontal != FALSE;
if (action->private_data->visible_horizontal != visible_horizontal)
@@ -1503,13 +1598,42 @@ gtk_action_set_visible_horizontal (GtkAction *action,
}
}
-static void
+/**
+ * gtk_action_get_visible_horizontal:
+ * @action: a #GtkAction
+ *
+ * Checks whether @action is visible when horizontal
+ *
+ * Returns: whether @action is visible when horizontal
+ *
+ * Since: 2.16
+ */
+gboolean
+gtk_action_get_visible_horizontal (GtkAction *action)
+{
+ g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);
+
+ return action->private_data->visible_horizontal;
+}
+
+/**
+ * gtk_action_set_visible_vertical:
+ * @action: a #GtkAction
+ * @visible_vertical: whether the action is visible vertically
+ *
+ * Sets whether @action is visible when vertical
+ *
+ * Since: 2.16
+ */
+void
gtk_action_set_visible_vertical (GtkAction *action,
gboolean visible_vertical)
{
GSList *p;
GtkWidget *proxy;
+ g_return_if_fail (GTK_IS_ACTION (action));
+
visible_vertical = visible_vertical != FALSE;
if (action->private_data->visible_vertical != visible_vertical)
@@ -1529,6 +1653,24 @@ gtk_action_set_visible_vertical (GtkAction *action,
}
}
+/**
+ * gtk_action_get_visible_vertical:
+ * @action: a #GtkAction
+ *
+ * Checks whether @action is visible when horizontal
+ *
+ * Returns: whether @action is visible when horizontal
+ *
+ * Since: 2.16
+ */
+gboolean
+gtk_action_get_visible_vertical (GtkAction *action)
+{
+ g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);
+
+ return action->private_data->visible_vertical;
+}
+
static void
gtk_action_sync_tooltip (GtkAction *action,
GtkWidget *proxy)
@@ -1537,7 +1679,16 @@ gtk_action_sync_tooltip (GtkAction *action,
action->private_data->tooltip);
}
-static void
+/**
+ * gtk_action_set_tooltip:
+ * @action: a #GtkAction
+ * @tooltip: the tooltip text
+ *
+ * Sets the tooltip text on @action
+ *
+ * Since: 2.16
+ */
+void
gtk_action_set_tooltip (GtkAction *action,
const gchar *tooltip)
{
@@ -1545,6 +1696,8 @@ gtk_action_set_tooltip (GtkAction *action,
GtkWidget *proxy;
gchar *tmp;
+ g_return_if_fail (GTK_IS_ACTION (action));
+
tmp = action->private_data->tooltip;
action->private_data->tooltip = g_strdup (tooltip);
g_free (tmp);
@@ -1560,7 +1713,34 @@ gtk_action_set_tooltip (GtkAction *action,
g_object_notify (G_OBJECT (action), "tooltip");
}
-static void
+/**
+ * gtk_action_get_tooltip:
+ * @action: a #GtkAction
+ *
+ * Gets the tooltip text of @action.
+ *
+* Returns: the tooltip text
+ *
+ * Since: 2.16
+ */
+G_CONST_RETURN gchar *
+gtk_action_get_tooltip (GtkAction *action)
+{
+ g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
+
+ return action->private_data->tooltip;
+}
+
+/**
+ * gtk_action_set_stock_id:
+ * @action: a #GtkAction
+ * @tooltip: the tooltip text
+ *
+ * Sets the stock id on @action
+ *
+ * Since: 2.16
+ */
+void
gtk_action_set_stock_id (GtkAction *action,
const gchar *stock_id)
{
@@ -1568,6 +1748,8 @@ gtk_action_set_stock_id (GtkAction *action,
GtkWidget *proxy, *image;
gchar *tmp;
+ g_return_if_fail (GTK_IS_ACTION (action));
+
tmp = action->private_data->stock_id;
action->private_data->stock_id = g_strdup (stock_id);
g_free (tmp);
@@ -1615,7 +1797,34 @@ gtk_action_set_stock_id (GtkAction *action,
}
}
-static void
+/**
+ * gtk_action_get_stock_id:
+ * @action: a #GtkAction
+ *
+ * Gets the stock id of @action.
+ *
+ * Returns: the stock id
+ *
+ * Since: 2.16
+ */
+G_CONST_RETURN gchar *
+gtk_action_get_stock_id (GtkAction *action)
+{
+ g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
+
+ return action->private_data->stock_id;
+}
+
+/**
+ * gtk_action_set_icon_name:
+ * @action: a #GtkAction
+ * @tooltip: the icon name to set
+ *
+ * Sets the icon name on @action
+ *
+ * Since: 2.16
+ */
+void
gtk_action_set_icon_name (GtkAction *action,
const gchar *icon_name)
{
@@ -1623,6 +1832,8 @@ gtk_action_set_icon_name (GtkAction *action,
GtkWidget *proxy, *image;
gchar *tmp;
+ g_return_if_fail (GTK_IS_ACTION (action));
+
tmp = action->private_data->icon_name;
action->private_data->icon_name = g_strdup (icon_name);
g_free (tmp);
@@ -1662,7 +1873,34 @@ gtk_action_set_icon_name (GtkAction *action,
g_object_notify (G_OBJECT (action), "icon-name");
}
-static void
+/**
+ * gtk_action_get_icon_name:
+ * @action: a #GtkAction
+ *
+ * Gets the icon name of @action.
+ *
+ * Returns: the icon name
+ *
+ * Since: 2.16
+ */
+G_CONST_RETURN gchar *
+gtk_action_get_icon_name (GtkAction *action)
+{
+ g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
+
+ return action->private_data->icon_name;
+}
+
+/**
+ * gtk_action_set_gicon:
+ * @action: a #GtkAction
+ * @icon: the #GIcon to set
+ *
+ * Sets the icon of @action.
+ *
+ * Since: 2.16
+ */
+void
gtk_action_set_gicon (GtkAction *action,
GIcon *icon)
{
@@ -1671,6 +1909,8 @@ gtk_action_set_gicon (GtkAction *action,
GtkIconSize icon_size;
gboolean has_stock_icon;
+ g_return_if_fail (GTK_IS_ACTION (action));
+
if (action->private_data->gicon)
g_object_unref (action->private_data->gicon);
@@ -1725,6 +1965,24 @@ gtk_action_set_gicon (GtkAction *action,
}
/**
+ * gtk_action_get_gicon:
+ * @action: a #GtkAction
+ *
+ * Gets the gicon of @action.
+ *
+ * Returns: The action's #GIcon if one is set.
+ *
+ * Since: 2.16
+ */
+GIcon *
+gtk_action_get_gicon (GtkAction *action)
+{
+ g_return_val_if_fail (GTK_IS_ACTION (action), NULL);
+
+ return action->private_data->gicon;
+}
+
+/**
* gtk_action_block_activate_from:
* @action: the action object
* @proxy: a proxy widget
diff --git a/gtk/gtkaction.h b/gtk/gtkaction.h
index 7c3177b68e..ff20c7dd66 100644
--- a/gtk/gtkaction.h
+++ b/gtk/gtkaction.h
@@ -134,6 +134,35 @@ void _gtk_action_sync_menu_visible (GtkAction *action,
GtkWidget *proxy,
gboolean empty);
+void gtk_action_set_label (GtkAction *action,
+ const gchar *label);
+G_CONST_RETURN gchar *gtk_action_get_label (GtkAction *action);
+void gtk_action_set_short_label (GtkAction *action,
+ const gchar *short_label);
+G_CONST_RETURN gchar *gtk_action_get_short_label (GtkAction *action);
+void gtk_action_set_tooltip (GtkAction *action,
+ const gchar *tooltip);
+G_CONST_RETURN gchar *gtk_action_get_tooltip (GtkAction *action);
+void gtk_action_set_stock_id (GtkAction *action,
+ const gchar *stock_id);
+G_CONST_RETURN gchar *gtk_action_get_stock_id (GtkAction *action);
+void gtk_action_set_gicon (GtkAction *action,
+ GIcon *icon);
+GIcon *gtk_action_get_gicon (GtkAction *action);
+void gtk_action_set_icon_name (GtkAction *action,
+ const gchar *icon_name);
+G_CONST_RETURN gchar *gtk_action_get_icon_name (GtkAction *action);
+void gtk_action_set_visible_horizontal (GtkAction *action,
+ gboolean visible_horizontal);
+gboolean gtk_action_get_visible_horizontal (GtkAction *action);
+void gtk_action_set_visible_vertical (GtkAction *action,
+ gboolean visible_vertical);
+gboolean gtk_action_get_visible_vertical (GtkAction *action);
+void gtk_action_set_is_important (GtkAction *action,
+ gboolean is_important);
+gboolean gtk_action_get_is_important (GtkAction *action);
+
+
G_END_DECLS
#endif /* __GTK_ACTION_H__ */