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

« back to all changes in this revision

Viewing changes to musicPlayer/src/applet-init.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:
44
44
#include "applet-amarok2.h" //Support Amarok 2
45
45
#include "applet-audacious.h" //Support Audacious
46
46
#include "applet-clementine.h" // Support Clementine
 
47
#include "applet-mpris2.h" // Support Clementine
47
48
 
48
49
CD_APPLET_DEFINE_BEGIN (N_("musicPlayer"),
49
50
        2,0,0,
64
65
 
65
66
//\___________ Here is where you initiate your applet. myConfig is already set at this point, and also myIcon, myContainer, myDock, myDesklet (and myDrawContext if you're in dock mode). The macro CD_APPLET_MY_CONF_FILE and CD_APPLET_MY_KEY_FILE can give you access to the applet's conf-file and its corresponding key-file (also available during reload). If you're in desklet mode, myDrawContext is still NULL, and myIcon's buffers has not been filled, because you may not need them then (idem when reloading).
66
67
CD_APPLET_INIT_BEGIN
 
68
        myData.bForceCoverNeedsTest = FALSE;
67
69
        // Add here all player's registering functions
68
70
        // Don't forget to add the registered Name in ../data/musicPlayer.conf.in
69
 
        cd_musicplayer_register_xmms_handler ();
 
71
        //cd_musicplayer_register_xmms_handler ();
70
72
        cd_musicplayer_register_exaile_handler();
71
73
        cd_musicplayer_register_exaile3_handler();
72
74
        cd_musicplayer_register_songbird_handler();
81
83
        cd_musicplayer_register_guayadeque_handler();
82
84
        cd_musicplayer_register_clementine_handler();
83
85
        cd_musicplayer_register_gmusicbrowser_handler();
 
86
        cd_musicplayer_register_mpris2_handler();
84
87
        
85
88
        gchar *cCoverPath = g_strdup_printf ("%s/musicplayer", g_cCairoDockDataDir);
86
89
        if (! g_file_test (cCoverPath, G_FILE_TEST_EXISTS))
96
99
                CD_APPLET_SET_DESKLET_RENDERER ("Simple");
97
100
        }
98
101
        else if (myIcon->cName == NULL || *myIcon->cName == '\0')
99
 
                CD_APPLET_SET_NAME_FOR_MY_ICON (myConfig.cMusicPlayer);
 
102
        {
 
103
                CD_APPLET_SET_NAME_FOR_MY_ICON (cd_musicplayer_get_string_with_first_char_to_upper (myConfig.cMusicPlayer));
 
104
        }
100
105
        
101
106
        
102
107
        //\_______________ on charge le theme 3D si necessaire.
111
116
        myData.iPreviousTrackNumber = -1;
112
117
        myData.iPreviousCurrentTime = -1;
113
118
        
114
 
        myData.pCurrentHandeler = cd_musicplayer_get_handler_by_name (myConfig.cMusicPlayer);
115
 
        if (myData.pCurrentHandeler == NULL) {
116
 
                cd_warning ("MP : this player (%s) is not supported.", myConfig.cMusicPlayer); 
117
 
                return; 
118
 
        }
119
 
        
120
 
        cd_musicplayer_launch_handler ();  // connexion au bus, detection de l'appli, recuperation de l'etat du lecteur si il est en marche, sinon dessin de l'icone "eteint".
121
 
        
122
 
        //\_______________ On prend en charge l'icone de l'appli player.
123
 
        if (myConfig.bStealTaskBarIcon)
124
 
                CD_APPLET_MANAGE_APPLICATION (myData.pCurrentHandeler->appclass);
 
119
        cd_musicplayer_set_current_handler (myConfig.cMusicPlayer);
125
120
        
126
121
        //\_______________ On s'abonne aux notifications.
127
122
        CD_APPLET_REGISTER_FOR_CLICK_EVENT;
132
127
        if (CD_APPLET_MY_CONTAINER_IS_OPENGL && myConfig.bOpenglThemes)
