Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Briar GTK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
briar
Briar GTK
Commits
c770271a
Commit
c770271a
authored
4 years ago
by
Nico
Browse files
Options
Downloads
Patches
Plain Diff
Show notifications in notification bar
Fixes
#28
.
parent
a9c883b4
No related branches found
No related tags found
No related merge requests found
Pipeline
#4841
failed
4 years ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
briar-gtk/briar_gtk/containers/main_window.py
+18
-6
18 additions, 6 deletions
briar-gtk/briar_gtk/containers/main_window.py
briar-gtk/briar_gtk/define.py
+3
-0
3 additions, 0 deletions
briar-gtk/briar_gtk/define.py
briar-gtk/briar_gtk/window.py
+4
-1
4 additions, 1 deletion
briar-gtk/briar_gtk/window.py
with
25 additions
and
7 deletions
briar-gtk/briar_gtk/containers/main_window.py
+
18
−
6
View file @
c770271a
...
...
@@ -6,13 +6,15 @@
# https://gitlab.gnome.org/GNOME/fractal/-/tags/4.2.2
from
gettext
import
gettext
as
_
from
gi.repository
import
GLib
,
Gtk
from
gettext
import
pgettext
as
_t
from
gi.repository
import
Gio
,
GLib
,
Gtk
from
briar_wrapper.models.contacts
import
Contacts
from
briar_gtk.container
import
Container
from
briar_gtk.containers.private_chat
import
PrivateChatContainer
from
briar_gtk.define
import
APP
from
briar_gtk.define
import
APP
,
NOTIFICATION_CONTACT_ADDED
from
briar_gtk.define
import
NOTIFICATION_PRIVATE_MESSAGE
from
briar_gtk.widgets.about_dialog
import
AboutDialogWidget
from
briar_gtk.widgets.contact_row
import
ContactRowWidget
...
...
@@ -259,15 +261,25 @@ class MainWindowContainer(Container):
# pylint: disable=unused-argument
def
_notify_contact_added
(
self
,
message
):
self
.
_notify
()
self
.
_notify
(
_t
(
"
Notification
"
,
"
Contact added
"
),
NOTIFICATION_CONTACT_ADDED
)
# pylint: disable=unused-argument
def
_notify_message_received
(
self
,
message
):
self
.
_notify
()
self
.
_notify
(
_t
(
"
Notification
"
,
"
New private message
"
),
NOTIFICATION_PRIVATE_MESSAGE
)
@staticmethod
def
_notify
():
APP
().
window
.
set_urgency_hint
(
True
)
def
_notify
(
title
,
identifier
):
if
APP
().
window
.
is_active
():
return
notification
=
Gio
.
Notification
.
new
(
title
)
notification
.
set_priority
(
Gio
.
NotificationPriority
.
HIGH
)
APP
().
send_notification
(
identifier
,
notification
)
def
_refresh_contacts
(
self
):
self
.
_save_selected_row
()
...
...
This diff is collapsed.
Click to expand it.
briar-gtk/briar_gtk/define.py
+
3
−
0
View file @
c770271a
...
...
@@ -16,6 +16,9 @@ APPLICATION_NAME = "Briar"
RESOURCES_DIR
=
os
.
path
.
join
(
"
/app
"
,
"
briar
"
,
"
gtk
"
)
APPLICATION_STYLING_PATH
=
"
resource:///app/briar/gtk/application.css
"
NOTIFICATION_CONTACT_ADDED
=
"
briar-gtk-contact-added
"
NOTIFICATION_PRIVATE_MESSAGE
=
"
briar-gtk-private-message
"
APP
=
Gio
.
Application
.
get_default
...
...
This diff is collapsed.
Click to expand it.
briar-gtk/briar_gtk/window.py
+
4
−
1
View file @
c770271a
...
...
@@ -10,6 +10,8 @@ from briar_gtk.containers.add_contact import AddContactContainer
from
briar_gtk.containers.main_window
import
MainWindowContainer
from
briar_gtk.containers.startup
import
StartupContainer
from
briar_gtk.define
import
APP
,
APPLICATION_ID
,
APPLICATION_NAME
from
briar_gtk.define
import
NOTIFICATION_CONTACT_ADDED
from
briar_gtk.define
import
NOTIFICATION_PRIVATE_MESSAGE
class
Window
(
Gtk
.
ApplicationWindow
):
...
...
@@ -73,7 +75,8 @@ class Window(Gtk.ApplicationWindow):
# pylint: disable=unused-argument
def
_on_focus_change
(
self
,
widget
,
event
):
self
.
set_urgency_hint
(
False
)
APP
().
withdraw_notification
(
NOTIFICATION_CONTACT_ADDED
)
APP
().
withdraw_notification
(
NOTIFICATION_PRIVATE_MESSAGE
)
def
_resize_window
(
self
,
size
):
if
not
Window
.
_size_is_valid
(
size
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment