Merge lp:~cairo-dock-team/ubuntu/precise/cairo-dock-plug-ins/2.4.0-2.1 into lp:ubuntu/precise/cairo-dock-plug-ins

Proposed by Matthieu Baerts
Status: Merged
Merged at revision: 23
Proposed branch: lp:~cairo-dock-team/ubuntu/precise/cairo-dock-plug-ins/2.4.0-2.1
Merge into: lp:ubuntu/precise/cairo-dock-plug-ins
Diff against target: 1092 lines (+249/-398)
23 files modified
.pc/.version (+0/-1)
.pc/01-switcher-force-compact-view.patch/switcher/data/switcher.conf.in (+0/-177)
.pc/01-switcher-force-compact-view.patch/switcher/src/applet-config.c (+0/-78)
.pc/applied-patches (+0/-1)
GMenu/src/applet-menu.c (+23/-5)
Status-Notifier/src/applet-draw.c (+1/-1)
Status-Notifier/src/applet-host-ias.c (+9/-2)
Status-Notifier/src/applet-host.c (+20/-1)
Status-Notifier/src/applet-host.h (+3/-1)
Status-Notifier/src/applet-item.c (+10/-8)
debian/changelog (+18/-0)
debian/patches/01-removed-useless-g_print.patch (+37/-0)
debian/patches/01-switcher-force-compact-view.patch (+0/-34)
debian/patches/series (+1/-1)
desklet-rendering/src/rendering-desklet-viewport.c (+2/-0)
switcher/data/switcher.conf.in (+4/-0)
switcher/src/applet-config.c (+1/-1)
switcher/src/applet-desktops.c (+10/-3)
switcher/src/applet-draw.c (+44/-48)
switcher/src/applet-init.c (+14/-17)
switcher/src/applet-load-icons.c (+47/-16)
switcher/src/applet-load-icons.h (+2/-2)
switcher/src/applet-struct.h (+3/-1)
To merge this branch: bzr merge lp:~cairo-dock-team/ubuntu/precise/cairo-dock-plug-ins/2.4.0-2.1
Reviewer Review Type Date Requested Status
Daniel Holbach (community) Approve
Review via email: mp+81376@code.launchpad.net

Description of the change

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)

To post a comment you must log in.
Revision history for this message
Daniel Holbach (dholbach) wrote :

