Use system notifications
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
LinuxDC++ |
Fix Released
|
Wishlist
|
Steven Sheehy |
Bug Description
It would be really useful to have linuxdcpp trigger a system notification when each of the requested downloads has finished, like other p2p programs (e.g. transmission) do.
Razzloss (razzloss) wrote : | #1 |
Changed in linuxdcpp: | |
importance: | Undecided → Wishlist |
status: | New → Confirmed |
David Prieto (frandavid100-gmail) wrote : | #2 |
I don't really know that, hope someone can answer.
Razzloss (razzloss) wrote : | #3 |
Yeah, that was mostly to Steven. DBUS isn't directly linked to, but I was wondering if the minimum GTK version (or another library) already requires it, but apparently not. So this would add new dependency.
--RZ
Steven Sheehy (steven-sheehy) wrote : | #4 |
It would require libnotify which would in turn return require libdbus. I don't really want to add another library dependency for such a minor feature. This would be suitable for a plugin though (once a plugin system is implemented).
tags: | added: plugin |
Jakh Daven (tuxcanfly) wrote : | #5 |
- Screenshot-4.png Edit (216.3 KiB, image/png)
Hi, I added notification support with libnotify to stable version 1.0.3. This is my first contribution to LinuxDC++, so I was eager to branch it out and missed out on the dependency concerns.
Anyway its available at http://
Hope to contribute more. Thanks!
Razzloss (razzloss) wrote : | #6 |
OK, I don't have too strong objections for adding a libnotify as a dependency. As our plugin interface is still a far away I'm willing to accept something like this to the main program. (+ there were some rumours that dc++ might get a plugin interface also, and it would be better if ours were at least somewhat compatible.)
But there's some problems why the current code can't be accepted:
1) You should make your changes to the current bzr trunk, not the latest released version. Also the changes should be so, that it is possible to see what has changed. Either submitting patches or clone the main trunk, make the changes to it and publish the changed branch in launchpad.
2) No GUI/GTK code should be but to client/ (released version) or dcpp/ (current trunk) directories. The dcpp/ directory should come from the upstream (DC++) with as little changes as possible. And any changes made to dcpp/ should also be submitted and accepted in the DC++ also. So the changes you made should be moved to linux/
3) The notify settings should be configurable. Simple on/off for different type of notifications should be enough. And at least notification for private message should be added instead of just the download finished.
But if these points are corrected and Steven agrees, I think the notification support can be added to the main program. (Maybe converted to a plugin later, when/if the plugin system is implemented)
But feel free to grab the latest source and start hacking, and fixing bugs ;D. There's some developer info on the old berlios page http://
--RZ
Steven Sheehy (steven-sheehy) wrote : | #7 |
I concur with my esteemed colleague, Dr. Razzloss.
Jakh Daven (tuxcanfly) wrote : Re: [Bug 406302] Re: Use system notifications | #8 |
Thanks Razzloss and Steven, I will correct the problems and submit a patch
ASAP. It would be great to see this implemented in next version.
On Fri, Oct 2, 2009 at 5:03 AM, Steven Sheehy <email address hidden>wrote:
> I concur with my esteemed colleague, Dr. Razzloss.
>
> --
> Use system notifications
> https:/
> You received this bug notification because you are subscribed to
> LinuxDC++.
>
> Status in Linux DC++: Confirmed
>
> Bug description:
> It would be really useful to have linuxdcpp trigger a system notification
> when each of the requested downloads has finished, like other p2p programs
> (e.g. transmission) do.
>
Jakh Daven (tuxcanfly) wrote : | #9 |
- notify.patch Edit (4.6 KiB, text/plain)
Hi all,
I'm pleased to announce that I have finally got it working! :phew:
It was great learning experience and greater fun for me. I can see why open source is so popular. :)
So here's whats working:
* Download notifications
* Private Message notifications (only when off focus)
* Both notifications are user configurable, can be enabled/disabled instantly
I would be only too happy to correct any mistakes/
Thanks to Razzloss and Steven for pointing me in the right direction
Razzloss (razzloss) wrote : | #10 |
OK,
Few comments:
1) Do we really need a new class with just one static method? IMO notification showing could as well be put to MainWindow as a member function.
2) In Notification::show the icon path must not be hardcoded. Icon path should be derived from WulforManager:
--RZ
Steven Sheehy (steven-sheehy) wrote : | #11 |
- There is a memory leak. You need to free NotifyNotification after use (g_object_free).
- Don't call gtk_init multiple times, it has already been invoked in wulfor.cc.
- As Razzloss said, use icon theme. You should be able to pass just "linuxdcpp" for the icon.
- Use notify_
- I'm not sure whether libnotify should be invoked outside of the GDK locking mechanism. We may need to dispatch the call in MainWindow:
- Notification options should be in appearance tab in preferences.
Steven Sheehy (steven-sheehy) wrote : | #12 |
Sorry, I meant g_object_ unref.
>
Jakh Daven (tuxcanfly) wrote : | #13 |
- notify.patch Edit (4.8 KiB, text/plain)
Hi,
Fixed most of the above issues. :)
** Notification icon is now fetched from the theme
** function call is dispatched to GUI
** Added statusIcon to notification
** Plugged most of the memleaks
** Lots of code clean up
It works a lot better now. Thanks Steven and Razzloss!
to apply this patch is this required ?
* x11-libs/libnotify
Available versions: 0.4.5
Homepage: http://
Description: Notifications library
?
only if thats the case its pretty much gnome dependent am using kde here on gentoo linux and for that little feature it wants all this installing :
UniMatrix0 ~ # emerge -p libnotify
These are the packages that would be merged, in order:
Calculating dependencies ... done!
[ebuild N ] app-text/
[ebuild N ] dev-libs/
[ebuild N ] x11-libs/
[ebuild N ] gnome-base/
[ebuild N ] gnome-base/
[ebuild N ] x11-libs/
[ebuild N ] x11-misc/
Total: 7 packages (7 new), Size of downloads: 8,785 kB
n thats before they compiled so be alot more than 8mb after compiling them bits, i gotta say i really wouldnt want all those dependencies tbh
Jakh Daven (tuxcanfly) wrote : | #17 |
Thats sad. Highlights the need for a desktop manager independent notification library. KDE has KNotify but it would be a bit of an overkill to support it since linuxdc++ is so dependent on gtk+. It would be great if we had something like xdg-open (xdg-notify?) which is desktop manager agnostic.
Steven Sheehy (steven-sheehy) wrote : | #18 |
Do you think we should put an #IFDEF HAVE_LIBNOTIFY (which can be set automatically in SConstruct) around the calls to libnotify until we get a plugin system going? RZ, what are your thoughts?
Sorry for the trouble, but I found some additional issues:
- showNotification should use std::string for title. const char* is not guaranteed to be around after being queued.
- use notify_
- Don't need to queue showNotification from inside other *_gui() functions. So you can just call showNotification() from addPrivateMessa
- Move the call to #include <libnotify/
Razzloss (razzloss) wrote : | #19 |
Steven: My thoughts exactly when I read lys' opinion. I think #IFDEFfing the contents of showNotify, #include and the settingsmanager options should be enough? Defaults still need to be there, and maybe defaulting to 0 (or default based on #IFDEF)? I think this would be neater than #IFDEFing all the calls to showNotification and it's contents (sure adds few unneeded function calls if defaults are 1, but won't affect performance).
With #IFDEFs Gentoo ebuilds can set the use flags correctly which will pull libnotify and its dependencies when needed.
--RZ
Jakh Daven (tuxcanfly) wrote : | #20 |
- notify.patch Edit (4.7 KiB, text/plain)
Hi,
@Steven Fixed the latest issues ;) But
* notify_
isnt working. Notification turns up without any icon.
So I have kept the previous gtk_theme_load_icon as it is.
@Razzloss Yeah #IFDEF'ing would prevent forcing libnotify as a dependency :D
Jakh Daven (tuxcanfly) wrote : | #21 |
Jakh Daven (tuxcanfly) wrote : | #22 |
- notify.patch Edit (4.5 KiB, text/plain)
*Fixed (removed) notifications for match_queue filelists and others. Notifications now only for FLAG_NORMAL queue items.
Steven Sheehy (steven-sheehy) wrote : | #23 |
Committed to trunk. I added the #ifdef HAVE_LIBNOTIFY so that it's only enabled if libnotify is present at the time of compilation. I also removed the pixbuf in favor of using icon name. The reason it wasn't working is because we're not storing the application icon in the icon theme search path visible to other programs (our custom path is only visible to linuxdcpp, not notification-
Thanks for the patch Jakh Daven! If you're looking for possible things to work on next, best place would be to take a look at the open bugs on launchpad. We generally try to put more of a focus on bugs before features, but you're of course free to work on whatever you like. Hope we'll see more from you. :)
Changed in linuxdcpp: | |
assignee: | nobody → Steven Sheehy (steven-sheehy) |
milestone: | none → 1.1.0 |
status: | Confirmed → Fix Committed |
i thought this was fixed to not depend on libnotify if not wanted :
loz@UniMatrix0 ~/linuxdcpp $ scons --help
scons: Reading SConscript files ...
scons: warning: The Options class is deprecated; use the Variables class instead.
File "/home/
scons: warning: The BoolOption() function is deprecated; use the BoolVariable() function instead.
File "/home/
scons: warning: The PathOption() function is deprecated; use the PathVariable() function instead.
File "/home/
Checking for g++ >= 4.1...(cached) yes
Checking for pkg-config... yes
Checking for gtk+-2.0 >= 2.10... yes
Checking for gthread-2.0 >= 2.4... yes
Checking for libglade-2.0 >= 2.4... yes
Checking for libnotify >= 0.4.1... no
libnotify >= 0.4.1 not found, disabling notifications.
Note: You might have the lib but not the headers
Checking for C++ header file boost/version.
Checking for C header file time.h... yes
Checking for C header file signal.h... yes
Checking for C header file unistd.h... yes
Checking for C library pthread... yes
Checking for C library z... yes
Checking for C library bz2... yes
Checking for C library crypto... yes
Checking for C library ssl... yes
Checking for C header file iconv.h... yes
Checking for iconv(0, (const char **)0, 0, (char**)0, 0) in C library iconv... no
Checking for C header file net/if.h... yes
Package libnotify was not found in the pkg-config search path.
Perhaps you should add the directory containing `libnotify.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libnotify' found
OSError: 'pkg-config --libs libnotify' exited 1:
File "/home/
env.
File "/usr/lib/
return function(self, self.backtick(
File "/usr/lib/
raise OSError("'%s' exited %d" % (command, status))
oh and sorry it's : Tree is up to date at revision 333.
Jakh Daven (tuxcanfly) wrote : | #26 |
Well I checked the code and I guess you're right. We are asking for
libnotify includes unconditionally. I don't have the latest trunk so could
you please make the changes given below and re-build and let me know the
output?
Please change line 232, Sconstruct
to look like
if env.has_
Please reply with the output.
Jakh Daven (tuxcanfly) wrote : | #27 |
loz@UniMatrix0 ~/linuxdcpp $ rm -r build/ ; rm linuxdcpp ; scons PREFIX=/usr
rm: cannot remove `build/': No such file or directory
rm: cannot remove `linuxdcpp': No such file or directory
scons: Reading SConscript files ...
scons: warning: The Options class is deprecated; use the Variables class instead.
File "/home/
scons: warning: The BoolOption() function is deprecated; use the BoolVariable() function instead.
File "/home/
scons: warning: The PathOption() function is deprecated; use the PathVariable() function instead.
File "/home/
Checking for g++ >= 4.1...(cached) yes
Checking for pkg-config... yes
Checking for gtk+-2.0 >= 2.10... yes
Checking for gthread-2.0 >= 2.4... yes
Checking for libglade-2.0 >= 2.4... yes
Checking for libnotify >= 0.4.1... no
libnotify >= 0.4.1 not found, disabling notifications.
Note: You might have the lib but not the headers
Checking for C++ header file boost/version.
Checking for C header file time.h... yes
Checking for C header file signal.h... yes
Checking for C header file unistd.h... yes
Checking for C library pthread... yes
Checking for C library z... yes
Checking for C library bz2... yes
Checking for C library crypto... yes
Checking for C library ssl... yes
Checking for C header file iconv.h... yes
Checking for iconv(0, (const char **)0, 0, (char**)0, 0) in C library iconv... no
Checking for C header file net/if.h... yes
scons: done reading SConscript files.
scons: Building targets ...
scons: `.' is up to date.
scons: done building targets.
sorry nm it didnt paste right into the SConstruct file
:
loz@UniMatrix0 ~/linuxdcpp $ patch -p0 < Sconstruct.patch
patching file SConstruct
loz@UniMatrix0 ~/linuxdcpp $ rm -r build/ ; rm linuxdcpp ; time scons PREFIX=/usr
rm: cannot remove `build/': No such file or directory
rm: cannot remove `linuxdcpp': No such file or directory
scons: Reading SConscript files ...
scons: warning: The Options class is deprecated; use the Variables class instead.
File "/home/
scons: warning: The BoolOption() function is deprecated; use the BoolVariable() function instead.
File "/home/
scons: warning: The PathOption() function is deprecated; use the PathVariable() function instead.
File "/home/
Checking for g++ >= 4.1...(cached) yes
Checking for pkg-config... yes
Checking for gtk+-2.0 >= 2.10... yes
Checking for gthread-2.0 >= 2.4... yes
Checking for libglade-2.0 >= 2.4... yes
Checking for libnotify >= 0.4.1... no
libnotify >= 0.4.1 not found, disabling notifications.
Note: You might have the lib but not the headers
Checking for C++ header file boost/version.
Checking for C header file time.h... yes
Checking for C header file signal.h... yes
Checking for C header file unistd.h... yes
Checking for C library pthread... yes
Checking for C library z... yes
Checking for C library bz2... yes
Checking for C library crypto... yes
Checking for C library ssl... yes
Checking for C header file iconv.h... yes
Checking for iconv(0, (const char **)0, 0, (char**)0, 0) in C library iconv... no
Checking for C header file net/if.h... yes
scons: done reading SConscript files.
scons: Building targets ...
shame there's no <code> blah </code> tags in this bug tracker that did it that time, thanks :)
Jakh Daven (tuxcanfly) wrote : | #31 |
Seems it builds fine with the SConstruct fix. Do you think it works OK now?
On Wed, Oct 14, 2009 at 8:41 PM, lys <email address hidden> wrote:
> sorry nm it didnt paste right into the SConstruct file
>
> :
>
> loz@UniMatrix0 ~/linuxdcpp $ patch -p0 < Sconstruct.patch
> patching file SConstruct
> loz@UniMatrix0 ~/linuxdcpp $ rm -r build/ ; rm linuxdcpp ; time scons
> PREFIX=/usr
> rm: cannot remove `build/': No such file or directory
> rm: cannot remove `linuxdcpp': No such file or directory
> scons: Reading SConscript files ...
>
> scons: warning: The Options class is deprecated; use the Variables class
> instead.
> File "/home/
>
> scons: warning: The BoolOption() function is deprecated; use the
> BoolVariable() function instead.
> File "/home/
>
> scons: warning: The PathOption() function is deprecated; use the
> PathVariable() function instead.
> File "/home/
> Checking for g++ >= 4.1...(cached) yes
> Checking for pkg-config... yes
> Checking for gtk+-2.0 >= 2.10... yes
> Checking for gthread-2.0 >= 2.4... yes
> Checking for libglade-2.0 >= 2.4... yes
> Checking for libnotify >= 0.4.1... no
> libnotify >= 0.4.1 not found, disabling notifications.
> Note: You might have the lib but not the headers
> Checking for C++ header file boost/version.
> Checking for C header file time.h... yes
> Checking for C header file signal.h... yes
> Checking for C header file unistd.h... yes
> Checking for C library pthread... yes
> Checking for C library z... yes
> Checking for C library bz2... yes
> Checking for C library crypto... yes
> Checking for C library ssl... yes
> Checking for C header file iconv.h... yes
> Checking for iconv(0, (const char **)0, 0, (char**)0, 0) in C library
> iconv... no
> Checking for C header file net/if.h... yes
> scons: done reading SConscript files.
> scons: Building targets ...
>
> --
> Use system notifications
> https:/
> You received this bug notification because you are subscribed to
> LinuxDC++.
>
> Status in Linux DC++: Fix Committed
>
> Bug description:
> It would be really useful to have linuxdcpp trigger a system notification
> when each of the requested downloads has finished, like other p2p programs
> (e.g. transmission) do.
>
Jakh Daven (tuxcanfly) wrote : | #32 |
Thanks for testing it out lys! Good to know it works for you now :)
On Wed, Oct 14, 2009 at 8:47 PM, lys <email address hidden> wrote:
> shame there's no <code> blah </code> tags in this bug tracker that did
> it that time, thanks :)
>
> --
> Use system notifications
> https:/
> You received this bug notification because you are subscribed to
> LinuxDC++.
>
> Status in Linux DC++: Fix Committed
>
> Bug description:
> It would be really useful to have linuxdcpp trigger a system notification
> when each of the requested downloads has finished, like other p2p programs
> (e.g. transmission) do.
>
Jakh Daven (tuxcanfly) wrote : | #33 |
Yeah, <code> tags would help. Glad it works for you! Thanks for testing it out, lys :)
@Steven Please review the patch
Steven Sheehy (steven-sheehy) wrote : | #34 |
Thanks. Should be fixed in trunk now.
Steven Sheehy (steven-sheehy) wrote : | #35 |
With the latest commit, linuxdcpp icon should now show up in notification. Please test. Note that you have to install the application for the icon to get moved to the icon theme search path. If you are running from your build directory, you can copy linuxdcpp.(svg|png) to ~/.icons/ as a workaround to get it to show up.
cant enable the boxes for notification stuff on Tree is up to date at revision 337. crashes with this msg:
(linuxdcpp:3277): Gtk-CRITICAL **: gtk_box_
Segmentation fault
Steven Sheehy (steven-sheehy) wrote : | #37 |
lys, I thought you were not going to install libnotify because of too many dependencies? If you don't have libnotify the notification boxes shouldn't even show up. Do you mean to say that you did end up installing libnotify to try it and when you try to enable it the program crashes? Can you provide a stacktrace in debug mode?
didnt want it one one pc cause its a minimal desktop i rarely use and its always nice to be given the choice, it actually comes in handy on my main workstation, and by the way i dont know why it was doing that, i deleted the bzr src n grabbed it again and compiled it and it worked, dont know why it wasnt the day i reported this, sorry all's fine now
Changed in linuxdcpp: | |
status: | Fix Committed → Fix Released |
tags: | added: tray ui |
Could be handy. Is DBUS already a direct requirement? (no?)
--RZ