Add properties and getters for icon tooltips.
* gtk/gtk.symbols:
* gtk/gtkentry.[hc]: Add properties and getters for icon tooltips.
svn path=/trunk/; revision=22139
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2009-01-18 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtk.symbols:
|
||||||
|
* gtk/gtkentry.[hc]: Add properties and getters for icon tooltips.
|
||||||
|
|
||||||
2009-01-18 Matthias Clasen <mclasen@redhat.com>
|
2009-01-18 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
Bug 563280 – stock items & translation context
|
Bug 563280 – stock items & translation context
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
|
2009-01-18 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtk-sections.txt: Add new api
|
||||||
|
|
||||||
2009-01-13 Christian Dywan <christian@imendio.com>
|
2009-01-13 Christian Dywan <christian@imendio.com>
|
||||||
|
|
||||||
Bug 567569 – Typo in GtkFileChooser example in GTK+ documentation
|
Bug 567569 – Typo in GtkFileChooser example in GTK+ documentation
|
||||||
|
|||||||
@ -1283,7 +1283,9 @@ gtk_entry_set_icon_sensitive
|
|||||||
gtk_entry_get_icon_sensitive
|
gtk_entry_get_icon_sensitive
|
||||||
gtk_entry_get_icon_at_pos
|
gtk_entry_get_icon_at_pos
|
||||||
gtk_entry_set_icon_tooltip_text
|
gtk_entry_set_icon_tooltip_text
|
||||||
|
gtk_entry_get_icon_tooltip_text
|
||||||
gtk_entry_set_icon_tooltip_markup
|
gtk_entry_set_icon_tooltip_markup
|
||||||
|
gtk_entry_get_icon_tooltip_markup
|
||||||
gtk_entry_set_icon_drag_source
|
gtk_entry_set_icon_drag_source
|
||||||
gtk_entry_get_current_icon_drag_source
|
gtk_entry_get_current_icon_drag_source
|
||||||
|
|
||||||
|
|||||||
@ -1288,6 +1288,8 @@ gtk_entry_get_icon_pixbuf
|
|||||||
gtk_entry_get_icon_sensitive
|
gtk_entry_get_icon_sensitive
|
||||||
gtk_entry_get_icon_stock
|
gtk_entry_get_icon_stock
|
||||||
gtk_entry_get_icon_storage_type
|
gtk_entry_get_icon_storage_type
|
||||||
|
gtk_entry_get_icon_tooltip_markup
|
||||||
|
gtk_entry_get_icon_tooltip_text
|
||||||
gtk_entry_get_inner_border
|
gtk_entry_get_inner_border
|
||||||
gtk_entry_get_invisible_char
|
gtk_entry_get_invisible_char
|
||||||
gtk_entry_get_layout
|
gtk_entry_get_layout
|
||||||
|
|||||||
202
gtk/gtkentry.c
202
gtk/gtkentry.c
@ -216,6 +216,10 @@ enum {
|
|||||||
PROP_ACTIVATABLE_SECONDARY,
|
PROP_ACTIVATABLE_SECONDARY,
|
||||||
PROP_SENSITIVE_PRIMARY,
|
PROP_SENSITIVE_PRIMARY,
|
||||||
PROP_SENSITIVE_SECONDARY,
|
PROP_SENSITIVE_SECONDARY,
|
||||||
|
PROP_TOOLTIP_TEXT_PRIMARY,
|
||||||
|
PROP_TOOLTIP_TEXT_SECONDARY,
|
||||||
|
PROP_TOOLTIP_MARKUP_PRIMARY,
|
||||||
|
PROP_TOOLTIP_MARKUP_SECONDARY,
|
||||||
PROP_IM_MODULE
|
PROP_IM_MODULE
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1086,6 +1090,78 @@ gtk_entry_class_init (GtkEntryClass *class)
|
|||||||
TRUE,
|
TRUE,
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkEntry:primary-icon-tooltip-text:
|
||||||
|
*
|
||||||
|
* The contents of the tooltip on the primary icon.
|
||||||
|
*
|
||||||
|
* Also see gtk_entry_set_icon_tooltip_text().
|
||||||
|
*
|
||||||
|
* Since: 2.16
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_TOOLTIP_TEXT_PRIMARY,
|
||||||
|
g_param_spec_string ("primary-icon-tooltip-text",
|
||||||
|
P_("Primary icon tooltip text"),
|
||||||
|
P_("The contents of the tooltip on the primary icon"),
|
||||||
|
NULL,
|
||||||
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkEntry:secondary-icon-tooltip-text:
|
||||||
|
*
|
||||||
|
* The contents of the tooltip on the secondary icon.
|
||||||
|
*
|
||||||
|
* Also see gtk_entry_set_icon_tooltip_text().
|
||||||
|
*
|
||||||
|
* Since: 2.16
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_TOOLTIP_TEXT_SECONDARY,
|
||||||
|
g_param_spec_string ("secondary-icon-tooltip-text",
|
||||||
|
P_("Secondary icon tooltip text"),
|
||||||
|
P_("The contents of the tooltip on the secondary icon"),
|
||||||
|
NULL,
|
||||||
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkEntry:primary-icon-tooltip-markup:
|
||||||
|
*
|
||||||
|
* The contents of the tooltip on the primary icon, which is marked up
|
||||||
|
* with the <link linkend="PangoMarkupFormat">Pango text markup
|
||||||
|
* language</link>.
|
||||||
|
*
|
||||||
|
* Also see gtk_entry_set_icon_tooltip_markup().
|
||||||
|
*
|
||||||
|
* Since: 2.16
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_TOOLTIP_MARKUP_PRIMARY,
|
||||||
|
g_param_spec_string ("primary-icon-tooltip-markup",
|
||||||
|
P_("Primary icon tooltip markup"),
|
||||||
|
P_("The contents of the tooltip on the primary icon"),
|
||||||
|
NULL,
|
||||||
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkEntry:secondary-icon-tooltip-markup:
|
||||||
|
*
|
||||||
|
* The contents of the tooltip on the secondary icon, which is marked up
|
||||||
|
* with the <link linkend="PangoMarkupFormat">Pango text markup
|
||||||
|
* language</link>.
|
||||||
|
*
|
||||||
|
* Also see gtk_entry_set_icon_tooltip_markup().
|
||||||
|
*
|
||||||
|
* Since: 2.16
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_TOOLTIP_MARKUP_SECONDARY,
|
||||||
|
g_param_spec_string ("secondary-icon-tooltip-markup",
|
||||||
|
P_("Secondary icon tooltip markup"),
|
||||||
|
P_("The contents of the tooltip on the secondary icon"),
|
||||||
|
NULL,
|
||||||
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkEntry:im-module:
|
* GtkEntry:im-module:
|
||||||
*
|
*
|
||||||
@ -1806,6 +1882,30 @@ gtk_entry_set_property (GObject *object,
|
|||||||
g_value_get_boolean (value));
|
g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_TOOLTIP_TEXT_PRIMARY:
|
||||||
|
gtk_entry_set_icon_tooltip_text (entry,
|
||||||
|
GTK_ENTRY_ICON_PRIMARY,
|
||||||
|
g_value_get_string (value));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_TOOLTIP_TEXT_SECONDARY:
|
||||||
|
gtk_entry_set_icon_tooltip_text (entry,
|
||||||
|
GTK_ENTRY_ICON_SECONDARY,
|
||||||
|
g_value_get_string (value));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_TOOLTIP_MARKUP_PRIMARY:
|
||||||
|
gtk_entry_set_icon_tooltip_markup (entry,
|
||||||
|
GTK_ENTRY_ICON_PRIMARY,
|
||||||
|
g_value_get_string (value));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_TOOLTIP_MARKUP_SECONDARY:
|
||||||
|
gtk_entry_set_icon_tooltip_markup (entry,
|
||||||
|
GTK_ENTRY_ICON_SECONDARY,
|
||||||
|
g_value_get_string (value));
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_IM_MODULE:
|
case PROP_IM_MODULE:
|
||||||
g_free (priv->im_module);
|
g_free (priv->im_module);
|
||||||
priv->im_module = g_strdup (g_value_get_string (value));
|
priv->im_module = g_strdup (g_value_get_string (value));
|
||||||
@ -2000,6 +2100,26 @@ gtk_entry_get_property (GObject *object,
|
|||||||
gtk_entry_get_icon_sensitive (entry, GTK_ENTRY_ICON_SECONDARY));
|
gtk_entry_get_icon_sensitive (entry, GTK_ENTRY_ICON_SECONDARY));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_TOOLTIP_TEXT_PRIMARY:
|
||||||
|
g_value_take_string (value,
|
||||||
|
gtk_entry_get_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_TOOLTIP_TEXT_SECONDARY:
|
||||||
|
g_value_take_string (value,
|
||||||
|
gtk_entry_get_icon_tooltip_text (entry, GTK_ENTRY_ICON_SECONDARY));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_TOOLTIP_MARKUP_PRIMARY:
|
||||||
|
g_value_take_string (value,
|
||||||
|
gtk_entry_get_icon_tooltip_markup (entry, GTK_ENTRY_ICON_PRIMARY));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_TOOLTIP_MARKUP_SECONDARY:
|
||||||
|
g_value_take_string (value,
|
||||||
|
gtk_entry_get_icon_tooltip_markup (entry, GTK_ENTRY_ICON_SECONDARY));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -7744,6 +7864,43 @@ ensure_has_tooltip (GtkEntry *entry)
|
|||||||
gtk_widget_set_has_tooltip (GTK_WIDGET (entry), has_tooltip);
|
gtk_widget_set_has_tooltip (GTK_WIDGET (entry), has_tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_entry_get_icon_tooltip_text:
|
||||||
|
* @entry: a #GtkEntry
|
||||||
|
* @icon_pos: the icon position
|
||||||
|
*
|
||||||
|
* Gets the contents of the tooltip on the icon at the specified
|
||||||
|
* position in @entry.
|
||||||
|
*
|
||||||
|
* Returns: the tooltip text, or %NULL. Free the returned string
|
||||||
|
* with g_free() when done.
|
||||||
|
*
|
||||||
|
* Since: 2.16
|
||||||
|
*/
|
||||||
|
gchar *
|
||||||
|
gtk_entry_get_icon_tooltip_text (GtkEntry *entry,
|
||||||
|
GtkEntryIconPosition icon_pos)
|
||||||
|
{
|
||||||
|
GtkEntryPrivate *priv;
|
||||||
|
EntryIconInfo *icon_info;
|
||||||
|
gchar *text = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
|
||||||
|
g_return_val_if_fail (IS_VALID_ICON_POSITION (icon_pos), NULL);
|
||||||
|
|
||||||
|
priv = GTK_ENTRY_GET_PRIVATE (entry);
|
||||||
|
icon_info = priv->icons[icon_pos];
|
||||||
|
|
||||||
|
if (!icon_info)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (icon_info->tooltip &&
|
||||||
|
!pango_parse_markup (icon_info->tooltip, -1, 0, NULL, &text, NULL, NULL))
|
||||||
|
g_assert (NULL == text); /* text should still be NULL in case of markup errors */
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_entry_set_icon_tooltip_text:
|
* gtk_entry_set_icon_tooltip_text:
|
||||||
* @entry: a #GtkEntry
|
* @entry: a #GtkEntry
|
||||||
@ -7779,11 +7936,50 @@ gtk_entry_set_icon_tooltip_text (GtkEntry *entry,
|
|||||||
if (icon_info->tooltip)
|
if (icon_info->tooltip)
|
||||||
g_free (icon_info->tooltip);
|
g_free (icon_info->tooltip);
|
||||||
|
|
||||||
|
/* Treat an empty string as a NULL string,
|
||||||
|
* because an empty string would be useless for a tooltip:
|
||||||
|
*/
|
||||||
|
if (tooltip && tooltip[0] == '\0')
|
||||||
|
tooltip = NULL;
|
||||||
|
|
||||||
icon_info->tooltip = tooltip ? g_markup_escape_text (tooltip, -1) : NULL;
|
icon_info->tooltip = tooltip ? g_markup_escape_text (tooltip, -1) : NULL;
|
||||||
|
|
||||||
ensure_has_tooltip (entry);
|
ensure_has_tooltip (entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_entry_get_icon_tooltip_markup:
|
||||||
|
* @entry: a #GtkEntry
|
||||||
|
* @icon_pos: the icon position
|
||||||
|
*
|
||||||
|
* Gets the contents of the tooltip on the icon at the specified
|
||||||
|
* position in @entry.
|
||||||
|
*
|
||||||
|
* Returns: the tooltip text, or %NULL. Free the returned string
|
||||||
|
* with g_free() when done.
|
||||||
|
*
|
||||||
|
* Since: 2.16
|
||||||
|
*/
|
||||||
|
gchar *
|
||||||
|
gtk_entry_get_icon_tooltip_markup (GtkEntry *entry,
|
||||||
|
GtkEntryIconPosition icon_pos)
|
||||||
|
{
|
||||||
|
GtkEntryPrivate *priv;
|
||||||
|
EntryIconInfo *icon_info;
|
||||||
|
gchar *text = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
|
||||||
|
g_return_val_if_fail (IS_VALID_ICON_POSITION (icon_pos), NULL);
|
||||||
|
|
||||||
|
priv = GTK_ENTRY_GET_PRIVATE (entry);
|
||||||
|
icon_info = priv->icons[icon_pos];
|
||||||
|
|
||||||
|
if (!icon_info)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return g_strdup (icon_info->tooltip);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_entry_set_icon_tooltip_markup:
|
* gtk_entry_set_icon_tooltip_markup:
|
||||||
* @entry: a #GtkEntry
|
* @entry: a #GtkEntry
|
||||||
@ -7820,6 +8016,12 @@ gtk_entry_set_icon_tooltip_markup (GtkEntry *entry,
|
|||||||
if (icon_info->tooltip)
|
if (icon_info->tooltip)
|
||||||
g_free (icon_info->tooltip);
|
g_free (icon_info->tooltip);
|
||||||
|
|
||||||
|
/* Treat an empty string as a NULL string,
|
||||||
|
* because an empty string would be useless for a tooltip:
|
||||||
|
*/
|
||||||
|
if (tooltip && tooltip[0] == '\0')
|
||||||
|
tooltip = NULL;
|
||||||
|
|
||||||
icon_info->tooltip = g_strdup (tooltip);
|
icon_info->tooltip = g_strdup (tooltip);
|
||||||
|
|
||||||
ensure_has_tooltip (entry);
|
ensure_has_tooltip (entry);
|
||||||
|
|||||||
@ -275,9 +275,13 @@ gint gtk_entry_get_icon_at_pos (GtkEntry *
|
|||||||
void gtk_entry_set_icon_tooltip_text (GtkEntry *entry,
|
void gtk_entry_set_icon_tooltip_text (GtkEntry *entry,
|
||||||
GtkEntryIconPosition icon_pos,
|
GtkEntryIconPosition icon_pos,
|
||||||
const gchar *tooltip);
|
const gchar *tooltip);
|
||||||
|
gchar * gtk_entry_get_icon_tooltip_text (GtkEntry *entry,
|
||||||
|
GtkEntryIconPosition icon_pos);
|
||||||
void gtk_entry_set_icon_tooltip_markup (GtkEntry *entry,
|
void gtk_entry_set_icon_tooltip_markup (GtkEntry *entry,
|
||||||
GtkEntryIconPosition icon_pos,
|
GtkEntryIconPosition icon_pos,
|
||||||
const gchar *tooltip);
|
const gchar *tooltip);
|
||||||
|
gchar * gtk_entry_get_icon_tooltip_markup (GtkEntry *entry,
|
||||||
|
GtkEntryIconPosition icon_pos);
|
||||||
void gtk_entry_set_icon_drag_source (GtkEntry *entry,
|
void gtk_entry_set_icon_drag_source (GtkEntry *entry,
|
||||||
GtkEntryIconPosition icon_pos,
|
GtkEntryIconPosition icon_pos,
|
||||||
GtkTargetList *target_list,
|
GtkTargetList *target_list,
|
||||||
|
|||||||
Reference in New Issue
Block a user