2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 3
10
* of the License, or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
#include <cairo-dock.h>
23
#include "applet-struct.h"
24
#include "applet-load-icon.h"
25
#include "applet-compiz.h"
28
#define MY_NB_ICON_STATE 3
29
#define MY_NB_SUB_ICONS 5
31
static const gchar *s_iconName[MY_NB_SUB_ICONS] = {N_("Configure Compiz"), N_("Emerald Manager"), N_("Reload WM"), N_("Exposition"), N_("Widget Layer")};
33
static const gchar *s_iconClass[MY_NB_SUB_ICONS] = {"ccsm", "emerald-theme-manager", NULL, NULL, NULL};
35
static const gchar *s_iconFile[MY_NB_ICON_STATE] = {"default.svg", "broken.svg", "other.svg"};
38
static GList * _list_icons (void) {
39
GList *pIconList = NULL;
43
if (myConfig.bScriptSubDock)
46
for (i = 0; i < j; i ++)
48
if (i == 1 && ! myConfig.bEmeraldIcon)
50
pIcon = cairo_dock_create_dummy_launcher (g_strdup (D_(s_iconName[i])),
51
(myConfig.cUserImage[i+MY_NB_ICON_STATE] != NULL ?
52
cairo_dock_generate_file_path (myConfig.cUserImage[i+MY_NB_ICON_STATE]) :
53
g_strdup_printf ("%s/%d.svg", MY_APPLET_SHARE_DATA_DIR, i)),
54
(s_iconClass[i] != NULL ? g_strdup (s_iconClass[i]) : g_strdup ("none")),
57
pIcon->cParentDockName = g_strdup (myIcon->cName);
58
pIconList = g_list_append (pIconList, pIcon);
59
if (myConfig.bStealTaskBarIcon && s_iconClass[i] != NULL)
61
cairo_dock_inhibite_class (s_iconClass[i], pIcon);
68
void cd_compiz_update_main_icon (void) {
69
gboolean bNeedsRedraw = FALSE;
70
if (myData.bAcquisitionOK) {
71
if (myData.bCompizIsRunning && myData.iCompizIcon != COMPIZ_DEFAULT) {
72
// //cd_debug ("COMPIZ_DEFAULT");
73
myData.iCompizIcon = COMPIZ_DEFAULT;
74
CD_APPLET_SET_USER_IMAGE_ON_MY_ICON (myConfig.cUserImage[COMPIZ_DEFAULT], "default.svg");
77
else if (! myData.bCompizIsRunning && myData.iCompizIcon != COMPIZ_OTHER) {
78
//cd_debug ("COMPIZ_OTHER");
79
myData.iCompizIcon = COMPIZ_OTHER;
80
CD_APPLET_SET_USER_IMAGE_ON_MY_ICON (myConfig.cUserImage[COMPIZ_OTHER], "other.svg");
85
if (myData.iCompizIcon != COMPIZ_BROKEN) {
86
//cd_debug ("COMPIZ_BROKEN");
87
myData.iCompizIcon = COMPIZ_BROKEN;
88
CD_APPLET_SET_USER_IMAGE_ON_MY_ICON (myConfig.cUserImage[COMPIZ_BROKEN], "broken.svg");
93
CD_APPLET_REDRAW_MY_ICON;
97
void cd_compiz_build_icons (void) {
98
if (myIcon->cName == NULL && myDock)
100
CD_APPLET_SET_NAME_FOR_MY_ICON (COMPIZ_DEFAULT_NAME);
102
GList *pIconList = _list_icons (); // ne nous appartiendra plus, donc ne pas desallouer.
104
gpointer pConfig[2] = {GINT_TO_POINTER (FALSE), GINT_TO_POINTER (FALSE)};
105
CD_APPLET_LOAD_MY_ICONS_LIST (pIconList, myConfig.cRenderer, "Caroussel", pConfig);