mirror of
https://github.com/deavminet/gustav.git
synced 2025-03-11 06:17:35 +00:00
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",
|
||||
"dependencies": {
|
||||
"gtk-d": "~>3.9.0",
|
||||
"libdnet": "~>0.1.12"
|
||||
"libdnet": "~>0.1.13"
|
||||
},
|
||||
"description": "GTK graphical DNET client",
|
||||
"license": "GPL v3",
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
27
source/gui.d
27
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)
|
||||
|
Loading…
Reference in New Issue
Block a user