Fixed notifications list not scrolling when changing focus
This commit is contained in:
@@ -20,89 +20,101 @@
|
||||
<property name="vexpand">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolled_window">
|
||||
<object class="GtkBox" id="notifications_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkViewport" id="viewport">
|
||||
<object class="GtkStack" id="stack">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="shadow-type">none</property>
|
||||
<property name="transition-type">crossfade</property>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<object class="GtkScrolledWindow" id="scrolled_window">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="transition-type">crossfade</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<object class="GtkViewport" id="viewport">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">12</property>
|
||||
<property name="shadow-type">none</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<object class="GtkListBox" id="list_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="pixel-size">96</property>
|
||||
<property name="icon-name">preferences-system-notifications-symbolic</property>
|
||||
<property name="use-fallback">True</property>
|
||||
<property name="icon_size">0</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="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">No Notifications</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<style>
|
||||
<class name="control-center-list-placeholder"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">notifications-list</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="pixel-size">96</property>
|
||||
<property name="icon-name">preferences-system-notifications-symbolic</property>
|
||||
<property name="use-fallback">True</property>
|
||||
<property name="icon_size">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">notifications-placeholder</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBox" id="list_box">
|
||||
<object class="GtkLabel">
|
||||
<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>
|
||||
<property name="label" translatable="yes">No Notifications</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">notifications-list</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<style>
|
||||
<class name="control-center-list-placeholder"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">notifications-placeholder</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>
|
||||
</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));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user