Skip to content

Commit

Permalink
feat(gui): display network ID (#780)
Browse files Browse the repository at this point in the history
  • Loading branch information
thesloppyguy authored Oct 26, 2023
1 parent 741492c commit 3b95660
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 8 deletions.
46 changes: 38 additions & 8 deletions cmd/gtk/assets/ui/widget_node.ui
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
Expand All @@ -118,7 +118,7 @@
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
Expand All @@ -133,7 +133,7 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
Expand All @@ -147,7 +147,7 @@
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
Expand All @@ -162,7 +162,7 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
Expand All @@ -176,7 +176,7 @@
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">4</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
Expand All @@ -191,7 +191,7 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">5</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
Expand All @@ -204,7 +204,7 @@
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">5</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
Expand Down Expand Up @@ -237,6 +237,36 @@
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="label" translatable="yes">Network ID:</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="id_label_network_id">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
</child>
<child type="label">
Expand Down
2 changes: 2 additions & 0 deletions cmd/gtk/widget_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ func buildWidgetNode(model *nodeModel) (*widgetNode, error) {
box := getBoxObj(builder, "id_box_node")
labelLocation := getLabelObj(builder, "id_label_working_directory")
labelNetwork := getLabelObj(builder, "id_label_network")
labelNetworkID := getLabelObj(builder, "id_label_network_id")

cwd, err := os.Getwd()
if err != nil {
return nil, err
}
labelLocation.SetText(cwd)
labelNetwork.SetText(model.node.State().Genesis().ChainType().String())
labelNetworkID.SetText(model.node.Network().SelfID().String())

w := &widgetNode{
Box: box,
Expand Down
4 changes: 4 additions & 0 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,7 @@ func (n *Node) State() state.Facade {
func (n *Node) GRPC() *grpc.Server {
return n.grpc
}

func (n *Node) Network() network.Network {
return n.network
}

0 comments on commit 3b95660

Please sign in to comment.