Update the UI when the switcher pane changes
This commit is contained in:
parent
1f4ef0ab95
commit
1b121e0a8e
2 changed files with 28 additions and 3 deletions
|
|
@ -15,6 +15,18 @@ public class Components.Inspector : Gtk.Window {
|
|||
[GtkChild]
|
||||
private Gtk.HeaderBar header_bar;
|
||||
|
||||
[GtkChild]
|
||||
private Gtk.Stack stack;
|
||||
|
||||
[GtkChild]
|
||||
private Gtk.Button copy_button;
|
||||
|
||||
[GtkChild]
|
||||
private Gtk.Widget logs_pane;
|
||||
|
||||
[GtkChild]
|
||||
private Gtk.Button search_button;
|
||||
|
||||
[GtkChild]
|
||||
private Hdy.SearchBar search_bar;
|
||||
|
||||
|
|
@ -69,6 +81,18 @@ public class Components.Inspector : Gtk.Window {
|
|||
this.details = details.str;
|
||||
}
|
||||
|
||||
private void update_ui() {
|
||||
bool logs_visible = this.stack.visible_child == this.logs_pane;
|
||||
uint logs_selected = this.logs_view.get_selection().count_selected_rows();
|
||||
this.copy_button.set_sensitive(!logs_visible || logs_selected > 0);
|
||||
this.search_button.set_visible(logs_visible);
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
private void on_visible_child_changed() {
|
||||
update_ui();
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
private void on_copy_clicked() {
|
||||
get_clipboard(Gdk.SELECTION_CLIPBOARD).set_text(this.details, -1);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
<property name="can_focus">False</property>
|
||||
<property name="show_close_button">True</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<object class="GtkButton" id="search_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<object class="GtkButton" id="copy_button">
|
||||
<property name="label" translatable="yes">Copy to Clipboard</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
|
|
@ -71,8 +71,9 @@
|
|||
<object class="GtkStack" id="stack">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<signal name="notify::visible-child" handler="on_visible_child_changed" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<object class="GtkGrid" id="logs_pane">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue