static void _set_data_renderer (GldiModuleInstance *myApplet) { CairoDataRendererAttribute *pRenderAttr = NULL; // attributes for the global data-renderer. CairoGaugeAttribute aGaugeAttr; // gauge attributes. CairoGraphAttribute aGraphAttr; // graph attributes. double fHighColor[CD_DISKS_NB_MAX_VALUES*3]; // attributes for the graph double fLowColor[CD_DISKS_NB_MAX_VALUES*3]; // (but have to be declared here to force GCC to keep data) if (myConfig.iDisplayType == CD_DISKS_GAUGE) { memset (&aGaugeAttr, 0, sizeof (CairoGaugeAttribute)); pRenderAttr = CAIRO_DATA_RENDERER_ATTRIBUTE (&aGaugeAttr); pRenderAttr->cModelName = "gauge"; pRenderAttr->iRotateTheme = myConfig.iRotateTheme; aGaugeAttr.cThemePath = myConfig.cGThemePath; } else if (myConfig.iDisplayType == CD_DISKS_GRAPH) { memset (&aGraphAttr, 0, sizeof (CairoGraphAttribute)); pRenderAttr = CAIRO_DATA_RENDERER_ATTRIBUTE (&aGraphAttr); pRenderAttr->cModelName = "graph"; pRenderAttr->iMemorySize = (myIcon->fWidth > 1 ? myIcon->fWidth : 32); // fWidth peut etre <= 1 en mode desklet au chargement. aGraphAttr.iType = myConfig.iGraphType; aGraphAttr.bMixGraphs = myConfig.bMixGraph; gsize i; for (i = 0; i < myData.iNumberDisks * 2; i+=2) { memcpy (&fHighColor[3*i], myConfig.fHigholor, 3*sizeof (double)); memcpy (&fLowColor[3*i], myConfig.fLowColor, 3*sizeof (double)); memcpy (&fHighColor[3*i+3], myConfig.fHigholor, 3*sizeof (double)); memcpy (&fLowColor[3*i+3], myConfig.fLowColor, 3*sizeof (double)); } aGraphAttr.fHighColor = fHighColor; aGraphAttr.fLowColor = fLowColor; memcpy (aGraphAttr.fBackGroundColor, myConfig.fBgColor, 4*sizeof (double)); } const gchar *labels[CD_DISKS_NB_MAX_VALUES] = {}; if (myConfig.iNumberParts > 0) { gsize i; for (i = 0; i < myConfig.iNumberParts; i++) { /// Ca non plus je suppose :) double *pSize; pSize = g_new0 (double, 1); myData.lParts = g_list_append (myData.lParts, pSize); labels[i] = myConfig.cParts[i]; } }
static void _set_data_renderer (GldiModuleInstance *myApplet) { CairoDataRendererAttribute *pRenderAttr = NULL; // generic attributes of the data-renderer. switch (myConfig.iDisplayType) { case CD_POWERMANAGER_GAUGE: { CairoGaugeAttribute *pGaugeAttr = g_new0 (CairoGaugeAttribute, 1); pRenderAttr = CAIRO_DATA_RENDERER_ATTRIBUTE (pGaugeAttr); pRenderAttr->cModelName = "gauge"; pGaugeAttr->cThemePath = myConfig.cGThemePath; } break; case CD_POWERMANAGER_GRAPH: { CairoGraphAttribute *pGraphAttr = g_new0 (CairoGraphAttribute, 1); pRenderAttr = CAIRO_DATA_RENDERER_ATTRIBUTE (pGraphAttr); pRenderAttr->cModelName = "graph"; pRenderAttr->iMemorySize = (myIcon->fWidth > 1 ? myIcon->fWidth : 32); // fWidth peut etre <= 1 en mode desklet au chargement. pGraphAttr->iType = myConfig.iGraphType; pGraphAttr->fHighColor = myConfig.fHigholor; pGraphAttr->fLowColor = myConfig.fLowColor; memcpy (pGraphAttr->fBackGroundColor, myConfig.fBgColor, 4*sizeof (double)); } break; case CD_POWERMANAGER_ICONS: { myData.iOnBatteryImage = -1; // we'll set the image when we know the current state. CairoProgressBarAttribute *pBarAttr = g_new0 (CairoProgressBarAttribute, 1); pRenderAttr = CAIRO_DATA_RENDERER_ATTRIBUTE (pBarAttr); pRenderAttr->cModelName = "progressbar"; } break; default: return; } if (myConfig.quickInfoType != 0) { pRenderAttr->bWriteValues = TRUE; pRenderAttr->format_value = (CairoDataRendererFormatValueFunc)cd_powermanager_format_value; pRenderAttr->pFormatData = myApplet; } CD_APPLET_ADD_DATA_RENDERER_ON_MY_ICON (pRenderAttr); g_free (pRenderAttr); }
void cd_shortcuts_add_progress_bar (Icon *pIcon, GldiModuleInstance *myApplet) { // set a progress bar to display the disk space CairoProgressBarAttribute attr; memset (&attr, 0, sizeof (CairoProgressBarAttribute)); if (myConfig.iDisplayType == CD_SHOW_USED_SPACE || myConfig.iDisplayType == CD_SHOW_USED_SPACE_PERCENT) { attr.bInverted = TRUE; } CairoDataRendererAttribute *pRenderAttr = CAIRO_DATA_RENDERER_ATTRIBUTE (&attr); pRenderAttr->cModelName = "progressbar"; cairo_dock_add_new_data_renderer_on_icon (pIcon, pIcon->pContainer, pRenderAttr); }
static void _set_data_renderer (CairoDockModuleInstance *myApplet, gboolean bReload) { CairoDataRendererAttribute *pRenderAttr; // les attributs du data-renderer global. if (myConfig.iDisplayType == CD_POWERMANAGER_GAUGE) { CairoGaugeAttribute attr; // les attributs de la jauge. memset (&attr, 0, sizeof (CairoGaugeAttribute)); pRenderAttr = CAIRO_DATA_RENDERER_ATTRIBUTE (&attr); pRenderAttr->cModelName = "gauge"; attr.cThemePath = myConfig.cGThemePath; } else if (myConfig.iDisplayType == CD_POWERMANAGER_GRAPH) { CairoGraphAttribute attr; // les attributs du graphe. memset (&attr, 0, sizeof (CairoGraphAttribute)); pRenderAttr = CAIRO_DATA_RENDERER_ATTRIBUTE (&attr); pRenderAttr->cModelName = "graph"; pRenderAttr->iMemorySize = (myIcon->fWidth > 1 ? myIcon->fWidth : 32); // fWidht peut etre <= 1 en mode desklet au chargement. attr.iType = myConfig.iGraphType; attr.iRadius = 10; attr.fHighColor = myConfig.fHigholor; attr.fLowColor = myConfig.fLowColor; memcpy (attr.fBackGroundColor, myConfig.fBgColor, 4*sizeof (double)); } else if (myConfig.iDisplayType == CD_POWERMANAGER_ICONS) { } if (pRenderAttr != NULL) { //pRenderAttr->bWriteValues = TRUE; if (! bReload) CD_APPLET_ADD_DATA_RENDERER_ON_MY_ICON (pRenderAttr); else CD_APPLET_RELOAD_MY_DATA_RENDERER (pRenderAttr); } }
static void _set_data_renderer (GldiModuleInstance *myApplet) { if (myConfig.iDisplayType == CD_SYSMONITOR_BAR) return; /// TODO CairoDataRendererAttribute *pRenderAttr = NULL; // attributes for the global data-renderer. CairoGaugeAttribute aGaugeAttr; // gauge attributes. CairoGraphAttribute aGraphAttr; // graph attributes. double fHighColor[CD_SYSMONITOR_NB_MAX_VALUES*3]; // attributes for the graph double fLowColor[CD_SYSMONITOR_NB_MAX_VALUES*3]; // (but have to be declared here to force GCC to keep data) int iNbValues = myConfig.bShowCpu + myConfig.bShowRam + myConfig.bShowSwap + myConfig.bShowNvidia + myConfig.bShowCpuTemp + myConfig.bShowFanSpeed; if (myConfig.iDisplayType == CD_SYSMONITOR_GAUGE) { memset (&aGaugeAttr, 0, sizeof (CairoGaugeAttribute)); pRenderAttr = CAIRO_DATA_RENDERER_ATTRIBUTE (&aGaugeAttr); pRenderAttr->cModelName = "gauge"; pRenderAttr->iRotateTheme = myConfig.iRotateTheme; aGaugeAttr.cThemePath = myConfig.cGThemePath; } else if (myConfig.iDisplayType == CD_SYSMONITOR_GRAPH) { memset (&aGraphAttr, 0, sizeof (CairoGraphAttribute)); pRenderAttr = CAIRO_DATA_RENDERER_ATTRIBUTE (&aGraphAttr); pRenderAttr->cModelName = "graph"; int w, h; CD_APPLET_GET_MY_ICON_EXTENT (&w, &h); pRenderAttr->iMemorySize = (w > 1 ? w : 32); // fWidth peut etre <= 1 en mode desklet au chargement. aGraphAttr.iType = myConfig.iGraphType; aGraphAttr.bMixGraphs = myConfig.bMixGraph; int i; for (i = 0; i < iNbValues; i ++) { memcpy (&fHighColor[3*i], myConfig.fHigholor, 3*sizeof (double)); memcpy (&fLowColor[3*i], myConfig.fLowColor, 3*sizeof (double)); } aGraphAttr.fHighColor = fHighColor; aGraphAttr.fLowColor = fLowColor; memcpy (aGraphAttr.fBackGroundColor, myConfig.fBgColor, 4*sizeof (double)); } pRenderAttr->iLatencyTime = myConfig.iCheckInterval * 1000 * myConfig.fSmoothFactor; pRenderAttr->iNbValues = iNbValues; if (myConfig.iInfoDisplay == CAIRO_DOCK_INFO_ON_ICON) { pRenderAttr->bWriteValues = TRUE; pRenderAttr->format_value = (CairoDataRendererFormatValueFunc)cd_sysmonitor_format_value; pRenderAttr->pFormatData = myApplet; } const gchar *labels[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; int i = 0; if (myConfig.bShowCpu) labels[i++] = "CPU"; if (myConfig.bShowRam) labels[i++] = "RAM"; if (myConfig.bShowSwap) labels[i++] = "SWAP"; if (myConfig.bShowNvidia) labels[i++] = "GPU"; if (myConfig.bShowCpuTemp) labels[i++] = "TEMP"; if (myConfig.bShowFanSpeed) labels[i++] = "FAN"; pRenderAttr->cLabels = (gchar **)labels; CD_APPLET_ADD_DATA_RENDERER_ON_MY_ICON (pRenderAttr); }