mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-08-27 20:09:23 +00:00
Bind available/enabled ui element properties
This commit is contained in:
parent
5aec1b1360
commit
10cd83fbbb
|
@ -72,6 +72,8 @@ public class UIElements<T>
|
|||
button = new Gtk.RadioToolButton(null);
|
||||
}
|
||||
|
||||
e.bind_property("enabled", button, "sensitive", BindingFlags.DEFAULT | BindingFlags.SYNC_CREATE);
|
||||
|
||||
button.set_icon_widget(img);
|
||||
button.set_label(e.display_name);
|
||||
|
||||
|
@ -130,8 +132,6 @@ public class UIElements<T>
|
|||
{
|
||||
set_current_impl(wasavail.element);
|
||||
}
|
||||
|
||||
wasavail.navigation_button.set_sensitive(wasavail.element.enabled);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -223,8 +223,6 @@ public class UIElements<T>
|
|||
|
||||
if (button != null)
|
||||
{
|
||||
button.set_sensitive(e.enabled);
|
||||
|
||||
d_available_sorted.insert_sorted(ae, (a, b) => {
|
||||
return a.element.negotiate_order(b.element);
|
||||
});
|
||||
|
@ -243,6 +241,11 @@ public class UIElements<T>
|
|||
d_available_elements.insert(e.id, ae);
|
||||
}
|
||||
|
||||
private void available_changed(Object o, ParamSpec spec)
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
private void add_ui_element(GitgExt.UIElement e)
|
||||
{
|
||||
d_elements.insert(e.id, e);
|
||||
|
@ -251,11 +254,16 @@ public class UIElements<T>
|
|||
{
|
||||
add_available(e);
|
||||
}
|
||||
|
||||
e.notify["available"].connect(available_changed);
|
||||
}
|
||||
|
||||
private void remove_ui_element(GitgExt.UIElement e)
|
||||
{
|
||||
remove_available(e);
|
||||
|
||||
e.notify["available"].disconnect(available_changed);
|
||||
|
||||
d_elements.remove(e.id);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,10 @@ namespace GitgDiff
|
|||
d_diff.show();
|
||||
|
||||
d_sw.add(d_diff);
|
||||
|
||||
application.notify["current_view"].connect((a, v) => {
|
||||
notify_property("available");
|
||||
});
|
||||
}
|
||||
|
||||
public string id
|
||||
|
|
|
@ -41,6 +41,10 @@ namespace GitgFiles
|
|||
construct
|
||||
{
|
||||
d_model = new TreeStore();
|
||||
|
||||
application.notify["current_view"].connect((a, v) => {
|
||||
notify_property("available");
|
||||
});
|
||||
}
|
||||
|
||||
public string id
|
||||
|
|
|
@ -70,6 +70,10 @@ namespace GitgHistory
|
|||
update_sort_mode();
|
||||
|
||||
application.bind_property("repository", d_model, "repository", BindingFlags.DEFAULT);
|
||||
|
||||
application.notify["repository"].connect((a, r) => {
|
||||
notify_property("available");
|
||||
});
|
||||
}
|
||||
|
||||
private void update_sort_mode()
|
||||
|
|
Loading…
Reference in a new issue