Merge branch 'search_entry_placeholder' into 'main'

gtksearchentry: Add getter/setter for placeholder text

See merge request GNOME/gtk!4312
This commit is contained in:
Matthias Clasen 2023-02-12 22:06:36 +00:00
commit f121f607ae
2 changed files with 42 additions and 0 deletions

View File

@ -832,6 +832,42 @@ gtk_search_entry_get_key_controller (GtkSearchEntry *entry)
return gtk_text_get_key_controller (GTK_TEXT (entry->entry));
}
/**
* gtk_search_entry_get_placeholder_text:
* @entry: a `GtkSearchEntry`
*
* Gets the placeholder text associated with @entry.
*
* Returns: (nullable): The placeholder text.
*
* Since: 4.10
*/
const char *
gtk_search_entry_get_placeholder_text (GtkSearchEntry *entry)
{
g_return_val_if_fail (GTK_IS_SEARCH_ENTRY (entry), NULL);
return gtk_text_get_placeholder_text (GTK_TEXT (entry->entry));
}
/**
* gtk_search_entry_set_placeholder_text:
* @entry: a `GtkSearchEntry`
* @text: (nullable): the text to set as a placeholder
*
* Sets the placeholder text associated with @entry.
*
* Since: 4.10
*/
void
gtk_search_entry_set_placeholder_text (GtkSearchEntry *entry,
const char *text)
{
g_return_if_fail (GTK_IS_SEARCH_ENTRY (entry));
gtk_text_set_placeholder_text (GTK_TEXT (entry->entry), text);
}
GtkText *
gtk_search_entry_get_text_widget (GtkSearchEntry *entry)
{

View File

@ -60,6 +60,12 @@ void gtk_search_entry_set_search_delay (GtkSearchEntry *entry,
GDK_AVAILABLE_IN_4_8
guint gtk_search_entry_get_search_delay (GtkSearchEntry *entry);
GDK_AVAILABLE_IN_4_10
void gtk_search_entry_set_placeholder_text (GtkSearchEntry *entry,
const char *text);
GDK_AVAILABLE_IN_4_10
const char * gtk_search_entry_get_placeholder_text (GtkSearchEntry *entry);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSearchEntry, g_object_unref)
G_END_DECLS