diff --git a/ui_unix.h b/ui_unix.h index dcc2336a..6453ddc9 100644 --- a/ui_unix.h +++ b/ui_unix.h @@ -14,6 +14,9 @@ This file assumes that you have included and "ui.h" beforehand. It p // The firstProperty parameter and beyond allow passing construct properties to the new control, as with g_object_new(); end this list with NULL. _UI_EXTERN void uiUnixNewControl(uiControl *c, GType type, gboolean inScrolledWindow, gboolean scrolledWindowHasBorder, void (*destroy)(void *), void *onDestroyData, const char *firstProperty, ...); +// uiUnixStrdupText() takes the given string and produces a copy of it suitable for being freed by uiFreeText(). +extern char *uiUnixStrdupText(const char *); + struct uiSizingSys { // this structure currently left blank }; diff --git a/unix/button.c b/unix/button.c index 7f528634..545e258f 100644 --- a/unix/button.c +++ b/unix/button.c @@ -32,7 +32,7 @@ static char *buttonText(uiButton *bb) { struct button *b = (struct button *) bb; - return strdupText(gtk_button_get_label(b->button)); + return uiUnixStrdupText(gtk_button_get_label(b->button)); } static void buttonSetText(uiButton *bb, const char *text) diff --git a/unix/checkbox.c b/unix/checkbox.c index 19ba6614..72eadcd9 100644 --- a/unix/checkbox.c +++ b/unix/checkbox.c @@ -35,7 +35,7 @@ static char *checkboxText(uiCheckbox *cc) { struct checkbox *c = (struct checkbox *) cc; - return strdupText(gtk_button_get_label(c->button)); + return uiUnixStrdupText(gtk_button_get_label(c->button)); } static void checkboxSetText(uiCheckbox *cc, const char *text) diff --git a/unix/entry.c b/unix/entry.c index 0675c499..9c22d834 100644 --- a/unix/entry.c +++ b/unix/entry.c @@ -18,7 +18,7 @@ static char *entryText(uiEntry *ee) { struct entry *e = (struct entry *) ee; - return strdupText(gtk_entry_get_text(e->entry)); + return uiUnixStrdupText(gtk_entry_get_text(e->entry)); } static void entrySetText(uiEntry *ee, const char *text) diff --git a/unix/label.c b/unix/label.c index 63805fd3..182b55c3 100644 --- a/unix/label.c +++ b/unix/label.c @@ -18,7 +18,7 @@ static char *labelText(uiLabel *ll) { struct label *l = (struct label *) ll; - return strdupText(gtk_label_get_text(l->label)); + return uiUnixStrdupText(gtk_label_get_text(l->label)); } static void labelSetText(uiLabel *ll, const char *text) diff --git a/unix/text.c b/unix/text.c index 3656228b..5362fa0f 100644 --- a/unix/text.c +++ b/unix/text.c @@ -2,7 +2,7 @@ #include "uipriv_unix.h" // TODO rename to uiUnixStrdupText() -char *strdupText(const char *t) +char *uiUnixStrdupText(const char *t) { return g_strdup(t); } diff --git a/unix/uipriv_unix.h b/unix/uipriv_unix.h index fd75529b..4c746eba 100644 --- a/unix/uipriv_unix.h +++ b/unix/uipriv_unix.h @@ -13,9 +13,6 @@ #define gtkXMargin 12 #define gtkYMargin 12 -// text.c -extern char *strdupText(const char *); - // menu.c extern GtkWidget *makeMenubar(uiWindow *); extern void freeMenubar(GtkWidget *); diff --git a/unix/window.c b/unix/window.c index 1fce3869..a5bc8d2d 100644 --- a/unix/window.c +++ b/unix/window.c @@ -121,7 +121,7 @@ static char *windowTitle(uiWindow *ww) { struct window *w = (struct window *) ww; - return strdupText(gtk_window_get_title(w->window)); + return uiUnixStrdupText(gtk_window_get_title(w->window)); } static void windowSetTitle(uiWindow *ww, const char *title)