Thanks a lot for your work on this!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed directory '.pc'
2=== removed file '.pc/.version'
3--- .pc/.version 2011-10-09 00:19:16 +0000
4+++ .pc/.version 1970-01-01 00:00:00 +0000
5@@ -1,1 +0,0 @@
6-2
7
8=== removed directory '.pc/01-switcher-force-compact-view.patch'
9=== removed directory '.pc/01-switcher-force-compact-view.patch/switcher'
10=== removed directory '.pc/01-switcher-force-compact-view.patch/switcher/data'
11=== removed file '.pc/01-switcher-force-compact-view.patch/switcher/data/switcher.conf.in'
12--- .pc/01-switcher-force-compact-view.patch/switcher/data/switcher.conf.in 2011-10-09 00:19:16 +0000
13+++ .pc/01-switcher-force-compact-view.patch/switcher/data/switcher.conf.in 1970-01-01 00:00:00 +0000
14@@ -1,177 +0,0 @@
15-#@VERSION_SWITCHER@
16-
17-#[gtk-about]
18-[Icon]
19-
20-#F[Icon]
21-frame_maininfo=
22-
23-#d Name of the dock it belongs to:
24-dock name =
25-
26-#s Name of the icon as it will appear in its caption in the dock:
27-name =
28- #v
29-sep_display=
30-
31-#S+ Image filename:
32-#{Leave empty to use the default one.}
33-icon =
34-
35-#j+[0;400] Desired icon size for this applet
36-#{Set to 0 to use the default applet size}
37-icon size = 0;0
38-
39-order=
40-
41-#F[Applet's Handbook]
42-frame_hand=
43-#A
44-handbook=switcher
45-
46-#[gtk-convert]
47-[Desklet]
48-
49-#X[Position]
50-frame_pos =
51-
52-#b Lock position?
53-#{If locked, the desklet cannot be moved by simply dragging it with the left mouse button. It can still be moved with ALT + left-click.}
54-locked = false
55-
56-#j+[24;512] Desklet dimensions (width x height):
57-#{Depending on your WindowManager, you may be able to resize this with ALT + middle-click or ALT + left-click.}
58-size = 96;96
59-
60-#i[-2048;2048] Desklet position (x, y):
61-x position=10
62-#i[-2048;2048] ...
63-y position=10
64-
65-#X[Visibility]
66-frame_visi =
67-
68-#b Is detached from the dock
69-initially detached=false
70-#l[Normal;Keep above;Keep below;Keep on widget layer;Reserve space] Visibility:
71-accessibility=0
72-#b Should be visible on all desktops?
73-sticky=true
74-
75-
76-
77-
78-#F[Decorations;gtk-orientation-portrait]
79-frame_deco=
80-
81-#o+ Choose a decoration theme for this desklet:
82-#{Choose 'Custom decorations' to define your own decorations below.}
83-decorations = default
84-
85-#v
86-sep_deco =
87-
88-#S+ Background image:
89-#{Image to be displayed below drawings, e.g. a frame. Leave empty for no image.}
90-bg desklet =
91-#e+[0;1] Background transparency:
92-bg alpha = 1
93-#i+[0;256] Left offset:
94-#{in pixels. Use this to adjust the left position of drawings.}
95-left offset = 0
96-#i+[0;256] Top offset:
97-#{in pixels. Use this to adjust the top position of drawings.}
98-top offset = 0
99-#i+[0;256] Right offset:
100-#{in pixels. Use this to adjust the right position of drawings.}
101-right offset = 0
102-#i+[0;256] Bottom offset:
103-#{in pixels. Use this to adjust the bottom position of drawings.}
104-bottom offset = 0
105-#S+ Foreground image:
106-#{Image to be displayed above the drawings, e.g. a reflection. Leave empty for no image.}
107-fg desklet =
108-#e+[0;1] Foreground tansparency:
109-fg alpha = 1
110-
111-
112-#[gtk-preferences]
113-[Configuration]
114-
115-#F[Configuration]
116-frame_conf =
117-
118-#B Use the compact mode?
119-#{All desktops will be drawn on the main icon. Otherwise a sub-dock will contain all desktops.}
120-Vue Simple = true
121-
122-#b Preserve the ratio of the screen ?
123-preserve ratio = true
124-
125-#b Map wallpaper to icons?
126-Map Wallpaper = true
127-
128-#b Show desktop number on icons?
129-display numero desktop = true
130-
131-#B Draw windows on icons?
132-Draw Windows = true
133-
134-#b Draw hidden windows?
135-Draw hidden Windows = false
136-
137-#v
138-sep_conf =
139-
140-#l[Show windows' list;Show desktop;Expose all the desktops;Expose all the windows] Action on middle-click:
141-action on click = 0
142-
143-#U Workspace names :
144-desktop names =
145-
146-
147-#F[Display options]
148-frame_disp =
149-
150-#i+[0;8] Size of the inside lines :
151-inlinesize = 3
152-
153-#C+ Internal line colour:
154-#{r, g, b, a}
155-rgbinlinecolor = 0.0; 0.0; 0.5; 1.
156-
157-#i+[0;8] External line size:
158-linesize = 3
159-
160-#C+ External line colour:
161-#{r, g, b, a}
162-rgblinecolor = 0.0; 0.0; 0.5; 1.
163-
164-#C+ Window line colour:
165-#{r, g, b, a}
166-rgbwlinecolor = 0.0; 0.0; 0.5; 1.
167-
168-#v
169-sep_cur =
170-
171-#C+ Current desktop colour:
172-#{r, g, b, a}
173-rgbindcolor = 0.0; 0.0; 0.5; 0.5
174-
175-#l+[draw a frame;fill;fill others] How to draw the current desktop:
176-fill current = 1
177-
178-#v
179-sep_other =
180-
181-#S+ Icon to use in expanded mode if wallpaper is not mapped:
182-#{Leave empty to use the default one.}
183-default icon =
184-
185-
186-#n+ Sub-dock view name:
187-#{Leave empty to use default sub-dock view.}/
188-renderer =
189-
190-#b+ In expanded mode, render the desklet in 3D?
191-3D desklet = true
192
193=== removed directory '.pc/01-switcher-force-compact-view.patch/switcher/src'
194=== removed file '.pc/01-switcher-force-compact-view.patch/switcher/src/applet-config.c'
195--- .pc/01-switcher-force-compact-view.patch/switcher/src/applet-config.c 2011-10-09 00:19:16 +0000
196+++ .pc/01-switcher-force-compact-view.patch/switcher/src/applet-config.c 1970-01-01 00:00:00 +0000
197@@ -1,78 +0,0 @@
198-/**
199-* This file is a part of the Cairo-Dock project
200-*
201-* Copyright : (C) see the 'copyright' file.
202-* E-mail : see the 'copyright' file.
203-*
204-* This program is free software; you can redistribute it and/or
205-* modify it under the terms of the GNU General Public License
206-* as published by the Free Software Foundation; either version 3
207-* of the License, or (at your option) any later version.
208-*
209-* This program is distributed in the hope that it will be useful,
210-* but WITHOUT ANY WARRANTY; without even the implied warranty of
211-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
212-* GNU General Public License for more details.
213-* You should have received a copy of the GNU General Public License
214-* along with this program. If not, see <http://www.gnu.org/licenses/>.
215-*/
216-
217-#include <string.h>
218-
219-#include "applet-struct.h"
220-#include "applet-config.h"
221-#include "applet-load-icons.h"
222-
223-
224-CD_APPLET_GET_CONFIG_BEGIN
225- //\_________________ On recupere toutes les valeurs de notre fichier de conf.
226- myConfig.bCompactView = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Vue Simple", TRUE);
227- myConfig.bPreserveScreenRatio = CD_CONFIG_GET_BOOLEAN ("Configuration", "preserve ratio");
228- myConfig.bMapWallpaper = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Map Wallpaper", TRUE);
229- myConfig.bDisplayNumDesk = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "display numero desktop", TRUE);
230- myConfig.bDrawWindows = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Draw Windows", TRUE);
231- myConfig.bDisplayHiddenWindows = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Draw hidden Windows", TRUE);
232- myConfig.iActionOnMiddleClick = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Configuration", "action on click", 0);
233-
234- // couleur des lignes interieures
235- myConfig.iInLineSize = CD_CONFIG_GET_INTEGER("Configuration", "inlinesize");
236- double inlinecouleur[4] = {0., 0., 0.5, 1.};
237- CD_CONFIG_GET_COLOR_WITH_DEFAULT ("Configuration", "rgbinlinecolor",myConfig.RGBInLineColors, inlinecouleur);
238-
239- // couleur du bureau courant.
240- double indcouleur[4] = {0., 0., 0.5, 1.};
241- CD_CONFIG_GET_COLOR_WITH_DEFAULT ("Configuration", "rgbindcolor",myConfig.RGBIndColors, indcouleur);
242- myConfig.iDrawCurrentDesktopMode = CD_CONFIG_GET_INTEGER ("Configuration", "fill current");
243-
244- // couleur des lignes exterieures.
245- myConfig.iLineSize = CD_CONFIG_GET_INTEGER("Configuration", "linesize");
246- double linecouleur[4] = {0., 0., 0.5, 1.};
247- CD_CONFIG_GET_COLOR_WITH_DEFAULT ("Configuration", "rgblinecolor",myConfig.RGBLineColors, linecouleur);
248-
249- // couleur des traits des fenetres.
250- double wlinecouleur[4] = {0., 0., 0.5, 1.};
251- CD_CONFIG_GET_COLOR_WITH_DEFAULT ("Configuration", "rgbwlinecolor",myConfig.RGBWLineColors, wlinecouleur);
252-
253- myConfig.cDefaultIcon = CD_CONFIG_GET_FILE_PATH ("Configuration", "default icon", "default.svg");
254- myConfig.cRenderer = CD_CONFIG_GET_STRING ("Configuration", "renderer");
255- myConfig.bDesklet3D = CD_CONFIG_GET_BOOLEAN ("Configuration", "3D desklet");
256-
257- gsize iNbNamesSize;
258- myConfig.cDesktopNames = CD_CONFIG_GET_STRING_LIST_WITH_DEFAULT ("Configuration", "desktop names", &iNbNamesSize, "Work;Game;Video;Chat");
259- myConfig.iNbNames = (gint) iNbNamesSize;
260-CD_APPLET_GET_CONFIG_END
261-
262-
263-CD_APPLET_RESET_CONFIG_BEGIN
264- g_free (myConfig.cRenderer);
265- g_free (myConfig.cDefaultIcon);
266- if (myConfig.cDesktopNames != NULL)
267- g_strfreev (myConfig.cDesktopNames);
268-CD_APPLET_RESET_CONFIG_END
269-
270-
271-CD_APPLET_RESET_DATA_BEGIN
272- CD_APPLET_DELETE_MY_ICONS_LIST;
273- cairo_surface_destroy (myData.pDefaultMapSurface);
274- cairo_surface_destroy (myData.pDesktopBgMapSurface);
275-CD_APPLET_RESET_DATA_END
276
277=== removed file '.pc/applied-patches'
278--- .pc/applied-patches 2011-10-09 00:19:16 +0000
279+++ .pc/applied-patches 1970-01-01 00:00:00 +0000
280@@ -1,1 +0,0 @@
281-01-switcher-force-compact-view.patch
282
283=== modified file 'GMenu/src/applet-menu.c'
284--- GMenu/src/applet-menu.c 2011-08-09 18:08:08 +0000
285+++ GMenu/src/applet-menu.c 2011-11-05 21:33:25 +0000
286@@ -699,19 +699,37 @@
287 return menu;
288 }
289
290+#define XDG_MENUS_PATH "/etc/xdg/menus"
291 GtkWidget * create_main_menu (CairoDockModuleInstance *myApplet)
292 {
293 GtkWidget *main_menu;
294
295 // workaround pour KDE, qui ne loupe pas une occasion de se distinguer.
296 const gchar *cMenuFileName = NULL;
297- if (! g_file_test ("/etc/xdg/menus/applications.menu", G_FILE_TEST_EXISTS)) // on pourrait aussi aller lire le start-here.menu, mais je suis pas sur que ce soit standard.
298+ if (g_file_test (XDG_MENUS_PATH"/applications.menu", G_FILE_TEST_EXISTS)) // first check
299+ cMenuFileName = "applications.menu";
300+ else if (g_file_test (XDG_MENUS_PATH"/kde-applications.menu", G_FILE_TEST_EXISTS))
301+ cMenuFileName = "kde-applications.menu";
302+ else if (g_file_test (XDG_MENUS_PATH"/xfce-applications.menu", G_FILE_TEST_EXISTS))
303+ cMenuFileName = "xfce-applications.menu";
304+ else // kde4-applications.menu, lxde-applications.menu, ...; let's check any *-applications.menu
305 {
306- if (g_file_test ("/etc/xdg/menus/kde-applications.menu", G_FILE_TEST_EXISTS))
307- cMenuFileName = "kde-applications.menu";
308- else if (g_file_test ("/etc/xdg/menus/xfce-applications.menu", G_FILE_TEST_EXISTS))
309- cMenuFileName = "xfce-applications.menu";
310+ const gchar *cFileName;
311+ GDir *dir = g_dir_open (XDG_MENUS_PATH, 0, NULL);
312+ if (dir)
313+ {
314+ while (cFileName = g_dir_read_name (dir))
315+ {
316+ if (g_str_has_suffix (cFileName, "-applications.menu"))
317+ {
318+ cMenuFileName = cFileName;
319+ break;
320+ }
321+ }
322+ g_dir_close (dir);
323+ }
324 }
325+
326 if (cMenuFileName == NULL)
327 cMenuFileName = "applications.menu";
328
329
330=== modified file 'Status-Notifier/src/applet-draw.c'
331--- Status-Notifier/src/applet-draw.c 2011-08-09 18:08:08 +0000
332+++ Status-Notifier/src/applet-draw.c 2011-11-05 21:33:25 +0000
333@@ -197,7 +197,7 @@
334 else
335 cd_satus_notifier_compute_grid ();
336
337- // reload surfaces if their size has changed.
338+ // load surfaces, or reload them if their size has changed.
339 cd_debug ("=== item size: %d -> %d, icon size: %dx%d (%p)", iPrevSize, myData.iItemSize, myIcon->iImageWidth, myIcon->iImageHeight, myIcon->pIconBuffer);
340 CDStatusNotifierItem *pItem;
341 GList *it;
342
343=== modified file 'Status-Notifier/src/applet-host-ias.c'
344--- Status-Notifier/src/applet-host-ias.c 2011-09-26 12:56:12 +0000
345+++ Status-Notifier/src/applet-host-ias.c 2011-11-05 21:33:25 +0000
346@@ -180,7 +180,7 @@
347 #if (INDICATOR_OLD_NAMES == 0) // Natty
348 const gchar *cAccessbleDesc, // WTF is this new param ??
349 #if (INDICATOR_APPLICATIONADDED_HAS_HINT == 1)
350-const gchar *cHint,
351+const gchar *cHint, // <irony> is this a hint to work around a clumsy API ? </irony>
352 #endif
353 #endif
354 CairoDockModuleInstance *myApplet)
355@@ -207,7 +207,14 @@
356 }
357 }
358
359- cd_satus_notifier_add_new_item (cAdress, cObjectPath, iPosition);
360+ cd_satus_notifier_add_new_item_with_default (cAdress, cObjectPath, iPosition,
361+ #if (INDICATOR_APPLICATIONADDED_HAS_HINT == 1)
362+ cIconName ? cIconName : cHint,
363+ #else
364+ cIconName,
365+ #endif
366+ cIconThemePath,
367+ cLabel);
368
369 CD_APPLET_LEAVE ();
370 }
371
372=== modified file 'Status-Notifier/src/applet-host.c'
373--- Status-Notifier/src/applet-host.c 2011-08-09 18:08:08 +0000
374+++ Status-Notifier/src/applet-host.c 2011-11-05 21:33:25 +0000
375@@ -65,7 +65,7 @@
376 /// Add/remove item ///
377 ///////////////////////
378
379-void cd_satus_notifier_add_new_item (const gchar *cService, const gchar *cObjectPath, int iPosition)
380+void cd_satus_notifier_add_new_item_with_default (const gchar *cService, const gchar *cObjectPath, int iPosition, const gchar *cIconName, const gchar *cIconThemePath, const gchar *cLabel)
381 {
382 CDStatusNotifierItem *pItem = _cd_satus_notifier_find_item_from_service (cService);
383 g_return_if_fail (pItem == NULL); // on evite d'ajouter 2 fois le meme service.
384@@ -73,6 +73,25 @@
385 pItem = cd_satus_notifier_create_item (cService, cObjectPath);
386 g_return_if_fail (pItem != NULL);
387
388+ // the Ubuntu IAS is buggy, it doesn't return all the properties of the item; so we may have to complete with the properties that are given in the 'ApplicationAdded' callback.
389+ if (pItem->cIconName == NULL)
390+ pItem->cIconName = g_strdup (cIconName);
391+
392+ if (pItem->cIconThemePath == NULL)
393+ {
394+ pItem->cIconThemePath = g_strdup (cIconThemePath);
395+ if (pItem->cIconThemePath)
396+ {
397+ cd_satus_notifier_add_theme_path (pItem->cIconThemePath);
398+ }
399+ }
400+
401+ if (pItem->cLabel == NULL)
402+ pItem->cLabel = g_strdup (cLabel);
403+
404+ if (pItem->cMenuPath == NULL)
405+ pItem->cMenuPath = g_strdup (cObjectPath);
406+
407 pItem->iPosition = iPosition;
408 if (pItem->cLabel == NULL && pItem->cTitle == NULL)
409 pItem->cLabel = g_strdup (pItem->cId); // cService is often a dbus name like :1.355
410
411=== modified file 'Status-Notifier/src/applet-host.h'
412--- Status-Notifier/src/applet-host.h 2011-08-09 18:08:08 +0000
413+++ Status-Notifier/src/applet-host.h 2011-11-05 21:33:25 +0000
414@@ -23,7 +23,9 @@
415 #include <cairo-dock.h>
416
417
418-void cd_satus_notifier_add_new_item (const gchar *cService, const gchar *cObjectPath, int iPosition);
419+void cd_satus_notifier_add_new_item_with_default (const gchar *cService, const gchar *cObjectPath, int iPosition, const gchar *cIconName, const gchar *cIconThemePath, const gchar *cLabel);
420+
421+#define cd_satus_notifier_add_new_item(cService, cObjectPath, iPosition) cd_satus_notifier_add_new_item_with_default (cService, cObjectPath, iPosition, NULL, NULL, NULL)
422
423 void cd_satus_notifier_remove_item (const gchar *cService, int iPosition);
424
425
426=== modified file 'Status-Notifier/src/applet-item.c'
427--- Status-Notifier/src/applet-item.c 2011-09-26 12:56:12 +0000
428+++ Status-Notifier/src/applet-item.c 2011-11-05 21:33:25 +0000
429@@ -360,12 +360,13 @@
430 *str = '\0';
431
432 // special case for Ubuntu indicators: we don't know their object path.
433+ gchar *cRealObjectPath = NULL;
434 if (cObjectPath != NULL && strncmp (cObjectPath, CD_INDICATOR_APPLICATION_ITEM_OBJ, strlen (CD_INDICATOR_APPLICATION_ITEM_OBJ)) == 0)
435 {
436 // I think this is because this path is actually the menu path, and fortunately it's just under the item object's path.
437- gchar *str = strrchr (cObjectPath, '/');
438+ const gchar *str = strrchr (cObjectPath, '/');
439 if (str)
440- *str = '\0';
441+ cRealObjectPath = g_strndup (cObjectPath, str - cObjectPath);
442 }
443 else if (cObjectPath == NULL || *cObjectPath == '\0') // no path, let's assume it's the common one.
444 {
445@@ -377,7 +378,7 @@
446 //\_________________ get the properties of the item.
447 DBusGProxy *pProxyItemProp = cairo_dock_create_new_session_proxy (
448 cService,
449- cObjectPath,
450+ cRealObjectPath ? cRealObjectPath : cObjectPath,
451 DBUS_INTERFACE_PROPERTIES);
452 if (pProxyItemProp == NULL)
453 return NULL;
454@@ -422,7 +423,7 @@
455 {
456 cIconName = g_value_get_string (v);
457 }
458- //g_print ("=== IconName '%s'\n", cIconName);
459+ cd_debug ("=== IconName '%s'", cIconName);
460
461 const gchar *cIconThemePath = NULL;
462 v = g_hash_table_lookup (hProps, "IconThemePath");
463@@ -430,7 +431,7 @@
464 {
465 cIconThemePath = g_value_get_string (v);
466 }
467- //g_print ("=== IconThemePath '%s'\n", cIconThemePath);
468+ cd_debug ("=== IconThemePath '%s'", cIconThemePath);
469
470 const gchar *cAttentionIconName = NULL;
471 v = g_hash_table_lookup (hProps, "AttentionIconName"); // -> keep for demands of attention
472@@ -446,7 +447,7 @@
473 {
474 cMenuPath = (gchar*) g_value_get_boxed (v);
475 }
476- //g_print ("=== cMenuPath '%s'\n", cMenuPath);
477+ cd_debug ("=== cMenuPath '%s'", cMenuPath);
478
479 // properties supported by Ubuntu.
480 gint iPosition = -1;
481@@ -517,7 +518,7 @@
482
483 DBusGProxy *pProxyItem = cairo_dock_create_new_session_proxy (
484 cService,
485- cObjectPath,
486+ cRealObjectPath ? cRealObjectPath : cObjectPath,
487 CD_STATUS_NOTIFIER_ITEM_IFACE);
488 if (pProxyItem == NULL)
489 return NULL;
490@@ -532,7 +533,7 @@
491 pItem->cTitle = g_strdup (cTitle);
492 pItem->cLabel = g_strdup (cLabel);
493 pItem->cLabelGuide = g_strdup (cLabelGuide);
494- pItem->cMenuPath = g_strdup (cMenuPath);
495+ pItem->cMenuPath = (cMenuPath ? g_strdup (cMenuPath) : g_strdup (cObjectPath));
496 pItem->iWindowId = iWindowId;
497 pItem->iCategory = _find_category (cCategory);
498 pItem->iStatus = _find_status (cStatus);
499@@ -600,6 +601,7 @@
500 g_signal_connect (G_OBJECT(pProxyItem), "destroy", G_CALLBACK (_on_item_proxy_destroyed), pItem); // attention, dangereux car on va etre appele lorsqu'on detruit un item.
501
502 g_hash_table_destroy (hProps);
503+ g_free (cRealObjectPath);
504 return pItem;
505 }
506
507
508=== modified file 'debian/changelog'
509--- debian/changelog 2011-10-09 00:19:16 +0000
510+++ debian/changelog 2011-11-05 21:33:25 +0000
511@@ -1,3 +1,21 @@
512+cairo-dock-plug-ins (2.4.0~2.1-0ubuntu1) UNRELEASED; urgency=low
513+
514+ * New upstream bug fix release. (LP: #886676)
515+ * Upstream ChangeLog:
516+ - Desklet-rendering - viewport: fixed a crash when the desklet is empty
517+ - Status-Notifier: patch to work around strange bugs
518+ in the Ubuntu's indicator-application
519+ - Switcher: fixed a crash in expanded+desklet mode, a wrong loading
520+ of the icons and a small drawing bug with the non-compact view.
521+ - GMenu: look for *-applications.menu file in the xdg path
522+ (if common file names are not found, e.g. with KDE env in Oneiric)
523+ * debian/patches/01-switcher-force-compact-view.patch:
524+ - Deleted (now in upstream)
525+ * debian/patches/01-removed-useless-g_print.patch:
526+ - Removed useless output messages
527+
528+ -- Matthieu Baerts (matttbe) <matttbe@gmail.com> Sat, 05 Nov 2011 21:55:39 +0100
529+
530 cairo-dock-plug-ins (2.4.0~2-0ubuntu1) oneiric; urgency=low
531
532 [ Matthieu Baerts (matttbe) ]
533
534=== added file 'debian/patches/01-removed-useless-g_print.patch'
535--- debian/patches/01-removed-useless-g_print.patch 1970-01-01 00:00:00 +0000
536+++ debian/patches/01-removed-useless-g_print.patch 2011-11-05 21:33:25 +0000
537@@ -0,0 +1,37 @@
538+## Description: Removed useless output messages
539+## Origin/Author: Matthieu Baerts (matttbe)
540+Index: cairo-dock-plug-ins/switcher/src/applet-draw.c
541+===================================================================
542+--- cairo-dock-plug-ins.orig/switcher/src/applet-draw.c 2011-11-05 21:29:03.647635000 +0100
543++++ cairo-dock-plug-ins/switcher/src/applet-draw.c 2011-11-05 21:35:54.324276301 +0100
544+@@ -638,7 +638,7 @@
545+ g_object_set (pMenuItem, "height-request", 3, NULL);
546+
547+ // on ajoute les fenetres du viewport au menu.
548+- g_print (" listing des fenetres du bureau (%d;%d;%d) ...\n", iNumDesktop, iNumViewportX, iNumViewportY);
549++ // g_print (" listing des fenetres du bureau (%d;%d;%d) ...\n", iNumDesktop, iNumViewportX, iNumViewportY);
550+ cd_switcher_foreach_window_on_viewport (iNumDesktop,
551+ iNumViewportX,
552+ iNumViewportY,
553+Index: cairo-dock-plug-ins/switcher/src/applet-load-icons.c
554+===================================================================
555+--- cairo-dock-plug-ins.orig/switcher/src/applet-load-icons.c 2011-11-05 21:29:03.647635000 +0100
556++++ cairo-dock-plug-ins/switcher/src/applet-load-icons.c 2011-11-05 21:36:33.992275747 +0100
557+@@ -209,7 +209,7 @@
558+ myData.iSurfaceWidth = myContainer->iWidth / myData.switcher.iNbViewportTotal;
559+ myData.iSurfaceHeight = myContainer->iHeight / myData.switcher.iNbViewportTotal;
560+ }
561+- g_print ("%s (%dx%d)\n", __func__, myData.iSurfaceWidth, myData.iSurfaceHeight);
562++ // g_print ("%s (%dx%d)\n", __func__, myData.iSurfaceWidth, myData.iSurfaceHeight);
563+
564+ myData.pDesktopBgMapSurface = cairo_dock_duplicate_surface (pBgSurface,
565+ g_desktopGeometry.iXScreenWidth[CAIRO_DOCK_HORIZONTAL], g_desktopGeometry.iXScreenHeight[CAIRO_DOCK_HORIZONTAL],
566+@@ -231,7 +231,7 @@
567+ myData.iSurfaceWidth = myContainer->iWidth / myData.switcher.iNbViewportTotal;
568+ myData.iSurfaceHeight = myContainer->iHeight / myData.switcher.iNbViewportTotal;
569+ }
570+- g_print ("%s (%dx%d)\n", __func__, myData.iSurfaceWidth, myData.iSurfaceHeight);
571++ // g_print ("%s (%dx%d)\n", __func__, myData.iSurfaceWidth, myData.iSurfaceHeight);
572+ myData.pDefaultMapSurface = cairo_dock_create_surface_from_image_simple (myConfig.cDefaultIcon,
573+ myData.iSurfaceWidth,
574+ myData.iSurfaceHeight);
575
576=== removed file 'debian/patches/01-switcher-force-compact-view.patch'
577--- debian/patches/01-switcher-force-compact-view.patch 2011-10-09 00:19:16 +0000
578+++ debian/patches/01-switcher-force-compact-view.patch 1970-01-01 00:00:00 +0000
579@@ -1,34 +0,0 @@
580-## From: Matthieu Baerts (matttbe) <matttbe@gmail.com>
581-## Description: Forced the compact view because the other doesn't work
582-## Forwarded: yes
583-Index: cairo-dock-plug-ins/switcher/src/applet-config.c
584-===================================================================
585---- cairo-dock-plug-ins.orig/switcher/src/applet-config.c 2011-10-08 23:26:53.222924952 +0200
586-+++ cairo-dock-plug-ins/switcher/src/applet-config.c 2011-10-08 23:26:53.306924951 +0200
587-@@ -26,7 +26,7 @@
588-
589- CD_APPLET_GET_CONFIG_BEGIN
590- //\_________________ On recupere toutes les valeurs de notre fichier de conf.
591-- myConfig.bCompactView = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Vue Simple", TRUE);
592-+ myConfig.bCompactView = TRUE; // CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Vue Simple", TRUE);
593- myConfig.bPreserveScreenRatio = CD_CONFIG_GET_BOOLEAN ("Configuration", "preserve ratio");
594- myConfig.bMapWallpaper = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Map Wallpaper", TRUE);
595- myConfig.bDisplayNumDesk = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "display numero desktop", TRUE);
596-Index: cairo-dock-plug-ins/.bzr/checkout/dirstate
597-===================================================================
598-Binary files cairo-dock-plug-ins.orig/.bzr/checkout/dirstate 2011-10-08 23:28:01.502925141 +0200 and cairo-dock-plug-ins/.bzr/checkout/dirstate 2011-10-08 23:27:09.198924995 +0200 differ
599-Index: cairo-dock-plug-ins/switcher/data/switcher.conf.in
600-===================================================================
601---- cairo-dock-plug-ins.orig/switcher/data/switcher.conf.in 2011-10-08 23:28:00.542925138 +0200
602-+++ cairo-dock-plug-ins/switcher/data/switcher.conf.in 2011-10-08 23:27:55.810925124 +0200
603-@@ -101,10 +101,6 @@
604- #F[Configuration]
605- frame_conf =
606-
607--#B Use the compact mode?
608--#{All desktops will be drawn on the main icon. Otherwise a sub-dock will contain all desktops.}
609--Vue Simple = true
610--
611- #b Preserve the ratio of the screen ?
612- preserve ratio = true
613-
614
615=== modified file 'debian/patches/series'
616--- debian/patches/series 2011-10-09 00:19:16 +0000
617+++ debian/patches/series 2011-11-05 21:33:25 +0000
618@@ -1,1 +1,1 @@
619-01-switcher-force-compact-view.patch
620+01-removed-useless-g_print.patch
621
622=== modified file 'desklet-rendering/src/rendering-desklet-viewport.c'
623--- desklet-rendering/src/rendering-desklet-viewport.c 2011-04-20 20:46:51 +0000
624+++ desklet-rendering/src/rendering-desklet-viewport.c 2011-11-05 21:33:25 +0000
625@@ -87,6 +87,8 @@
626
627 static void _compute_icons_position (CairoDesklet *pDesklet, CDViewportParameters *pViewport)
628 {
629+ if (pViewport->nRowsX == 0) // either the grid has not yet been calculated, or there is no icon => nothing to do.
630+ return;
631 double fScrollOffset = - pViewport->iScrollOffset;
632 int iOffsetY = myIconsParam.iLabelSize + // le texte des icones de la 1ere ligne
633 fScrollOffset;
634
635=== modified file 'switcher/data/switcher.conf.in'
636--- switcher/data/switcher.conf.in 2011-10-09 00:19:16 +0000
637+++ switcher/data/switcher.conf.in 2011-11-05 21:33:25 +0000
638@@ -101,6 +101,10 @@
639 #F[Configuration]
640 frame_conf =
641
642+#B Use the compact mode?
643+#{All desktops will be drawn on the main icon. Otherwise a sub-dock will contain all desktops.}
644+Vue Simple = true
645+
646 #b Preserve the ratio of the screen ?
647 preserve ratio = true
648
649
650=== modified file 'switcher/src/applet-config.c'
651--- switcher/src/applet-config.c 2011-10-09 00:19:16 +0000
652+++ switcher/src/applet-config.c 2011-11-05 21:33:25 +0000
653@@ -26,7 +26,7 @@
654
655 CD_APPLET_GET_CONFIG_BEGIN
656 //\_________________ On recupere toutes les valeurs de notre fichier de conf.
657- myConfig.bCompactView = TRUE; // CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Vue Simple", TRUE);
658+ myConfig.bCompactView = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Vue Simple", TRUE);
659 myConfig.bPreserveScreenRatio = CD_CONFIG_GET_BOOLEAN ("Configuration", "preserve ratio");
660 myConfig.bMapWallpaper = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "Map Wallpaper", TRUE);
661 myConfig.bDisplayNumDesk = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Configuration", "display numero desktop", TRUE);
662
663=== modified file 'switcher/src/applet-desktops.c'
664--- switcher/src/applet-desktops.c 2011-10-09 00:19:16 +0000
665+++ switcher/src/applet-desktops.c 2011-11-05 21:33:25 +0000
666@@ -45,9 +45,16 @@
667 //g_print ("%s (%d)\n", __func__, iNbViewports);
668
669 int w, h;
670- CD_APPLET_GET_MY_ICON_EXTENT (&w, &h);
671- if (w == 0 || h == 0) // may happen in desklet mode on startup, until the desklet's window reaches its definite size.
672- return;
673+ if (myConfig.bCompactView)
674+ {
675+ CD_APPLET_GET_MY_ICON_EXTENT (&w, &h);
676+ if (w == 0 || h == 0) // may happen in desklet mode on startup, until the desklet's window reaches its definite size.
677+ return;
678+ }
679+ else // in expanded mode, we don't use the grid, except for computing an index, so any size will be ok.
680+ {
681+ w = h = 48;
682+ }
683 //cd_debug ("%d; %dx%d", iNbViewports, w, h);
684
685 double fZoomX, fZoomY;
686
687=== modified file 'switcher/src/applet-draw.c'
688--- switcher/src/applet-draw.c 2011-10-09 00:19:16 +0000
689+++ switcher/src/applet-draw.c 2011-11-05 21:33:25 +0000
690@@ -134,8 +134,6 @@
691 cairo_dock_erase_cairo_context (myDrawContext);
692
693 // definition des parametres de dessin.
694- //double fRatio = (myDock ? myDock->container.fRatio : 1.);
695- //double fMaxScale = cairo_dock_get_max_scale (myContainer); //coefficient Max icone Width
696 int iWidth, iHeight;
697 CD_APPLET_GET_MY_ICON_EXTENT (&iWidth, &iHeight);
698
699@@ -171,15 +169,13 @@
700 if (myConfig.bMapWallpaper)
701 {
702 pSurface = myData.pDesktopBgMapSurface;
703- fZoomX = (double) myData.switcher.fOneViewportWidth / iWidth;
704- fZoomY= (double) myData.switcher.fOneViewportHeight / iHeight;
705 }
706 if (pSurface == NULL)
707 {
708 pSurface = myData.pDefaultMapSurface;
709- fZoomX = (double) myData.switcher.fOneViewportWidth / iWidth;
710- fZoomY = (double) myData.switcher.fOneViewportHeight / iHeight;
711 }
712+ fZoomX = (double) myData.switcher.fOneViewportWidth / myData.iSurfaceWidth; // both surfaces are loaded at the same size.
713+ fZoomY= (double) myData.switcher.fOneViewportHeight / myData.iSurfaceHeight;
714
715 // cadre exterieur.
716 cairo_set_line_width (myDrawContext,myConfig.iLineSize);
717@@ -332,55 +328,55 @@
718
719 void cd_switcher_draw_main_icon_expanded_mode (void)
720 {
721- // definition des parametres de dessin.
722+ // apply the desktop bg or the user image on the main icon, in dock mode
723 int iWidth, iHeight;
724- CD_APPLET_GET_MY_ICON_EXTENT (&iWidth, &iHeight);
725- //double fRatio = (myDock ? myDock->container.fRatio : 1.);
726- //double fMaxScale = cairo_dock_get_max_scale (myContainer); //coefficient Max icone Width
727- myData.switcher.fOneViewportHeight = (iHeight - 2 * myConfig.iLineSize - (myData.switcher.iNbLines - 1) * myConfig.iInLineSize) / myData.switcher.iNbLines; //hauteur d'un bureau/viewport sans compter les lignes exterieures et interieures.
728- myData.switcher.fOneViewportWidth = (iWidth - 2 * myConfig.iLineSize - (myData.switcher.iNbColumns - 1) * myConfig.iInLineSize) / myData.switcher.iNbColumns; //largeur d'un bureau/viewport sans compter les lignes exterieures et interieures.
729-
730- cairo_surface_t *pSurface = NULL;
731- double fZoomX, fZoomY;
732- if (myConfig.bMapWallpaper)
733+
734+ if (myDock)
735 {
736- cairo_dock_erase_cairo_context (myDrawContext);
737-
738- pSurface = myData.pDesktopBgMapSurface;
739- fZoomX = 1. * iWidth / iWidth;
740- fZoomY= 1. * iHeight / iHeight;
741- cairo_translate (myDrawContext,
742- 0.,
743- 0.);
744-
745- cairo_save (myDrawContext);
746- cairo_scale (myDrawContext,
747- fZoomX ,
748- fZoomY );
749- cairo_set_source_surface (myDrawContext,
750- pSurface,
751- 0.,
752- 0.);
753- cairo_paint(myDrawContext);
754- cairo_restore (myDrawContext);
755-
756- if (CD_APPLET_MY_CONTAINER_IS_OPENGL)
757- cairo_dock_update_icon_texture (myIcon);
758+ CD_APPLET_GET_MY_ICON_EXTENT (&iWidth, &iHeight);
759+ myData.switcher.fOneViewportHeight = (iHeight - 2 * myConfig.iLineSize - (myData.switcher.iNbLines - 1) * myConfig.iInLineSize) / myData.switcher.iNbLines; //hauteur d'un bureau/viewport sans compter les lignes exterieures et interieures.
760+ myData.switcher.fOneViewportWidth = (iWidth - 2 * myConfig.iLineSize - (myData.switcher.iNbColumns - 1) * myConfig.iInLineSize) / myData.switcher.iNbColumns; //largeur d'un bureau/viewport sans compter les lignes exterieures et interieures.
761+
762+ cairo_surface_t *pSurface = NULL;
763+ double fZoomX, fZoomY;
764+ if (myConfig.bMapWallpaper)
765+ {
766+ cairo_dock_erase_cairo_context (myDrawContext);
767+
768+ pSurface = myData.pDesktopBgMapSurface;
769+ fZoomX = 1. * iWidth / myData.iSurfaceWidth;
770+ fZoomY= 1. * iHeight / myData.iSurfaceHeight;
771+ cairo_translate (myDrawContext,
772+ 0.,
773+ 0.);
774+
775+ cairo_save (myDrawContext);
776+ cairo_scale (myDrawContext,
777+ fZoomX ,
778+ fZoomY );
779+ cairo_set_source_surface (myDrawContext,
780+ pSurface,
781+ 0.,
782+ 0.);
783+ cairo_paint(myDrawContext);
784+ cairo_restore (myDrawContext);
785+
786+ if (CD_APPLET_MY_CONTAINER_IS_OPENGL)
787+ cairo_dock_update_icon_texture (myIcon);
788+ else
789+ CD_APPLET_UPDATE_REFLECT_ON_MY_ICON;
790+ }
791 else
792- CD_APPLET_UPDATE_REFLECT_ON_MY_ICON;
793- }
794- else
795- {
796- CD_APPLET_SET_IMAGE_ON_MY_ICON (MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE);
797- }
798-
799+ {
800+ CD_APPLET_SET_IMAGE_ON_MY_ICON (MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE);
801+ }
802+ }
803+
804 if (myConfig.bDrawWindows)
805 {
806 GList *pWindowList = cairo_dock_get_current_applis_list ();
807 pWindowList = g_list_sort (pWindowList, (GCompareFunc) _compare_icons_stack_order);
808
809- //fMaxScale = (myIcon->pSubDock != NULL ? cairo_dock_get_max_scale (myIcon->pSubDock) : 1);
810- //fRatio = (myIcon->pSubDock != NULL ? myIcon->pSubDock->container.fRatio : 1);
811 CDSwitcherDesktop data;
812 int iNumDesktop=0, iNumViewportX=0, iNumViewportY=0;
813 cairo_t *pCairoContext;
814@@ -642,7 +638,7 @@
815 g_object_set (pMenuItem, "height-request", 3, NULL);
816
817 // on ajoute les fenetres du viewport au menu.
818- //g_print (" listing des fenetres du bureau (%d;%d;%d) ...\n", iNumDesktop, iNumViewportX, iNumViewportY);
819+ g_print (" listing des fenetres du bureau (%d;%d;%d) ...\n", iNumDesktop, iNumViewportX, iNumViewportY);
820 cd_switcher_foreach_window_on_viewport (iNumDesktop,
821 iNumViewportX,
822 iNumViewportY,
823
824=== modified file 'switcher/src/applet-init.c'
825--- switcher/src/applet-init.c 2011-08-09 18:08:08 +0000
826+++ switcher/src/applet-init.c 2011-11-05 21:33:25 +0000
827@@ -46,6 +46,7 @@
828
829
830 CD_APPLET_INIT_BEGIN
831+ //\_______________ Rregister the notifications we'll need
832 CD_APPLET_SET_STATIC_ICON;
833 CD_APPLET_REGISTER_FOR_CLICK_EVENT;
834 CD_APPLET_REGISTER_FOR_BUILD_MENU_EVENT;
835@@ -67,13 +68,13 @@
836 NOTIFICATION_WINDOW_ACTIVATED,
837 (CairoDockNotificationFunc) on_change_active_window,
838 CAIRO_DOCK_RUN_AFTER, myApplet);
839- if (myConfig.bCompactView)
840+ if (myConfig.bCompactView) // in this mode we need to monitor the cursor
841 {
842 cairo_dock_register_notification_on_object (myContainer,
843 NOTIFICATION_MOUSE_MOVED,
844 (CairoDockNotificationFunc) on_mouse_moved,
845 CAIRO_DOCK_RUN_AFTER, myApplet);
846- if (myDesklet)
847+ if (myDesklet) // in this mode we draw the name of the pointed desktop
848 {
849 cairo_dock_register_notification_on_object (myContainer,
850 NOTIFICATION_RENDER_DESKLET,
851@@ -90,15 +91,6 @@
852 }
853 }
854
855- ///cd_switcher_update_from_screen_geometry ();
856-
857- //\___________________ On affiche le numero du bureau courant.
858- /**if (myConfig.bDisplayNumDesk)
859- {
860- int iIndex = cd_switcher_compute_index (myData.switcher.iCurrentDesktop, myData.switcher.iCurrentViewportX, myData.switcher.iCurrentViewportY);
861- CD_APPLET_SET_QUICK_INFO_ON_MY_ICON_PRINTF ("%d", iIndex+1);
862- }*/
863-
864 //\___________________ load the desktops with a delay (because it's quite heavy and because the desktop may not be up-to-date at the very beginning of the session).
865 if (myDesklet)
866 CD_APPLET_SET_DESKLET_RENDERER ("Simple");
867@@ -107,7 +99,7 @@
868
869
870 CD_APPLET_STOP_BEGIN
871- //\_______________ On se desabonne de nos notifications.
872+ //\_______________ Discard the pending drawings.
873 if (myData.iSidRedrawMainIconIdle != 0)
874 {
875 g_source_remove (myData.iSidRedrawMainIconIdle);
876@@ -116,8 +108,10 @@
877 {
878 g_source_remove (myData.iSidUpdateIdle);
879 }
880- if (myData.iSidPainIcons != 0)
881- g_source_remove (myData.iSidPainIcons);
882+ ///if (myData.iSidPainIcons != 0)
883+ /// g_source_remove (myData.iSidPainIcons);
884+
885+ //\_______________ Unregister notifications
886 CD_APPLET_UNREGISTER_FOR_CLICK_EVENT;
887 CD_APPLET_UNREGISTER_FOR_BUILD_MENU_EVENT;
888 CD_APPLET_UNREGISTER_FOR_MIDDLE_CLICK_EVENT;
889@@ -156,6 +150,7 @@
890 myData.iSidRedrawMainIconIdle = 0;
891 }
892
893+ // if our size has changed, re-compute the grid.
894 if (myData.iSidUpdateIdle == 0)
895 {
896 cd_switcher_compute_nb_lines_and_columns ();
897@@ -177,6 +172,7 @@
898 }
899 }
900
901+ // in case our container or our mode has changed (desklet <-> dock, compact <-> expanded), register to the needed notifications.
902 cairo_dock_remove_notification_func_on_object (CD_APPLET_MY_OLD_CONTAINER,
903 NOTIFICATION_MOUSE_MOVED,
904 (CairoDockNotificationFunc) on_mouse_moved, myApplet);
905@@ -226,7 +222,7 @@
906 cd_switcher_load_icons ();
907 }
908 }
909- else if (myData.iSidUpdateIdle == 0)
910+ else if (myData.iSidUpdateIdle == 0) // if only our size has changed, re-load the images.
911 {
912 if (myConfig.bMapWallpaper) // on recharge le wallpaper a la taille de l'applet.
913 {
914@@ -234,10 +230,11 @@
915 }
916 if (myData.pDesktopBgMapSurface == NULL)
917 cd_switcher_load_default_map_surface ();
918- if (! myConfig.bCompactView)
919- cd_switcher_trigger_paint_icons ();
920+ ///if (! myConfig.bCompactView)
921+ /// cd_switcher_trigger_paint_icons ();
922 }
923
924+ // redraw.
925 if (myData.iSidUpdateIdle == 0)
926 cd_switcher_draw_main_icon ();
927 CD_APPLET_RELOAD_END
928
929=== modified file 'switcher/src/applet-load-icons.c'
930--- switcher/src/applet-load-icons.c 2011-09-26 12:56:12 +0000
931+++ switcher/src/applet-load-icons.c 2011-11-05 21:33:25 +0000
932@@ -25,6 +25,16 @@
933 #include "applet-load-icons.h"
934
935
936+static void _load_desktop_icon (Icon *pIcon)
937+{
938+ int iWidth = pIcon->iImageWidth;
939+ int iHeight = pIcon->iImageHeight;
940+
941+ pIcon->pIconBuffer = cairo_dock_duplicate_surface (myData.pDesktopBgMapSurface,
942+ myData.iSurfaceWidth, myData.iSurfaceHeight,
943+ iWidth, iHeight);
944+}
945+
946 static GList * _load_icons (void)
947 {
948 GList *pIconList = NULL;
949@@ -52,6 +62,11 @@
950 }
951 pIcon->cParentDockName = g_strdup (myIcon->cName);
952
953+ if (myConfig.bMapWallpaper)
954+ {
955+ pIcon->iface.load_image = _load_desktop_icon;
956+ }
957+
958 pIconList = g_list_append (pIconList, pIcon);
959 }
960
961@@ -96,15 +111,14 @@
962 GList *pIconList = _load_icons ();
963
964 //\_______________________ On charge la nouvelle liste.
965- ///gpointer pConfig[2] = {GINT_TO_POINTER (myConfig.bDesklet3D), GINT_TO_POINTER (FALSE)};
966 CD_APPLET_LOAD_MY_ICONS_LIST (pIconList, myConfig.cRenderer, "Slide", NULL);
967
968 //\_______________________ On peint les icones.
969- cd_switcher_trigger_paint_icons ();
970+ ///cd_switcher_trigger_paint_icons ();
971 }
972 }
973
974-void cd_switcher_paint_icons (void)
975+/**void cd_switcher_paint_icons (void)
976 {
977 //\_______________________ On applique la surface.
978 CairoContainer *pContainer = CD_APPLET_MY_ICONS_LIST_CONTAINER;
979@@ -153,11 +167,10 @@
980 }
981 }
982
983-
984 static gboolean _paint_icons (gpointer data)
985 {
986 CD_APPLET_ENTER;
987- if (myConfig.bCompactView)
988+ if (! myConfig.bCompactView)
989 cd_switcher_paint_icons ();
990 myData.iSidPainIcons = 0;
991 CD_APPLET_LEAVE (FALSE);
992@@ -167,14 +180,14 @@
993 if (myData.iSidPainIcons != 0) // on la lance en idle, car les icones sont chargees en idle.
994 g_source_remove (myData.iSidPainIcons);
995 myData.iSidPainIcons = g_idle_add ((GSourceFunc)_paint_icons, NULL);
996-}
997+}*/
998
999
1000 void cd_switcher_load_desktop_bg_map_surface (void)
1001 {
1002+ // get the background surface
1003 CairoDockDesktopBackground *db = cairo_dock_get_desktop_background (FALSE); // FALSE <=> sans texture.
1004 cairo_surface_t *pBgSurface = cairo_dock_get_desktop_bg_surface (db);
1005- cd_debug ("on a recupere le fond d'ecran (%x)", pBgSurface);
1006
1007 if (myData.pDesktopBgMapSurface != NULL)
1008 cairo_surface_destroy (myData.pDesktopBgMapSurface);
1009@@ -185,16 +198,23 @@
1010 cairo_dock_destroy_desktop_background (db);
1011 return ;
1012 }
1013- int iWidth, iHeight;
1014- CD_APPLET_GET_MY_ICON_EXTENT (&iWidth, &iHeight);
1015- cd_debug ("%s (%dx%d)", __func__, iWidth, iHeight);
1016-
1017- cairo_t *pCairoContext = cairo_dock_create_context_from_container (myContainer);
1018+
1019+ // load it at a decent size.
1020+ if (myDock)
1021+ {
1022+ CD_APPLET_GET_MY_ICON_EXTENT (&myData.iSurfaceWidth, &myData.iSurfaceHeight);
1023+ }
1024+ else
1025+ {
1026+ myData.iSurfaceWidth = myContainer->iWidth / myData.switcher.iNbViewportTotal;
1027+ myData.iSurfaceHeight = myContainer->iHeight / myData.switcher.iNbViewportTotal;
1028+ }
1029+ g_print ("%s (%dx%d)\n", __func__, myData.iSurfaceWidth, myData.iSurfaceHeight);
1030+
1031 myData.pDesktopBgMapSurface = cairo_dock_duplicate_surface (pBgSurface,
1032 g_desktopGeometry.iXScreenWidth[CAIRO_DOCK_HORIZONTAL], g_desktopGeometry.iXScreenHeight[CAIRO_DOCK_HORIZONTAL],
1033- iWidth, iHeight);
1034+ myData.iSurfaceWidth, myData.iSurfaceHeight);
1035
1036- cairo_destroy (pCairoContext);
1037 cairo_dock_destroy_desktop_background (db);
1038 }
1039
1040@@ -202,6 +222,17 @@
1041 {
1042 if (myData.pDefaultMapSurface != NULL)
1043 cairo_surface_destroy (myData.pDefaultMapSurface);
1044- cd_debug ("%s (%.2fx%.2f)", __func__, myIcon->fWidth, myIcon->fHeight);
1045- myData.pDefaultMapSurface = CD_APPLET_LOAD_SURFACE_FOR_MY_APPLET (myConfig.cDefaultIcon);
1046+ if (myDock)
1047+ {
1048+ CD_APPLET_GET_MY_ICON_EXTENT (&myData.iSurfaceWidth, &myData.iSurfaceHeight);
1049+ }
1050+ else
1051+ {
1052+ myData.iSurfaceWidth = myContainer->iWidth / myData.switcher.iNbViewportTotal;
1053+ myData.iSurfaceHeight = myContainer->iHeight / myData.switcher.iNbViewportTotal;
1054+ }
1055+ g_print ("%s (%dx%d)\n", __func__, myData.iSurfaceWidth, myData.iSurfaceHeight);
1056+ myData.pDefaultMapSurface = cairo_dock_create_surface_from_image_simple (myConfig.cDefaultIcon,
1057+ myData.iSurfaceWidth,
1058+ myData.iSurfaceHeight);
1059 }
1060
1061=== modified file 'switcher/src/applet-load-icons.h'
1062--- switcher/src/applet-load-icons.h 2010-08-10 00:05:57 +0000
1063+++ switcher/src/applet-load-icons.h 2011-11-05 21:33:25 +0000
1064@@ -28,8 +28,8 @@
1065
1066 void cd_switcher_load_icons (void);
1067
1068-void cd_switcher_paint_icons (void);
1069-void cd_switcher_trigger_paint_icons (void);
1070+///void cd_switcher_paint_icons (void);
1071+///void cd_switcher_trigger_paint_icons (void);
1072
1073 void cd_switcher_load_desktop_bg_map_surface (void);
1074 void cd_switcher_load_default_map_surface (void);
1075
1076=== modified file 'switcher/src/applet-struct.h'
1077--- switcher/src/applet-struct.h 2011-10-03 15:13:15 +0000
1078+++ switcher/src/applet-struct.h 2011-11-05 21:33:25 +0000
1079@@ -82,10 +82,12 @@
1080 SwitcherApplet switcher;
1081 cairo_surface_t *pDefaultMapSurface;
1082 cairo_surface_t *pDesktopBgMapSurface;
1083+ gint iSurfaceWidth;
1084+ gint iSurfaceHeight;
1085 gint iSidRedrawMainIconIdle;
1086 gint iSidUpdateIdle;
1087 gint iPrevIndexHovered;
1088 gdouble fDesktopNameAlpha;
1089- guint iSidPainIcons;
1090+ ///guint iSidPainIcons;
1091 } ;
1092 #endif

Subscribers

People subscribed via source and target branches