Fix toast notifications by adding AdwToastOverlay

This commit is contained in:
vesp 2026-01-05 11:14:31 +01:00
parent 29ae77e8ec
commit 1c124939b6
3 changed files with 10 additions and 6 deletions

View File

@ -1,5 +1,5 @@
project('roster', project('roster',
version: '0.4.0', version: '0.4.1',
meson_version: '>= 1.0.0', meson_version: '>= 1.0.0',
default_options: [ 'warning_level=2', 'werror=false', ], default_options: [ 'warning_level=2', 'werror=false', ],
) )

View File

@ -7,6 +7,8 @@
<property name="default-width">1200</property> <property name="default-width">1200</property>
<property name="default-height">800</property> <property name="default-height">800</property>
<property name="content"> <property name="content">
<object class="AdwToastOverlay" id="toast_overlay">
<property name="child">
<object class="GtkPaned" id="main_pane"> <object class="GtkPaned" id="main_pane">
<property name="orientation">horizontal</property> <property name="orientation">horizontal</property>
<property name="position">180</property> <property name="position">180</property>
@ -210,6 +212,8 @@
</property> </property>
</object> </object>
</property> </property>
</object>
</property>
</template> </template>
<menu id="primary_menu"> <menu id="primary_menu">

View File

@ -39,6 +39,9 @@ import uuid
class RosterWindow(Adw.ApplicationWindow): class RosterWindow(Adw.ApplicationWindow):
__gtype_name__ = 'RosterWindow' __gtype_name__ = 'RosterWindow'
# Toast overlay
toast_overlay = Gtk.Template.Child()
# Top bar widgets # Top bar widgets
save_request_button = Gtk.Template.Child() save_request_button = Gtk.Template.Child()
new_request_button = Gtk.Template.Child() new_request_button = Gtk.Template.Child()
@ -750,10 +753,7 @@ class RosterWindow(Adw.ApplicationWindow):
toast = Adw.Toast() toast = Adw.Toast()
toast.set_title(message) toast.set_title(message)
toast.set_timeout(3) toast.set_timeout(3)
self.toast_overlay.add_toast(toast)
# Get the toast overlay (we need to add one)
# For now, just print to console
print(f"Toast: {message}")
# Project Management Methods # Project Management Methods