133
128
        {
134
129
                CD_APPLET_REGISTER_FOR_UPDATE_ICON_SLOW_EVENT;  // pour les animation de transitions.
135
 
                if (myDesklet)  // On ne teste le survol des boutons que si l'applet est détachée
 
130
                if (myDesklet)  // On ne teste le survol des boutons que si l'applet est detachee
136
131
                {
137
132
                        cairo_dock_register_notification_on_object (myContainer,
138
133
                                NOTIFICATION_MOUSE_MOVED,
156
151
                (CairoDockNotificationFunc) cd_opengl_test_mouse_over_buttons,
157
152
                myApplet);
158
153
        
 
154
        // stop the current handler.
 
155
        cd_musicplayer_stop_current_handler (TRUE);
 
156
        
159
157
        // On stoppe les boucles de recup de la pochette.
160
158
        if (myData.iSidCheckXmlFile != 0)
161
159
                g_source_remove (myData.iSidCheckXmlFile);
171
169
 
172
170
//\___________ The reload occurs in 2 occasions : when the user changes the applet's config, and when the user reload the cairo-dock's config or modify the desklet's size. The macro CD_APPLET_MY_CONFIG_CHANGED can tell you this. myConfig has already been reloaded at this point if you're in the first case, myData is untouched. You also have the macro CD_APPLET_MY_CONTAINER_TYPE_CHANGED that can tell you if you switched from dock/desklet to desklet/dock mode.
173
171
CD_APPLET_RELOAD_BEGIN
174
 
        if (myDock && (myIcon->cName == NULL || *myIcon->cName == '\0'))
175
 
                CD_APPLET_SET_NAME_FOR_MY_ICON (myConfig.cMusicPlayer);
176
 
        
177
172
        //\_______________ On reset surfaces et textures.
178
173
        int i;
179
174
        for (i = 0; i < PLAYER_NB_STATUS; i ++) { // reset surfaces.
240
235
        myData.iGetTimeFailed = 0;
241
236
        
242
237
        //\_______________ On gere le changement de player ou on redessine juste l'icone.
243
 
        if (CD_APPLET_MY_CONFIG_CHANGED) {
 
238
        if (CD_APPLET_MY_CONFIG_CHANGED)
 
239
        {
244
240
                // on stoppe l'ancien backend et on relance le nouveau.
245
 
                if (myData.pCurrentHandeler)
246
 
                {
247
 
                        cd_musicplayer_stop_handler ();  // libere tout ce qu'occupe notre ancien handler.
248
 
                        CD_APPLET_MANAGE_APPLICATION (NULL);
249
 
                }
250
 
                myData.pCurrentHandeler = cd_musicplayer_get_handler_by_name (myConfig.cMusicPlayer);
251
 
                if (myData.pCurrentHandeler == NULL)
252
 
                {
253
 
                        cd_warning ("MP : this player (%s) is not supported.", myConfig.cMusicPlayer); 
254
 
                        return FALSE; 
255
 
                }
256
 
                cd_musicplayer_launch_handler ();
 
241
                cd_musicplayer_stop_current_handler (TRUE);  // libere tout ce qu'occupe notre ancien handler.
 
242
 
 
243
                myData.bForceCoverNeedsTest = FALSE;
 
244
 
 
245
                CD_APPLET_MANAGE_APPLICATION (NULL);
257
246
                
258
 
                if (myConfig.bStealTaskBarIcon)
259
 
                        CD_APPLET_MANAGE_APPLICATION (myData.pCurrentHandeler->appclass);
 
247
                cd_musicplayer_set_current_handler (myConfig.cMusicPlayer);
260
248
        }
261
 
        else { // on redessine juste l'icone.
 
249
        else  // on redessine juste l'icone.
 
250
        {
262
251
                cd_musicplayer_update_icon (FALSE);  // FALSE pour ne pas avoir 2 fois le dialogue.
263
252
                if (! myData.cover_exist)
264
253
                {
265
 
                        if(myData.iPlayingStatus == PLAYER_PLAYING)
 
254
                        if (myData.iPlayingStatus == PLAYER_PLAYING)
266
255
                        {
267
256
                                cd_musicplayer_set_surface (PLAYER_PLAYING);
268
257
                        }