Bug 232578 - No Notification Area icon for non-KDE desktops
Summary: No Notification Area icon for non-KDE desktops
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Notifications (show other bugs)
Version: 2.3.1-GIT
Platform: unspecified Linux
: NOR normal
Target Milestone: 2.3.2
Assignee: Amarok Developers
URL:
Keywords:
: 238854 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-03-29 14:23 UTC by Marius Orcsik
Modified: 2010-07-22 19:05 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.3.2


Attachments
The Amarok icon is absent. (4.19 KB, image/png)
2010-03-29 14:25 UTC, Marius Orcsik
Details
No notification area icon (9.68 KB, image/png)
2010-07-03 17:15 UTC, Elder Marco
Details
Same problem here. (9.68 KB, image/png)
2010-07-03 17:18 UTC, Elder Marco
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marius Orcsik 2010-03-29 14:23:12 UTC
Version:           2.3-GIT (using 4.4.1 (KDE 4.4.1), Arch Linux)
Compiler:          gcc
OS:                Linux (i686) release 2.6.33-ARCH

In Xfce 4.6 the Amarok Icon does not appear in the Notification Area.

The same build doesn't have this problem when logged in to KDE 4.3.
Comment 1 Marius Orcsik 2010-03-29 14:25:14 UTC
Created attachment 42347 [details]
The Amarok icon is absent.
Comment 2 Sven Krohlas 2010-03-29 19:04:40 UTC
Did it work before?
Comment 3 Myriam Schweingruber 2010-06-08 00:00:08 UTC
Is this still valid with current Amarok 2.3.1-git?
Comment 4 Marius Orcsik 2010-06-08 10:36:17 UTC
Yes... same behaviour. 

Amarok
Version 2.3-GIT
Using KDE 4.4.4 (KDE 4.4.4) - which was built yesterday.
Comment 5 Myriam Schweingruber 2010-06-08 11:26:26 UTC
Thank you for your fast feedback.
Comment 6 Marius Orcsik 2010-06-08 11:35:45 UTC
What extra can I provide you guys ?
Comment 7 Rex Dieter 2010-06-13 17:02:40 UTC
Doesn't seem specific to xfce, seeing this with amarok-2.3.1 on gnome too (2.3.0 was fine).

See downstream, 
https://bugzilla.redhat.com/show_bug.cgi?id=603336

