summaryrefslogtreecommitdiff
path: root/new/entry_unix.c
blob: 43caea32a3dbfff0e08f2f4963cce5da87aafecd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// 8 april 2015
#include "uipriv_unix.h"

struct entry {
};

static void onDestroy(GtkWidget *widget, gpointer data)
{
	struct entry *e = (struct entry *) data;

	uiFree(e);
}

uiControl *uiNewEntry(void)
{
	uiControl *c;
	struct entry *e;
	GtkWidget *widget;

	c = uiUnixNewControl(GTK_TYPE_ENTRY,
		FALSE, FALSE,
		NULL);

	widget = GTK_WIDGET(uiControlHandle(c));

	e = uiNew(struct entry);
	g_signal_connect(widget, "destroy", G_CALLBACK(onDestroy), e);
	c->data = e;

	return c;
}

char *uiEntryText(uiControl *c)
{
	return g_strdup(gtk_entry_get_text(GTK_ENTRY(uiControlHandle(c))));
}

void uiEntrySetText(uiControl *c, const char *text)
{
	gtk_entry_set_text(GTK_ENTRY(uiControlHandle(c)), text);
}