~ubuntu-branches/ubuntu/oneiric/cairo-dock-plug-ins/oneiric-updates

« back to all changes in this revision

Viewing changes to musicPlayer/src/applet-draw.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe), Matthieu Baerts (matttbe), Iain Lane
  • Date: 2011-10-09 00:19:16 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20111009001916-9czstskx2t6l0b3x
Tags: 2.4.0~2-0ubuntu1
[ Matthieu Baerts (matttbe) ]
* New upstream bug fix release. (LP: #859984)
* Upstream (short) ChangeLog (2.4.0~0beta2 -> 2.4.0~1):
 - Powermanager: correctly release the reference on the device object
 - logout: now works if there is no session-manager
 - Status-Notifier: fixed a small bug
    (wrong callback in cairo_dock_stop_watching_dbus_name_owner)
 - Folders: fixed the positionning of the new icon
    and the dialog when dropping a folder inside the dock
    and fixed the icon-rendering
 - Dustbin: use the default theme if no icon is found
 - Impulse: the default context seems to be ok and not an error
 - Status-Notifier: On Ubuntu Oneiric (with indicator-0.4)
    the ApplicationAdded signal has changed and has a new parameter
 - Disable MeMenu on Oneiric (no longer available with indicator-0.4)
 - CMakeLists.txt: Improved output messages
 - Slide view: fixed a small offset in vertical view
 - musicPlayer:
  + split MPRIS 1.0 and 2.0 to help debugging and finding the right
     name of the bug.
  + 'rhythmbox-client' tool is no longer available: used MPRIS
  + Disable Amazon service (it no longer work)
  + Cover: fixed corrupted icons: some players (e.g. the latest version
     of RB) copy covers on their cache forlder but it takes a few time.
  + Fixed the update the icon and its name if the player is stopped.
  + Prevent a crash if the name given by MPRIS is NULL
 - Powermanager: try to prevent to have a few dialogues at the same time
 - PowerManager and AlsaMixer: hidden gnome2 or 3 apps if not available
 - Messaging-Menu: Updated for Natty and Oneiric
    (dbus-menu gives us GVariant instead of GValue objects)
 - Alsamixer: fixed a small bug on reload
 - Dbus: Bash interface: Fixed a typo with emblem positions
 - Sys-monitor: fixed a bug which prevented from getting
    the CPU temperature in some cases
 - Compiz (0.9): type filter: replaced type=utility by type=Utility
 - Updated the version of all applets that have gauges
   in order to use the right directory
 - Wifi: Fixed the status if we are not connected
 - Dbus: removed a conflict with the Help applet
 - Messaging-Menu: updated applet-menu.c => Memory leaks on pixbufs
 - Dbus: Fixed a crash when changing dock theme if a 'third-party' applet
    is running
 - Netspeed: in /proc/net/dev, there are 8 values to drop after the card id
    except if there is whitespaces just after this ':' character
    and fixed order and value for ON_ICON display
 - dock-rendering/toto: removed a useless file
 - Clipper: fixed the loading of the remembered items
    (they had the wrong type) and fixed a bug if we reduce the list of items
 - Folders, dustbin, Network-Monitor: tried to not use cast if it's possible
 - Code cleaned and re-organised a few functions
   (e.g. emblem references has been renamed)
 - Removed useless files: powermanager-dbus*
 - Updating translations
 - Fixed a few warnings at the compilation
 - Removed a few useless output messages
 - Fixed these LP bugs:
  + Empty trash from the trashcan does not delete files
     from usb harddisks: LP: #658681
  + Switcher applet doesn't respect desktop numbers LP: #626782
* Upstream (short) ChangeLog (2.4.0~1 -> 2.4.0~2):
 - Messaging-Menu: fixed a wrong g_object_unref (double free)
    and a small memory leak
 - Folders: fixed a tiny warning at the compilation (32bits)
 - switcher: removed an unnecessary config parameter
 - Folders: file size: used English instead of French translation.
 - Indicator applet: Forced a cast to remove an annoying warning
    due to clumsy dbusmenu_gtkmenu_new() declaration
 - Fixed the detection of the screensaver
 - Fixed tiny warnings at the compilation (with CAIRO_CONTAINER)
* debian/control:
 - Updated the version of cairo-dock-[core;data;dev].
 - Added gvfs as 'Suggests' for cairo-dock-plug-ins-integration
    (Used for managing files)
 - Removed 'libthunar-vfs-1-dev' (libthunar-vfs is no longer installed
    by default since XFCE 4.8 and it is replaced by gvfs)
 - Removed 'indicator-me' (no longer available
    and the installation of Cairo-Dock produces an error)
 - Moved 'indicator-messages' to 'Recommends'
* debian/rules:
 - Updated the name of CMake extras flags
* debian/cairo-dock-plug-ins-data.lintian-overrides:
 - Deleted (now useless)
* debian/cairo-dock-plug-ins.lintian-overrides:
 - Cairo-Dock Plug-Ins are not linked to gldi
 - shlib-without-versioned-soname: forwarded to upstream.
* debian/cairo-dock-plug-ins-integration.lintian-overrides:
 - Cairo-Dock Plug-Ins are not linked to gldi
 - ldconfig and shlibs are not needed
* debian/cairo-dock-plug-ins.install:
 - Fixed lintian errors: package-installs-python-bytecode
* debian/control: Fixed lintian warnings:
 - python-script-but-no-python-dep
 - description-synopsis-starts-with-article
* debian/changelog:
 - Fixed lintian warning: old-fsf-address-in-copyright-file
* debian/patches/01-switcher-force-compact-view.patch: 
 - Forced the compact view because the other doesn't work

[ Iain Lane ]
* Fix Mono/CLI build to be ~policy compliant and use correct compiler

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 */
38
38
gboolean cd_musicplayer_draw_icon (gpointer data)
39
39
{
40
 
        g_return_val_if_fail (myData.pCurrentHandeler->iLevel != PLAYER_EXCELLENT, FALSE);
 
40
        g_return_val_if_fail (myData.pCurrentHandler->iLevel != PLAYER_EXCELLENT, FALSE);
41
41
        //cd_debug ("MP - %s (%d : %d -> %d)\n", __func__, myData.iPlayingStatus, myData.iPreviousCurrentTime, myData.iCurrentTime);
42
42
        
43
43
        CD_APPLET_ENTER;
66
66
                        CD_APPLET_SET_QUICK_INFO_ON_MY_ICON (NULL);
67
67
                        if (myData.iCurrentTime < 0)  // a priori cela signifie qu'une erreur est survenue la derniere fois qu'on a voulu recuperer le temps, donc que le lecteur est ferme.
68
68
                        {
69
 
                                cd_debug ("MP - test of the player ...");
70
 
                                cd_musicplayer_dbus_detect_player ();
71
69
                                cd_debug ("MP -  -> is running : %d\n", myData.bIsRunning);
72
70
                                if (myData.bIsRunning)
73
71
                                        cd_musicplayer_set_surface (PLAYER_STOPPED);
78
76
                bNeedRedraw = TRUE;
79
77
        }
80
78
        
81
 
        if (myData.pCurrentHandeler->iLevel == PLAYER_BAD)
 
79
        if (myData.pCurrentHandler->iLevel == PLAYER_BAD)
82
80
        {
83
81
                if (myData.iPlayingStatus != myData.pPreviousPlayingStatus)  // changement de l'etat du lecteur.
84
82
                {
109
107
        if (bNeedRedraw)
110
108
                CD_APPLET_REDRAW_MY_ICON;
111
109
        
112
 
        CD_APPLET_LEAVE (myData.pCurrentHandeler->iLevel == PLAYER_BAD || (myData.pCurrentHandeler->iLevel == PLAYER_GOOD && myData.iPlayingStatus == PLAYER_PLAYING));
113
 
        //return (myData.pCurrentHandeler->iLevel == PLAYER_BAD || (myData.pCurrentHandeler->iLevel == PLAYER_GOOD && myData.iPlayingStatus == PLAYER_PLAYING));
 
110
        CD_APPLET_LEAVE (myData.pCurrentHandler->iLevel == PLAYER_BAD || (myData.pCurrentHandler->iLevel == PLAYER_GOOD && myData.iPlayingStatus == PLAYER_PLAYING));
 
111
        //return (myData.pCurrentHandler->iLevel == PLAYER_BAD || (myData.pCurrentHandler->iLevel == PLAYER_GOOD && myData.iPlayingStatus == PLAYER_PLAYING));
114
112
}
115
113
 
116
114
 
119
117
        int iSize = cairo_dock_get_file_size (cFilePath);
120
118
        gboolean bConstantSize = (iSize != 0 && iSize == myData.iCurrentFileSize);
121
119
        myData.iCurrentFileSize = iSize;
 
120
        cd_debug ("MP: file size: %d", iSize);
122
121
        //if (iSize == 0)
123
122
        //      myData.iNbCheckFile ++;
124
123
        return bConstantSize;
129
128
gboolean cd_musiplayer_set_cover_if_present (gboolean bCheckSize)
130
129
{
131
130
        CD_APPLET_ENTER;
132
 
        cd_debug ("MP - %s (%s)\n", __func__, myData.cCoverPath);
 
131
        cd_debug ("MP - %s (%s)", __func__, myData.cCoverPath);
133
132
        if (g_file_test (myData.cCoverPath, G_FILE_TEST_EXISTS))
134
133
        {
135
134
                cd_message ("MP : la couverture '%s' est presente sur le disque", myData.cCoverPath);
136
135
                
137
136
                if (!bCheckSize || cd_musicplayer_check_size_is_constant (myData.cCoverPath))
138
137
                {
139
 
                        cd_message ("MP : sa taille est constante (%d)", myData.iCurrentFileSize);
 
138
                        cd_message ("MP : sa taille est constante (%d, %d)", myData.iCurrentFileSize, bCheckSize);
140
139
                        if (bCheckSize && myData.iCurrentFileSize <= 910 && myData.cMissingCover)  // l'image vide de Amazon fait 910 octets, toutes les autres sont plus grandes.
141
140
                        {
142
141
                                cd_debug ("MP - cette pochette est trop petite, c'est surement une pochette vide, on l'ignore\n");
196
195
static gboolean _cd_musicplayer_check_distant_cover_twice (gpointer data)
197
196
{
198
197
        CD_APPLET_ENTER;
199
 
        myData.pCurrentHandeler->get_cover ();  // on ne recupere que la couverture.
 
198
        myData.pCurrentHandler->get_cover ();  // on ne recupere que la couverture.
200
199
        cd_musicplayer_update_icon (FALSE);
201
200
        myData.iSidGetCoverInfoTwice = 0;
202
201
        CD_APPLET_LEAVE (FALSE);
247
246
                /**else
248
247
                {
249
248
                        cd_musicplayer_set_surface (PLAYER_STOPPED);
250
 
                        CD_APPLET_SET_NAME_FOR_MY_ICON (myData.cTitle ? myData.cTitle : myData.pCurrentHandeler ? myData.pCurrentHandeler->name : myConfig.cDefaultTitle);
 
249
                        CD_APPLET_SET_NAME_FOR_MY_ICON (myData.cTitle ? myData.cTitle : myData.pCurrentHandler ? myData.pCurrentHandler->name : myConfig.cDefaultTitle);
251
250
                }*/
252
251
                
253
252
                //Affichage de la couverture de l'album.
263
262
                }
264
263
                if (myConfig.bEnableCover)
265
264
                {
266
 
                        if (myData.cCoverPath == NULL && bFirstTime && myData.pCurrentHandeler->get_cover != NULL)  // info manquante, cela arrive avec les chansons distantes (bug du lecteur ?) on teste 2 fois de suite a 2 secondes d'intervalle.
 
265
                        if (myData.cCoverPath == NULL && bFirstTime && myData.pCurrentHandler->get_cover != NULL)  // info manquante, cela arrive avec les chansons distantes (bug du lecteur ?) on teste 2 fois de suite a 2 secondes d'intervalle.
267
266
                        {
268
267
                                cd_debug ("MP - on reviendra dans 2s\n");
269
268
                                myData.iSidGetCoverInfoTwice = g_timeout_add_seconds (2, (GSourceFunc) _cd_musicplayer_check_distant_cover_twice, NULL);
270
269
                        }
271
 
                        else if (myData.cCoverPath != NULL && ! myData.cover_exist && myConfig.bEnableCover)  // couverture connue mais pas encore chargee.
 
270
                        else if (myData.cCoverPath != NULL && ! myData.cover_exist)  // couverture connue mais pas encore chargee.
272
271
                        {
273
272
                                if (myData.bCoverNeedsTest)  // il faut lancer le test en boucle.
274
273
                                {
279
278
                                                myData.iSidCheckCover = g_timeout_add_seconds (1, (GSourceFunc) cd_musiplayer_set_cover_if_present, GINT_TO_POINTER (TRUE));  // TRUE <=> tester la taille contante.
280
279
                                        }
281
280
                                }
 
281
                                else if (myData.bForceCoverNeedsTest)
 
282
                                {
 
283
                                        cd_debug ("MP - test cover forced");
 
284
                                        myData.iCurrentFileSize = -1; // force to not use empty file
 
285
                                        myData.iNbCheckFile = 0;
 
286
                                        myData.iSidCheckCover = g_timeout_add (50, (GSourceFunc) cd_musiplayer_set_cover_if_present, GINT_TO_POINTER (TRUE));
 
287
                                }
282
288
                                else  // la couverture est deja disponible, on peut tester tout de suite.
283
289
                                {
 
290
                                        cd_debug ("MP - test cover not forced");
284
291
                                        cd_musiplayer_set_cover_if_present (FALSE);  // FALSE <=> tester seulement l'existence du fichier.
285
292
                                }
286
293
                        }
287
 
                        cd_debug ("MP - cover_exist : %d\n", myData.cover_exist);
 
294
                        cd_debug ("MP - cover_exist : %d", myData.cover_exist);
288
295
                }
289
296
                else
290
297
                {
301
308
                if (myData.bIsRunning)
302
309
                {
303
310
                        cd_musicplayer_set_surface (PLAYER_STOPPED);
304
 
                        CD_APPLET_SET_NAME_FOR_MY_ICON (myData.pCurrentHandeler ? myData.pCurrentHandeler->name : myConfig.cDefaultTitle);
 
311
                        if (myConfig.cDefaultTitle)
 
312
                        {
 
313
                                CD_APPLET_SET_NAME_FOR_MY_ICON (myConfig.cDefaultTitle);
 
314
                        }
 
315
                        else if (strcmp (myData.pCurrentHandler->name, "Mpris2") == 0)
 
316
                        {
 
317
                                CD_APPLET_SET_NAME_FOR_MY_ICON (cd_musicplayer_get_string_with_first_char_to_upper (myData.pCurrentHandler->launch));
 
318
                        }
 
319
                        else
 
320
                        {
 
321
                                CD_APPLET_SET_NAME_FOR_MY_ICON (myData.pCurrentHandler->name);
 
322
                        }
305
323
                }
306
324
                else
307
325
                {
308
326
                        cd_musicplayer_set_surface (PLAYER_NONE);
309
 
                        CD_APPLET_SET_NAME_FOR_MY_ICON (myConfig.cDefaultTitle);
 
327
                        if (myConfig.cDefaultTitle)
 
328
                        {
 
329
                                CD_APPLET_SET_NAME_FOR_MY_ICON (myConfig.cDefaultTitle);
 
330
                        }
 
331
                        else
 
332
                        {
 
333
                                CD_APPLET_SET_NAME_FOR_MY_ICON (myApplet->pModule->pVisitCard->cTitle);
 
334
                        }
310
335
                }
311
336
                CD_APPLET_SET_QUICK_INFO_ON_MY_ICON (NULL);
312
337
        }