Good day everyone.

Attached to this message are two patches I made today.

First is about fixing closing/reordering of stacking old-school popup
notifications. Rationale: I prefer to use big 'notification_timeout', so
popups are stacking up and when I close one which is not the bottom one I
expect it close (not the bottom one) and not to have empty space in place
of popup I am closing. That was old buggy behavior. Now we save index for
each popup window and close popups based on that. Also we re-index popups
while reordering them on screen.

Second is about adding new configuration option
'show_popup_for_all_unread'. Rationale: I prefer to receive popup
notifications even after I opened the chat window after receiving the
first message. That is because I use tiling window manager and no panel
and don't have systray, so some chat window can be open on desktop 5 while
I am working on e.g. desktop 2 and I will not know that I received new
message in that chat.

I should also say that this is my first ever attempt to contribute to
known open source project, so if I made mistakes I apologize and ready to
fix them.

FYI: I based my fixes on current hg master branch and used `hg diff -c
[revision]` to produce .diff files. If merging from forked repository is
preferable I can create one on bitbucket for example. Also I suppose new
configuration option may have more appropriate name. Any suggestions will
be appreciated. If there are style errors I am ready to fix them too.

Thank you for your work on Gajim.

Aleksey Rybalkin
diff -r 850ec7c1a0bf -r 25f442d46a69 src/
--- a/src/    Mon Apr 23 21:03:54 2012 +0400
+++ b/src/    Mon Apr 23 21:22:20 2012 +0400
@@ -2748,6 +2748,7 @@
         self.account = account
         self.jid = jid
         self.msg_type = msg_type
+        self.index = len(gajim.interface.roster.popup_notification_windows)
         xml = gtkgui_helpers.get_gtk_builder('popup_notification_window.ui')
         self.window = xml.get_object('popup_notification_window')
@@ -2832,12 +2833,15 @@
         if len(gajim.interface.roster.popup_notification_windows) > 0:
-            # we want to remove the first window added in the list
-            gajim.interface.roster.popup_notification_windows.pop(0)
+            # we want to remove the destroyed window from the list
+            gajim.interface.roster.popup_notification_windows.pop(self.index)
         # move the rest of popup windows
         gajim.interface.roster.popups_notification_height = 0
+        current_index = 0
         for window_instance in 
+            window_instance.index = current_index
+            current_index += 1
             window_width, window_height = window_instance.window.get_size()
             gajim.interface.roster.popups_notification_height += window_height
             window_instance.window.move(gtk.gdk.screen_width() - window_width,
diff -r 9170d378fbd2 -r 850ec7c1a0bf src/common/
--- a/src/common/      Sun Apr 22 21:48:36 2012 +0400
+++ b/src/common/      Mon Apr 23 21:03:54 2012 +0400
@@ -72,6 +72,7 @@
             'notify_on_signin': [ opt_bool, True ],
             'notify_on_signout': [ opt_bool, False ],
             'notify_on_new_message': [ opt_bool, True ],
+            'show_popup_for_all_unread' : [ opt_bool, False, _('Show popup 
notification not only for first message, but for all next messages') ],
             'autopopupaway': [ opt_bool, False ],
             'sounddnd': [ opt_bool, False, _('Play sound when user is busy')],
             'use_notif_daemon': [ opt_bool, True, _('Use D-Bus and 
Notification-Daemon to show notifications') ],
diff -r 9170d378fbd2 -r 850ec7c1a0bf src/common/
--- a/src/common/  Sun Apr 22 21:48:36 2012 +0400
+++ b/src/common/  Mon Apr 23 21:03:54 2012 +0400
@@ -2128,7 +2128,8 @@
         self.popup_image = gtkgui_helpers.get_icon_path(self.popup_image, 48)
         if not gajim.config.get('notify_on_new_message') or \
-        not self.first_unread:
+        (not gajim.config.get('show_popup_for_all_unread') and \
+        not self.first_unread):
             self.do_popup = False
         elif gajim.config.get('autopopupaway'):
             # always show notification
Gajim-devel mailing list

Reply via email to