[libdazzle] suggestion-entry-buffer: add clear helper
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] suggestion-entry-buffer: add clear helper
- Date: Thu, 9 Aug 2018 20:10:31 +0000 (UTC)
commit 898d8c1cf91abbd9f1b21f0c6e1f382dea6f98d1
Author: Christian Hergert <chergert redhat com>
Date: Thu Aug 9 12:10:18 2018 -0700
suggestion-entry-buffer: add clear helper
This can be used by the DzlSuggestionEntry to ensure that we clean the
suggestion state so that it doesn't show up upon next focus.
src/suggestions/dzl-suggestion-entry-buffer.c | 13 +++++++++++++
src/suggestions/dzl-suggestion-entry-buffer.h | 2 ++
2 files changed, 15 insertions(+)
---
diff --git a/src/suggestions/dzl-suggestion-entry-buffer.c b/src/suggestions/dzl-suggestion-entry-buffer.c
index 2f21ddd..3a56911 100644
--- a/src/suggestions/dzl-suggestion-entry-buffer.c
+++ b/src/suggestions/dzl-suggestion-entry-buffer.c
@@ -409,3 +409,16 @@ dzl_suggestion_entry_buffer_commit (DzlSuggestionEntryBuffer *self)
g_utf8_strlen (suffix,
-1));
}
}
+
+void
+dzl_suggestion_entry_buffer_clear (DzlSuggestionEntryBuffer *self)
+{
+ DzlSuggestionEntryBufferPrivate *priv = dzl_suggestion_entry_buffer_get_instance_private (self);
+
+ g_return_val_if_fail (DZL_IS_SUGGESTION_ENTRY_BUFFER (self), NULL);
+
+ g_clear_pointer (&priv->text, g_free);
+ g_clear_pointer (&priv->suffix, g_free);
+ g_clear_object (&priv->suggestion);
+ g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_SUGGESTION]);
+}
diff --git a/src/suggestions/dzl-suggestion-entry-buffer.h b/src/suggestions/dzl-suggestion-entry-buffer.h
index 385804c..fd0f40a 100644
--- a/src/suggestions/dzl-suggestion-entry-buffer.h
+++ b/src/suggestions/dzl-suggestion-entry-buffer.h
@@ -55,6 +55,8 @@ DZL_AVAILABLE_IN_ALL
guint dzl_suggestion_entry_buffer_get_typed_length (DzlSuggestionEntryBuffer *self);
DZL_AVAILABLE_IN_ALL
void dzl_suggestion_entry_buffer_commit (DzlSuggestionEntryBuffer *self);
+DZL_AVAILABLE_IN_ALL
+void dzl_suggestion_entry_buffer_clear (DzlSuggestionEntryBuffer *self);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]