and ml thread,
http://mail.kde.org/pipermail/amarok/2010-June/032137.html
Comment 8 Rex Dieter 2010-06-13 19:10:48 UTC
*** Bug 238854 has been marked as a duplicate of this bug. ***
Comment 9 Paul Tsupikoff 2010-06-15 01:39:27 UTC
Confirmed in amarok 2.3.1 using awesome 3.4.5.
2.3.0 was fine too
Comment 10 Myriam Schweingruber 2010-06-15 02:12:10 UTC
(In reply to comment #9)
> Confirmed in amarok 2.3.1 using awesome 3.4.5.

What are these version numbers standing for?
Comment 11 Elder Marco 2010-07-03 17:15:02 UTC
Created attachment 48566 [details]
No notification area icon
Comment 12 Elder Marco 2010-07-03 17:18:43 UTC
Created attachment 48567 [details]
Same problem here.

My System: Fedora 12
Packages: amarok-2.3.1-1.fc12.i686 and amarok-utils-2.3.1-1.fc12.i686
Desktop Environment: GNOME 2.28
Did it work before update?: Yes.
Screenshot: above

Sorry for my English mistakes. I'm learning :-)
Comment 13 Kevin Funk 2010-07-08 12:13:46 UTC
commit 26104cd35fd50222c354f3afc9fce6bba093c05f
Author: Kevin Funk <krf@electrostorm.net>
Date:   Thu Jul 8 12:13:00 2010 +0200

    Some TrayIcon changes:
    * Remove track progress effect (this is because KSNI has some bogus
    implementation of the setIconByPixmap() function causing the overlay
    icon being wrong sized
    * Fix overlay icon size
    * Tooltip album cover is now updated if changed in Amarok
    * Cleanup
    CCBUG: 231539
    CCBUG: 232578
    CCBUG: 232312
    BUG: 233506
    BUG: 240463

diff --git a/src/TrayIcon.cpp b/src/TrayIcon.cpp
index fb97483..4bd46e4 100644
--- a/src/TrayIcon.cpp
+++ b/src/TrayIcon.cpp
@@ -52,7 +52,6 @@
 Amarok::TrayIcon::TrayIcon( QObject *parent )
         : KStatusNotifierItem( parent )
         , Engine::EngineObserver( The::engineController() )
-        , m_trackLength( 0 )
         , m_separator( 0 )
 {
     DEBUG_BLOCK
@@ -80,14 +79,8 @@ Amarok::TrayIcon::TrayIcon( QObject *parent )
 
     PERF_LOG( "Adding system tray icon" );
 
-    m_baseIcon = KIconLoader::global()->loadIcon( "amarok", KIconLoader::Panel );
-    setIconByPixmap( m_baseIcon ); // show icon
-    setOverlayIconByName( QString() );
+    setIconByName( "amarok" );
 
-    m_grayedIcon = m_baseIcon; // copies object
-    KIconEffect::semiTransparent( m_grayedIcon );
-
-    paintIcon();
     setupToolTip();
 
     connect( this, SIGNAL( scrollRequested( int, Qt::Orientation ) ), SLOT( slotScrollRequested(int, Qt::Orientation) ) );
@@ -102,22 +95,13 @@ Amarok::TrayIcon::setupToolTip()
         setToolTipTitle( The::engineController()->prettyNowPlaying() );
 
         QStringList tooltip;
-        // TODO: Use Observer to get notified about changed album art
-        if( m_track->album() )
+        if( m_track->album() && m_track->album()->hasImage() )
         {
             const QString uid = m_track->uidUrl();
             if ( uid != m_toolTipIconUid ) {
                 const QPixmap image = The::svgHandler()->imageWithBorder( m_track->album(), KIconLoader::SizeLarge, 5 );
-                if ( image.isNull() )
-                {
-                    setToolTipIconByName( "amarok" );
-                    m_toolTipIconUid.clear();
-                }
-                else
-                {
-                    setToolTipIconByPixmap( image );
-                    m_toolTipIconUid = uid;
-                }
+                setToolTipIconByPixmap( image );
+                m_toolTipIconUid = uid;
             }
         }
         else
@@ -184,9 +168,10 @@ Amarok::TrayIcon::setupToolTip()
     else
     {
         setToolTipIconByName( "amarok" );
-        m_toolTipIconUid.clear();
         setToolTipTitle( KCmdLineArgs::aboutData()->programName() );
         setToolTipSubTitle( The::engineController()->prettyNowPlaying() );
+
+        m_toolTipIconUid.clear();
     }
 }
 
@@ -206,20 +191,26 @@ Amarok::TrayIcon::engineStateChanged( Phonon::State state, Phonon::State /*oldSt
     switch( state )
     {
         case Phonon::PlayingState:
-            unsubscribeFrom( m_track );
+            if ( m_track )
+            {
+                unsubscribeFrom( m_track );
+                unsubscribeFrom( m_track->album() );
+            }
             m_track = track;
-            m_trackLength = m_track ? m_track->length() : 0;
-            subscribeTo( track );
+            if ( track )
+            {
+                subscribeTo( track );
+                subscribeTo( track->album() );
+            }
 
-            paintIcon( 0 );
+            setOverlayIconByName( "media-playback-start" );
             setupMenu();
             break;
 
         case Phonon::StoppedState:
             m_track = 0;
-            m_trackLength = 0;
 
-            paintIcon();
+            setOverlayIconByName( QString() );
             setupMenu(); // remove custom track actions on stop
             break;
 
@@ -230,6 +221,7 @@ Amarok::TrayIcon::engineStateChanged( Phonon::State state, Phonon::State /*oldSt
         case Phonon::LoadingState:
         case Phonon::ErrorState:
         case Phonon::BufferingState:
+            setOverlayIconByName( QString() );
             break;
     }
 
@@ -240,9 +232,6 @@ void
 Amarok::TrayIcon::engineNewTrackPlaying()
 {
     m_track = The::engineController()->currentTrack();
-    m_trackLength = m_track ? m_track->length() : 0;
-
-    paintIcon( 0 );
 
     setupToolTip();
     setupMenu();
@@ -258,12 +247,12 @@ Amarok::TrayIcon::metadataChanged( Meta::TrackPtr track )
 }
 
 void
-Amarok::TrayIcon::engineTrackPositionChanged( qint64 position, bool userSeek )
+Amarok::TrayIcon::metadataChanged( Meta::AlbumPtr album )
 {
-    Q_UNUSED( userSeek );
+    Q_UNUSED( album )
 
-    if( m_trackLength )
-        paintIcon( position );
+    setupToolTip();
+    setupMenu();
 }
 
 void
@@ -283,55 +272,6 @@ Amarok::TrayIcon::engineMuteStateChanged( bool mute )
 }
 
 void
-Amarok::TrayIcon::paletteChange( const QPalette & op )
-{
-    Q_UNUSED( op );
-
-    paintIcon();
-}
-
-void
-Amarok::TrayIcon::paintIcon( qint64 trackPosition )
-{
-    static qint64 oldMergePos = -1;
-
-    // trackPosition < 0 means reset
-    if( trackPosition < 0 )
-    {
-        oldMergePos = -1;
-        setIconByPixmap( m_baseIcon );
-        setOverlayIconByName( QString() );
-        return;
-    }
-
-    // check if we are playing a stream
-    if( !m_trackLength )
-    {
-        m_icon = m_baseIcon;
-        setIconByPixmap( m_icon );
-        setOverlayIconByName( "media-playback-start" );
-        return;
-    }
-
-    const qint64 mergePos = ( float( trackPosition ) / m_trackLength ) * m_icon.height();
-
-    // return if pixmap would stay the same
-    if( oldMergePos == mergePos )
-        return;
-
-    // draw m_baseIcon on top of the gray version
-    m_icon = m_grayedIcon; // copies object
-    QPainter p( &m_icon );
-    p.drawPixmap( 0, 0, m_baseIcon, 0, 0, 0, m_icon.height() - mergePos );
-    p.end();
-
-    oldMergePos = mergePos;
-
-    setIconByPixmap( m_icon );
-    setOverlayIconByName( "media-playback-start" );
-}
-
-void
 Amarok::TrayIcon::setupMenu()
 {
     foreach( QAction* action, m_extraActions )
diff --git a/src/TrayIcon.h b/src/TrayIcon.h
index c2602df..d590b5f 100644
--- a/src/TrayIcon.h
+++ b/src/TrayIcon.h
@@ -49,16 +49,13 @@ protected:
     // reimplemented from engineobserver
     virtual void engineStateChanged( Phonon::State state, Phonon::State oldState = Phonon::StoppedState );
     virtual void engineNewTrackPlaying();
-    virtual void engineTrackPositionChanged( qint64 position, bool /*userSeek*/ );
     virtual void engineVolumeChanged( int percent );
     virtual void engineMuteStateChanged( bool mute );
 
-    //Reimplemented from Meta::Observer
+    // reimplemented from Meta::Observer
     using Observer::metadataChanged;
     virtual void metadataChanged( Meta::TrackPtr track );
-
-    // get notified of 'highlight' color change
-    virtual void paletteChange( const QPalette & oldPalette );
+    virtual void metadataChanged( Meta::AlbumPtr album );
 
 private slots:
     void slotActivated();
@@ -68,13 +65,9 @@ private:
     void setupMenu();
     void setupToolTip();
 
-    void paintIcon( qint64 trackPosition = -1 );
-
     Meta::TrackPtr m_track;
-    qint64 m_trackLength;
     QString m_toolTipIconUid;
 
-    QPixmap m_baseIcon, m_grayedIcon, m_icon;
     SmartPointerList<QAction> m_extraActions;
     QPointer<QAction> m_separator;
 };
Comment 14 Kevin Funk 2010-07-08 12:14:19 UTC
Please test ^
Comment 15 Myriam Schweingruber 2010-07-08 13:12:49 UTC
Please, non-KDE users, could you test with the latest Amarok 2.3.1-git if this is fixed?
Comment 16 Marius Orcsik 2010-07-08 13:41:21 UTC
On Archlinux with Xfce 4.6 - It works.

Thank you very much Kevin.
Comment 17 Myriam Schweingruber 2010-07-08 14:03:20 UTC
Thank you for the feedback :)
Comment 18 Rex Dieter 2010-07-09 21:58:42 UTC
Patches for this (against amarok-2.3.1) are temporarily available from,
http://krf.kollide.net/files/work/amarok/

kudos to Kevin Funk for providing these too.
Comment 19 Stefan Grosse 2010-07-09 23:39:47 UTC
Works on Fedora 13 with Gnome. Thanks Kevin for the fix and Rex for the quick packaging!
Comment 20 Curtis Walker 2010-07-13 13:13:08 UTC
Solved for me using git build (13th July) on Arch linux x64, Gnome 2.30.2.

Thanks!
Comment 21 Jorge Manuel B. S. Vicetto 2010-07-22 14:27:08 UTC
We got a report in Gentoo that this patch breaks the display of the track progress in the tray icon - https://bugs.gentoo.org/show_bug.cgi?id=325371#c8
Any comments / fixes?
Comment 22 Kevin Funk 2010-07-22 19:05:58 UTC
See ChangeLog:
    * Removed track progress effect on TrayIcon as it caused several problems
      (also caused by a bogus implementation of the KSNI class)
      (BR 233506, BR 240463, BR 231539, BR 232578, BR 232312).

Sorry, but the upstream systray icon implementation is causing troubles. It's hard, if not impossible, to workaround.