mirror of
https://github.com/ErikReider/SwayNotificationCenter.git
synced 2024-09-17 19:17:29 +03:00
Fixed notifications list not scrolling when changing focus
This commit is contained in:
parent
3069f7120d
commit
237310c627
@ -19,6 +19,16 @@
|
||||
<property name="can-focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="notifications_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="transition-type">crossfade</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolled_window">
|
||||
<property name="visible">True</property>
|
||||
@ -31,10 +41,24 @@
|
||||
<property name="vexpand">True</property>
|
||||
<property name="shadow-type">none</property>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<object class="GtkListBox" id="list_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="transition-type">crossfade</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="selection-mode">none</property>
|
||||
<property name="activate-on-single-click">False</property>
|
||||
<style>
|
||||
<class name="control-center-list"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">notifications-list</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
@ -78,31 +102,19 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">notifications-placeholder</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBox" id="list_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="selection-mode">none</property>
|
||||
<property name="activate-on-single-click">False</property>
|
||||
<style>
|
||||
<class name="control-center-list"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">notifications-list</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
|
@ -2,6 +2,8 @@ namespace SwayNotificationCenter {
|
||||
[GtkTemplate (ui = "/org/erikreider/sway-notification-center/controlCenter/controlCenter.ui")]
|
||||
public class ControlCenter : Gtk.ApplicationWindow {
|
||||
|
||||
[GtkChild]
|
||||
unowned Gtk.Box notifications_box;
|
||||
[GtkChild]
|
||||
unowned Gtk.ScrolledWindow scrolled_window;
|
||||
[GtkChild]
|
||||
@ -243,11 +245,11 @@ namespace SwayNotificationCenter {
|
||||
if (w.length == 0) w = DEFAULT_WIDGETS;
|
||||
bool has_notification = false;
|
||||
foreach (string key in w) {
|
||||
// Reposition the scrolled_window
|
||||
// Reposition the notifications_box
|
||||
if (key == "notifications") {
|
||||
has_notification = true;
|
||||
uint pos = box.get_children ().length ();
|
||||
box.reorder_child (scrolled_window, (int) (pos > 0 ? --pos : 0));
|
||||
box.reorder_child (notifications_box, (int) (pos > 0 ? --pos : 0));
|
||||
continue;
|
||||
}
|
||||
// Add the widget if it is valid
|
||||
@ -261,7 +263,7 @@ namespace SwayNotificationCenter {
|
||||
if (!has_notification) {
|
||||
warning ("Notification widget not included in \"widgets\" config. Using default bottom position");
|
||||
uint pos = box.get_children ().length ();
|
||||
box.reorder_child (scrolled_window, (int) (pos > 0 ? --pos : 0));
|
||||
box.reorder_child (notifications_box, (int) (pos > 0 ? --pos : 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user