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

« back to all changes in this revision

Viewing changes to alsaMixer/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:
26
26
#include "applet-mixer.h"
27
27
#include "applet-draw.h"
28
28
 
 
29
static void _load_mute_surface (void);
 
30
 
29
31
 
30
32
int mixer_element_update_with_event (snd_mixer_elem_t *elem, unsigned int mask)
31
33
{
62
64
                break;
63
65
        }
64
66
        
65
 
        cairo_surface_t *pSurface = (myData.bIsMute ? myData.pMuteSurface : myData.pSurface);
 
67
        
 
68
        cairo_surface_t *pSurface = NULL;
 
69
        if (myConfig.iVolumeEffect != VOLUME_EFFECT_GAUGE)
 
70
        {
 
71
                if (myData.bIsMute)
 
72
                {
 
73
                        if (myData.pMuteSurface == NULL)
 
74
                                _load_mute_surface ();
 
75
                        pSurface = myData.pMuteSurface;
 
76
                }
 
77
                else
 
78
                {
 
79
                        pSurface = myData.pSurface;
 
80
                }
 
81
        }
66
82
        
67
83
        switch (myConfig.iVolumeEffect)
68
84
        {
86
102
                        bNeedRedraw = FALSE;
87
103
                break;
88
104
                
 
105
                case VOLUME_EFFECT_GAUGE :
 
106
                {
 
107
                        double fPercent;
 
108
                        if (myData.bIsMute)
 
109
                                fPercent = CAIRO_DATA_RENDERER_UNDEF_VALUE;
 
110
                        else
 
111
                                fPercent = (double) myData.iCurrentVolume / 100.;
 
112
                        CD_APPLET_RENDER_NEW_DATA_ON_MY_ICON (&fPercent);
 
113
                        bNeedRedraw = FALSE;
 
114
                }
 
115
                break;
 
116
                
89
117
                default :
90
118
                break;
91
119
        }
99
127
        }
100
128
        
101
129
        CD_APPLET_LEAVE(0);
102
 
        //return 0;
103
130
}
104
131
 
105
132
 
119
146
{
120
147
        CD_APPLET_SET_SURFACE_ON_MY_ICON_WITH_BAR (pSurface, myData.iCurrentVolume * .01);
121
148
}
 
149
 
 
150
 
 
151
void mixer_load_surfaces (void)
 
152
{
 
153
        if (myData.pSurface != NULL)
 
154
        {
 
155
                cairo_surface_destroy (myData.pSurface);
 
156
                myData.pSurface = NULL;
 
157
        }
 
158
        
 
159
        if (myConfig.cDefaultIcon != NULL)
 
160
        {
 
161
                gchar *cImagePath = cairo_dock_search_icon_s_path (myConfig.cDefaultIcon);
 
162
                if (cImagePath == NULL)
 
163
                        cImagePath = cairo_dock_search_image_s_path (myConfig.cDefaultIcon);
 
164
                if (cImagePath != NULL)
 
165
                {
 
166
                        myData.pSurface = CD_APPLET_LOAD_SURFACE_FOR_MY_APPLET (cImagePath);
 
167
                        g_free (cImagePath);
 
168
                }
 
169
        }
 
170
        
 
171
        if (myData.pSurface == NULL)
 
172
        {
 
173
                myData.pSurface = CD_APPLET_LOAD_SURFACE_FOR_MY_APPLET (MY_APPLET_SHARE_DATA_DIR"/default.svg");
 
174
        }
 
175
        
 
176
        if (myData.pMuteSurface != NULL)
 
177
        {
 
178
                cairo_surface_destroy (myData.pMuteSurface);
 
179
                myData.pMuteSurface = NULL;
 
180
        }  // don't load the mute surface now, as we often won't even need it in the session. we'll load it on demand.
 
181
}
 
182
 
 
183
static void _load_mute_surface (void)
 
184
{
 
185
        if (myConfig.cMuteIcon != NULL)
 
186
        {
 
187
                gchar *cImagePath = cairo_dock_search_icon_s_path (myConfig.cMuteIcon);
 
188
                if (cImagePath == NULL)
 
189
                        cImagePath = cairo_dock_search_image_s_path (myConfig.cMuteIcon);
 
190
                if (cImagePath != NULL)
 
191
                {
 
192
                        myData.pMuteSurface = CD_APPLET_LOAD_SURFACE_FOR_MY_APPLET (cImagePath);
 
193
                        g_free (cImagePath);
 
194
                }
 
195
        }
 
196
        
 
197
        if (myData.pMuteSurface == NULL)
 
198
        {
 
199
                myData.pMuteSurface = CD_APPLET_LOAD_SURFACE_FOR_MY_APPLET (MY_APPLET_SHARE_DATA_DIR"/mute.svg");
 
200
        }
 
201
}