mirror of https://github.com/deavminet/gustav.git
Delete the status property on empty status message in status box
This commit is contained in:
parent
7ec56f1036
commit
ef2a48c684
2
dub.json
2
dub.json
|
@ -5,7 +5,7 @@
|
||||||
"copyright": "Copyright © 2020, Tristan B. Kildaire",
|
"copyright": "Copyright © 2020, Tristan B. Kildaire",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"gtk-d": "~>3.9.0",
|
"gtk-d": "~>3.9.0",
|
||||||
"libdnet": "~>0.1.12"
|
"libdnet": "~>0.1.13"
|
||||||
},
|
},
|
||||||
"description": "GTK graphical DNET client",
|
"description": "GTK graphical DNET client",
|
||||||
"license": "GPL v3",
|
"license": "GPL v3",
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"versions": {
|
"versions": {
|
||||||
"bformat": "1.0.8",
|
"bformat": "1.0.8",
|
||||||
"gtk-d": "3.9.0",
|
"gtk-d": "3.9.0",
|
||||||
"libdnet": "0.1.12",
|
"libdnet": "0.1.13",
|
||||||
"tristanable": "0.1.1"
|
"tristanable": "0.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
27
source/gui.d
27
source/gui.d
|
@ -187,6 +187,9 @@ public class GUI : Thread
|
||||||
import gtk.Entry;
|
import gtk.Entry;
|
||||||
Entry d = new Entry();
|
Entry d = new Entry();
|
||||||
d.addOnActivate(&setStatusMessage);
|
d.addOnActivate(&setStatusMessage);
|
||||||
|
d.setPlaceholderText("I'm currently...");
|
||||||
|
// d.addOnLea
|
||||||
|
// d.addOnEnte
|
||||||
import gtk.ToolItem;
|
import gtk.ToolItem;
|
||||||
ToolItem k = new ToolItem();
|
ToolItem k = new ToolItem();
|
||||||
k.add(d);
|
k.add(d);
|
||||||
|
@ -197,14 +200,36 @@ public class GUI : Thread
|
||||||
}
|
}
|
||||||
|
|
||||||
import gtk.Entry;
|
import gtk.Entry;
|
||||||
|
import std.string;
|
||||||
private void setStatusMessage(Entry f)
|
private void setStatusMessage(Entry f)
|
||||||
{
|
{
|
||||||
/* Get the current connection */
|
/* Get the current connection */
|
||||||
Connection currentConnection = connections[notebook.getCurrentPage()];
|
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.)
|
//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)
|
private void about(MenuItem)
|
||||||
|
|
Loading…
Reference in New Issue