diff --git a/dub.json b/dub.json index 215e082..0c5bb47 100644 --- a/dub.json +++ b/dub.json @@ -5,7 +5,7 @@ "copyright": "Copyright © 2020, Tristan B. Kildaire", "dependencies": { "gtk-d": "~>3.9.0", - "libdnet": "~>0.1.12" + "libdnet": "~>0.1.13" }, "description": "GTK graphical DNET client", "license": "GPL v3", diff --git a/dub.selections.json b/dub.selections.json index 894e956..afc9c35 100644 --- a/dub.selections.json +++ b/dub.selections.json @@ -3,7 +3,7 @@ "versions": { "bformat": "1.0.8", "gtk-d": "3.9.0", - "libdnet": "0.1.12", + "libdnet": "0.1.13", "tristanable": "0.1.1" } } diff --git a/source/gui.d b/source/gui.d index 5755a59..e0944f8 100644 --- a/source/gui.d +++ b/source/gui.d @@ -187,6 +187,9 @@ public class GUI : Thread import gtk.Entry; Entry d = new Entry(); d.addOnActivate(&setStatusMessage); + d.setPlaceholderText("I'm currently..."); + // d.addOnLea + // d.addOnEnte import gtk.ToolItem; ToolItem k = new ToolItem(); k.add(d); @@ -197,14 +200,36 @@ public class GUI : Thread } import gtk.Entry; + import std.string; private void setStatusMessage(Entry f) { /* Get the current connection */ Connection currentConnection = connections[notebook.getCurrentPage()]; - currentConnection.getClient().setProperty("status", f.getBuffer().getText()); + /* Get the input text (removing leading and trailing whitespace) */ + string statusTextInput = f.getBuffer().getText(); + statusTextInput = strip(statusTextInput); + + /* Set the text box to the stripped version */ + //f.getBuffer().setText(statusTextInput, cast(int)statusTextInput.length); + + /* If the status text is empty */ + if(cmp(statusTextInput, "") == 0) + { + /* Delete the status property */ + currentConnection.getClient().deleteProperty("status"); + } + /* If the status text is non empty */ + else + { + /* Set the status */ + currentConnection.getClient().setProperty("status", statusTextInput); + } //f.setInputHints(GtkInputHints.) + + /* Defocus the currently focused widget which would always be me if you are hitting enter */ + mainWindow.setFocus(null); } private void about(MenuItem)