aboutsummaryrefslogtreecommitdiff
path: root/src/gtk-util-routines.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-03-03 14:46:07 +0100
committerThomas White <taw@physics.org>2021-03-03 14:46:07 +0100
commit3861fe8e45e0c4e167e4e301863dd2074961115b (patch)
tree219cb7076ff0af144c6339450cab2c97c5da2437 /src/gtk-util-routines.c
parent1512e2a654cd2a0edc20e174a26704ca8bd173fa (diff)
Add get_text_or_null
Diffstat (limited to 'src/gtk-util-routines.c')
-rw-r--r--src/gtk-util-routines.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gtk-util-routines.c b/src/gtk-util-routines.c
index a5e04457..83ed066f 100644
--- a/src/gtk-util-routines.c
+++ b/src/gtk-util-routines.c
@@ -118,3 +118,11 @@ void redraw_widget(GtkWidget *wid)
h = gtk_widget_get_allocated_height(GTK_WIDGET(wid));
gtk_widget_queue_draw_area(GTK_WIDGET(wid), 0, 0, w, h);
}
+
+
+const char *get_text_or_null(GtkEntry *entry)
+{
+ const char *text = gtk_entry_get_text(entry);
+ if ( text[0] == '\0' ) return NULL;
+ return text;
+}