Re: [Gajim-devel] two patches

2012-05-06 Thread Yann Leboulanger

On 04/24/2012 12:36 PM, Aleksey Rybalkin wrote:

Thanks for applying the patch. I also discovered we now need to correct
list size checking to prevent popping out-of-bounds index. This small
patch is in attachment. I used `hg export [revision]` this time to
preserve the commit message.


Ok perfect, it's commited.

--
Yann
___
Gajim-devel mailing list
Gajim-devel@gajim.org
http://lists.gajim.org/cgi-bin/listinfo/gajim-devel


Re: [Gajim-devel] two patches

2012-04-24 Thread Aleksey Rybalkin
Hello, Yann.

 Hi Aleksey,

 Thanks for your patches! Let me repli in your mail.

 On 04/23/2012 08:03 PM, Aleksey Rybalkin wrote:
 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.

 Perfect, I'll include that as soon as I'll test it, but it sounds perfect.


Thanks for applying the patch. I also discovered we now need to correct
list size checking to prevent popping out-of-bounds index. This small
patch is in attachment. I used `hg export [revision]` this time to
preserve the commit message.

 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.

 For this one, you can already do that (and much more) with the triggers
 plugin, so I don't think I'll include it ... But don't hesitate to tell
 me if triggers plugin don't fit your needs!


Triggers plugin worked like a charm. Thanks!

 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.

 It's ok to send patch files, no need of a forked repository. You can
 also open tickets with the patch files attached if you want.

 Thanks a lot for your contribution, and don't hesitate if you want to
 help us!

 --
 Yann



-- 
Aleksey Rybalkin
rybalkin.org# HG changeset patch
# User Aleksey Rybalkin alek...@rybalkin.org
# Date 1335262734 -14400
# Node ID f42a6ed4c3933b24c8bbdc5f3466582c2807d8e6
# Parent  15ac0c4acea8959b4d62deda4501c0730005340a
correctly check window list size before removing from it

diff -r 15ac0c4acea8 -r f42a6ed4c393 src/dialogs.py
--- a/src/dialogs.pyMon Apr 23 23:22:12 2012 +0200
+++ b/src/dialogs.pyTue Apr 24 14:18:54 2012 +0400
@@ -2832,7 +2832,7 @@
 gajim.interface.roster.popups_notification_height -= self.window_height
 self.window.destroy()
 
-if len(gajim.interface.roster.popup_notification_windows)  0:
+if len(gajim.interface.roster.popup_notification_windows)  self.index:
 # we want to remove the destroyed window from the list
 gajim.interface.roster.popup_notification_windows.pop(self.index)
 ___
Gajim-devel mailing list
Gajim-devel@gajim.org
http://lists.gajim.org/cgi-bin/listinfo/gajim-devel

[Gajim-devel] two patches

2012-04-23 Thread Aleksey Rybalkin
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
rybalkin.orgdiff -r 850ec7c1a0bf -r 25f442d46a69 src/dialogs.py
--- a/src/dialogs.pyMon Apr 23 21:03:54 2012 +0400
+++ b/src/dialogs.pyMon 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 @@
 self.window.destroy()
 
 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 
gajim.interface.roster.popup_notification_windows:
+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/config.py
--- a/src/common/config.py  Sun Apr 22 21:48:36 2012 +0400
+++ b/src/common/config.py  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/connection_handlers_events.py
--- a/src/common/connection_handlers_events.py  Sun Apr 22 21:48:36 2012 +0400
+++ b/src/common/connection_handlers_events.py  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
Gajim-devel@gajim.org
http://lists.gajim.org/cgi-bin/listinfo/gajim-devel