update ui file

This commit is contained in:
Nikolay Brovko 2020-01-28 03:32:36 +03:00
parent 8faac1c8f3
commit 9512c02bff
No known key found for this signature in database
GPG Key ID: 32258A3DEC9B6F07
4 changed files with 184 additions and 125 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/yggtk/yggtk">
<file preprocess="xml-stripblanks">ui/main.ui</file>
<file preprocess="xml-stripblanks">ui/app-window.ui</file>
</gresource>
</gresources>

173
data/ui/app-window.ui Normal file
View File

@ -0,0 +1,173 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<template class="YggtkAppWindow" parent="GtkApplicationWindow">
<property name="width_request">600</property>
<property name="height_request">450</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Yggtk</property>
<property name="window_position">center</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<child type="center">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkBox">
<property name="width_request">-1</property>
<property name="height_request">-1</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">75</property>
<property name="margin_right">75</property>
<property name="margin_top">75</property>
<property name="margin_bottom">75</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="yggdrasil_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Yggdrasil</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="service_state_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="state-set" handler="on_service_state_switch_state_set" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="update_yggtk_button">
<property name="label" translatable="yes">Update Yggtk</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="action_name">app.update-yggtk</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="update_yggdrasil_button">
<property name="label" translatable="yes">Update Yggdrasil</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="action_name">app.update-yggdrasil</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="portable_checkbutton">
<property name="label" translatable="yes">Portable</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">center</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkButton" id="browse_peers_button">
<property name="label" translatable="yes">Browse Peers</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="action_name">app.browse-peers</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="save_config_button">
<property name="label" translatable="yes">Save Config</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="peer_ip_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="secondary_icon_tooltip_text" translatable="yes">Peer Address</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</template>
</interface>

View File

@ -1,114 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<template class="YggtkAppWindow" parent="GtkApplicationWindow">
<property name="width_request">600</property>
<property name="height_request">450</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Yggtk</property>
<property name="resizable">False</property>
<property name="window_position">center</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkFixed">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkSwitch" id="service_state_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="state-set" handler="on_service_state_switch_state_set" swapped="no"/>
</object>
<packing>
<property name="x">275</property>
<property name="y">80</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="yggdrasil_label">
<property name="width_request">100</property>
<property name="height_request">80</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Yggdrasil</property>
</object>
<packing>
<property name="x">250</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="ip_entry">
<property name="width_request">200</property>
<property name="height_request">35</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="x">200</property>
<property name="y">400</property>
</packing>
</child>
<child>
<object class="GtkButton" id="browse_button">
<property name="label" translatable="yes">Browse</property>
<property name="width_request">200</property>
<property name="height_request">35</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="x">200</property>
<property name="y">355</property>
</packing>
</child>
<child>
<object class="GtkButton" id="update_yggdrasil_button">
<property name="label" translatable="yes">Update Yggdrasil</property>
<property name="width_request">200</property>
<property name="height_request">35</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="action_name">app.update-yggdrasil</property>
</object>
<packing>
<property name="x">200</property>
<property name="y">280</property>
</packing>
</child>
<child>
<object class="GtkButton" id="update_yggtk_button">
<property name="label" translatable="yes">Update Yggtk</property>
<property name="width_request">200</property>
<property name="height_request">35</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="action_name">app.update-yggtk</property>
</object>
<packing>
<property name="x">200</property>
<property name="y">235</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="portable_checkbutton">
<property name="label" translatable="yes">Portable</property>
<property name="height_request">35</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="x">255</property>
<property name="y">318</property>
</packing>
</child>
</object>
</child>
</template>
</interface>

View File

@ -17,17 +17,17 @@ using Gtk;
namespace Yggtk {
[GtkTemplate (ui = "/org/yggtk/yggtk/ui/main.ui")]
[GtkTemplate (ui = "/org/yggtk/yggtk/ui/app-window.ui")]
public class AppWindow : ApplicationWindow {
[GtkChild]
private Gtk.Switch service_state_switch;
[GtkChild]
private Gtk.Button browse_button;
private Gtk.Button browse_peers_button;
[GtkChild]
private Gtk.Entry ip_entry;
private Gtk.Entry peer_ip_entry;
[GtkCallback]
private bool on_service_state_switch_state_set (bool state) {
@ -43,27 +43,27 @@ namespace Yggtk {
Object(application: application);
ip_entry.notify["text"].connect (() => {
peer_ip_entry.notify["text"].connect (() => {
if (ip_entry.text != "") {
if (peer_ip_entry.text != "") {
browse_button.label = "OK";
browse_peers_button.label = "OK";
} else {
browse_button.label = "Browse";
browse_peers_button.label = "Browse";
}
});
browse_button.clicked.connect (() => {
browse_peers_button.clicked.connect (() => {
if (browse_button.label == "OK") {
if (browse_peers_button.label == "OK") {
string yggconf;
Process.spawn_command_line_sync ("yggdrasil -genconf -json", out yggconf);
parse (yggconf, ip_entry);
parse (yggconf, peer_ip_entry);
} else {