~cairo-dock-team/ubuntu/precise/cairo-dock-plug-ins/3.0.0.0rc1

« back to all changes in this revision

Viewing changes to switcher/src/applet-load-icons.c

  • Committer: Package Import Robot
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2011-11-05 21:55:39 UTC
  • mfrom: (1.1.17)
  • Revision ID: package-import@ubuntu.com-20111105215539-aq8kg3tqwlmjarkl
Tags: 2.4.0~2.1-0ubuntu1
* New upstream bug fix release. (LP: #886676)
* Upstream ChangeLog:
 - Desklet-rendering - viewport: fixed a crash when the desklet is empty
 - Status-Notifier: patch to work around strange bugs
    in the Ubuntu's indicator-application
 - Switcher: fixed a crash in expanded+desklet mode, a wrong loading
    of the icons and a small drawing bug with the non-compact view.
 - GMenu: look for *-applications.menu file in the xdg path
    (if common file names are not found, e.g. with KDE env in Oneiric)
* debian/patches/01-switcher-force-compact-view.patch:
 - Deleted (now in upstream)
* debian/patches/01-removed-useless-g_print.patch:
 - Removed useless output messages

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "applet-load-icons.h"
26
26
 
27
27
 
 
28
static void _load_desktop_icon (Icon *pIcon)
 
29
{
 
30
        int iWidth = pIcon->iImageWidth;
 
31
        int iHeight = pIcon->iImageHeight;
 
32
        
 
33
        pIcon->pIconBuffer = cairo_dock_duplicate_surface (myData.pDesktopBgMapSurface,
 
34
                myData.iSurfaceWidth, myData.iSurfaceHeight,
 
35
                iWidth, iHeight);
 
36
}
 
37
 
28
38
static GList * _load_icons (void)
29
39
{
30
40
        GList *pIconList = NULL;
52
62
                }
53
63
                pIcon->cParentDockName = g_strdup (myIcon->cName);
54
64
                
 
65
                if (myConfig.bMapWallpaper)
 
66
                {
 
67
                        pIcon->iface.load_image = _load_desktop_icon;
 
68
                }
 
69
                
55
70
                pIconList = g_list_append (pIconList, pIcon);
56
71
        }
57
72
        
96
111
                GList *pIconList = _load_icons ();
97
112
                
98
113
                //\_______________________ On charge la nouvelle liste.
99
 
                ///gpointer pConfig[2] = {GINT_TO_POINTER (myConfig.bDesklet3D), GINT_TO_POINTER (FALSE)};
100
114
                CD_APPLET_LOAD_MY_ICONS_LIST (pIconList, myConfig.cRenderer, "Slide", NULL);
101
115
                
102
116
                //\_______________________ On peint les icones.
103
 
                cd_switcher_trigger_paint_icons ();
 
117
                ///cd_switcher_trigger_paint_icons ();
104
118
        }
105
119
}
106
120
 
107
 
void cd_switcher_paint_icons (void)
 
121
/**void cd_switcher_paint_icons (void)
108
122
{
109
123
        //\_______________________ On applique la surface.
110
124
        CairoContainer *pContainer = CD_APPLET_MY_ICONS_LIST_CONTAINER;
153
167
        }
154
168
}
155
169
 
156
 
 
157
170
static gboolean _paint_icons (gpointer data)
158
171
{
159
172
        CD_APPLET_ENTER;
160
 
        if (myConfig.bCompactView)
 
173
        if (! myConfig.bCompactView)
161
174
                cd_switcher_paint_icons ();
162
175
        myData.iSidPainIcons = 0;
163
176
        CD_APPLET_LEAVE (FALSE);
167
180
        if (myData.iSidPainIcons != 0)  // on la lance en idle, car les icones sont chargees en idle.
168
181
                g_source_remove (myData.iSidPainIcons);
169
182
        myData.iSidPainIcons = g_idle_add ((GSourceFunc)_paint_icons, NULL);
170
 
}
 
183
}*/
171
184
 
172
185
 
173
186
void cd_switcher_load_desktop_bg_map_surface (void)
174
187
{
 
188
        // get the background surface
175
189
        CairoDockDesktopBackground *db = cairo_dock_get_desktop_background (FALSE);  // FALSE <=> sans texture.
176
190
        cairo_surface_t *pBgSurface = cairo_dock_get_desktop_bg_surface (db);
177
 
        cd_debug ("on a recupere le fond d'ecran (%x)", pBgSurface);
178
191
        
179
192
        if (myData.pDesktopBgMapSurface != NULL)
180
193
                cairo_surface_destroy (myData.pDesktopBgMapSurface);
185
198
                cairo_dock_destroy_desktop_background (db);
186
199
                return ;
187
200
        }
188
 
        int iWidth, iHeight;
189
 
        CD_APPLET_GET_MY_ICON_EXTENT (&iWidth, &iHeight);
190
 
        cd_debug ("%s (%dx%d)", __func__, iWidth, iHeight);
191
 
        
192
 
        cairo_t *pCairoContext = cairo_dock_create_context_from_container (myContainer);
 
201
        
 
202
        // load it at a decent size.
 
203
        if (myDock)
 
204
        {
 
205
                CD_APPLET_GET_MY_ICON_EXTENT (&myData.iSurfaceWidth, &myData.iSurfaceHeight);
 
206
        }
 
207
        else
 
208
        {
 
209
                myData.iSurfaceWidth = myContainer->iWidth / myData.switcher.iNbViewportTotal;
 
210
                myData.iSurfaceHeight = myContainer->iHeight / myData.switcher.iNbViewportTotal;
 
211
        }
 
212
        // g_print ("%s (%dx%d)\n", __func__, myData.iSurfaceWidth, myData.iSurfaceHeight);
 
213
        
193
214
        myData.pDesktopBgMapSurface = cairo_dock_duplicate_surface (pBgSurface,
194
215
                g_desktopGeometry.iXScreenWidth[CAIRO_DOCK_HORIZONTAL], g_desktopGeometry.iXScreenHeight[CAIRO_DOCK_HORIZONTAL],
195
 
                iWidth, iHeight);
 
216
                myData.iSurfaceWidth, myData.iSurfaceHeight);
196
217
        
197
 
        cairo_destroy (pCairoContext);
198
218
        cairo_dock_destroy_desktop_background (db);
199
219
}
200
220
 
202
222
{
203
223
        if (myData.pDefaultMapSurface != NULL)
204
224
                cairo_surface_destroy (myData.pDefaultMapSurface);
205
 
        cd_debug ("%s (%.2fx%.2f)", __func__, myIcon->fWidth, myIcon->fHeight);
206
 
        myData.pDefaultMapSurface = CD_APPLET_LOAD_SURFACE_FOR_MY_APPLET (myConfig.cDefaultIcon);
 
225
        if (myDock)
 
226
        {
 
227
                CD_APPLET_GET_MY_ICON_EXTENT (&myData.iSurfaceWidth, &myData.iSurfaceHeight);
 
228
        }
 
229
        else
 
230
        {
 
231
                myData.iSurfaceWidth = myContainer->iWidth / myData.switcher.iNbViewportTotal;
 
232
                myData.iSurfaceHeight = myContainer->iHeight / myData.switcher.iNbViewportTotal;
 
233
        }
 
234
        // g_print ("%s (%dx%d)\n", __func__, myData.iSurfaceWidth, myData.iSurfaceHeight);
 
235
        myData.pDefaultMapSurface = cairo_dock_create_surface_from_image_simple (myConfig.cDefaultIcon,
 
236
                myData.iSurfaceWidth,
 
237
                myData.iSurfaceHeight);
207
238
}