~ubuntu-branches/ubuntu/saucy/cairo-dock-plug-ins/saucy-proposed

« back to all changes in this revision

Viewing changes to netspeed/src/applet-init.c

  • Committer: Package Import Robot
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2012-08-19 00:37:51 UTC
  • mfrom: (1.1.23)
  • Revision ID: package-import@ubuntu.com-20120819003751-rcy2836qb5jfj31i
Tags: 3.0.99.beta1-0ubuntu1
* New upstream beta release.
* Upstream ChangeLog (main changes):
 - Better integration of Unity: support of the Launcher API and better
    support of indicators
 - All configuration windows have been merged into a single one.
 - Added progress bars in several applets and in the Dbus API
 - The Music Player applet can control players in the systray.
 - Icons of the taskbar can be separated from launchers or not
 - And as always ... various bug fixes and improvements :-)
* Fixed one bug reported on Launchpad:
 - Bookmark name in thunar wrong when shortcut added on plugin (LP: #995634)
* debian: Used 'wrap-and-sort' tool
* debian/control:
 - Bump Cairo-Dock version
 - Updated my email address
* debian/rules:
 - Added Disks, Global-Menu and Doncky applets.
* debian/cairo-dock-plug-ins.install:
 - Added 'appmenu-registrar' ('Global-Menu' applet)
    and 'cairo-dock-unity-bridge' ('Dbus' applet)

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
 
37
37
static void _set_data_renderer (CairoDockModuleInstance *myApplet, gboolean bReload)
38
38
{
39
 
        CairoDataRendererAttribute *pRenderAttr = NULL;  // les attributs generiques du data-renderer.
 
39
        if (myConfig.iDisplayType == CD_NETSPEED_BAR)
 
40
                return; /// TODO
 
41
 
 
42
        CairoDataRendererAttribute *pRenderAttr = NULL;  // attributes for the global data-renderer.
 
43
        CairoGaugeAttribute aGaugeAttr;  // gauge attributes.
 
44
        CairoGraphAttribute aGraphAttr;  // graph attributes.
40
45
        if (myConfig.iDisplayType == CD_NETSPEED_GAUGE)
41
46
        {
42
 
                CairoGaugeAttribute attr;  // les attributs de la jauge.
43
 
                memset (&attr, 0, sizeof (CairoGaugeAttribute));
44
 
                pRenderAttr = CAIRO_DATA_RENDERER_ATTRIBUTE (&attr);
 
47
                memset (&aGaugeAttr, 0, sizeof (CairoGaugeAttribute));
 
48
                pRenderAttr = CAIRO_DATA_RENDERER_ATTRIBUTE (&aGaugeAttr);
45
49
                pRenderAttr->cModelName = "gauge";
46
50
                pRenderAttr->iRotateTheme = myConfig.iRotateTheme;
47
 
                attr.cThemePath = myConfig.cGThemePath;
 
51
                aGaugeAttr.cThemePath = myConfig.cGThemePath;
48
52
        }
49
53
        else if (myConfig.iDisplayType == CD_NETSPEED_GRAPH)
50
54
        {
51
 
                CairoGraphAttribute attr;  // les attributs du graphe.
52
 
                memset (&attr, 0, sizeof (CairoGraphAttribute));
53
 
                pRenderAttr = CAIRO_DATA_RENDERER_ATTRIBUTE (&attr);
 
55
                memset (&aGraphAttr, 0, sizeof (CairoGraphAttribute));
 
56
                pRenderAttr = CAIRO_DATA_RENDERER_ATTRIBUTE (&aGraphAttr);
54
57
                pRenderAttr->cModelName = "graph";
55
58
                int w, h;
56
59
                CD_APPLET_GET_MY_ICON_EXTENT (&w, &h);
57
60
                pRenderAttr->iMemorySize = (w > 1 ? w : 32);
58
 
                attr.iType = myConfig.iGraphType;
59
 
                attr.bMixGraphs = myConfig.bMixGraph;
 
61
                aGraphAttr.iType = myConfig.iGraphType;
 
62
                aGraphAttr.bMixGraphs = myConfig.bMixGraph;
60
63
                double fHighColor[CD_NETSPEED_NB_MAX_VALUES*3];
61
64
                double fLowColor[CD_NETSPEED_NB_MAX_VALUES*3];
62
65
                int i = 0;
65
68
                i ++;
66
69
                memcpy (&fHighColor[3*i], myConfig.fHigholor, 3*sizeof (double));
67
70
                memcpy (&fLowColor[3*i], myConfig.fLowColor, 3*sizeof (double));
68
 
                attr.fHighColor = fHighColor;
69
 
                attr.fLowColor = fLowColor;
70
 
                memcpy (attr.fBackGroundColor, myConfig.fBgColor, 4*sizeof (double));
71
 
        }
72
 
        else if (myConfig.iDisplayType == CD_NETSPEED_BAR)
73
 
        {
74
 
                /// A FAIRE...
75
 
        }
76
 
        if (pRenderAttr != NULL)  // attributs generiques.
77
 
        {
78
 
                pRenderAttr->iLatencyTime = myConfig.iCheckInterval * 1000 * myConfig.fSmoothFactor;
79
 
                pRenderAttr->iNbValues = 2;
80
 
                pRenderAttr->bUpdateMinMax = TRUE;
81
 
                if (myConfig.iInfoDisplay == CAIRO_DOCK_INFO_ON_ICON)
82
 
                {
83
 
                        pRenderAttr->bWriteValues = TRUE;
84
 
                        pRenderAttr->format_value = (CairoDataRendererFormatValueFunc)cd_netspeed_format_value;
85
 
                        pRenderAttr->pFormatData = myApplet;
86
 
                }
87
 
                const gchar *labels[2] = {"DOWN", "UP"};
88
 
                pRenderAttr->cLabels = (gchar **)labels;
89
 
                if (! bReload)
90
 
                        CD_APPLET_ADD_DATA_RENDERER_ON_MY_ICON (pRenderAttr);
91
 
                else
92
 
                        CD_APPLET_RELOAD_MY_DATA_RENDERER (pRenderAttr);
93
 
        }
 
71
                aGraphAttr.fHighColor = fHighColor;
 
72
                aGraphAttr.fLowColor = fLowColor;
 
73
                memcpy (aGraphAttr.fBackGroundColor, myConfig.fBgColor, 4*sizeof (double));
 
74
        }
 
75
 
 
76
        pRenderAttr->iLatencyTime = myConfig.iCheckInterval * 1000 * myConfig.fSmoothFactor;
 
77
        pRenderAttr->iNbValues = 2;
 
78
        pRenderAttr->bUpdateMinMax = TRUE;
 
79
        if (myConfig.iInfoDisplay == CAIRO_DOCK_INFO_ON_ICON)
 
80
        {
 
81
                pRenderAttr->bWriteValues = TRUE;
 
82
                pRenderAttr->format_value = (CairoDataRendererFormatValueFunc)cd_netspeed_format_value;
 
83
                pRenderAttr->pFormatData = myApplet;
 
84
        }
 
85
        const gchar *labels[2] = {"DOWN", "UP"};
 
86
        pRenderAttr->cLabels = (gchar **)labels;
 
87
        CD_APPLET_ADD_DATA_RENDERER_ON_MY_ICON (pRenderAttr);
94
88
}
95
89
 
96
90
CD_APPLET_INIT_BEGIN
151
145
                cairo_dock_relaunch_task_immediately (myData.pPeriodicTask, myConfig.iCheckInterval);
152
146
        }
153
147
        else {  // on redessine juste l'icone.
154
 
                CD_APPLET_RELOAD_MY_DATA_RENDERER (NULL);
 
148
                //CD_APPLET_RELOAD_MY_DATA_RENDERER (NULL);
155
149
                if (myConfig.iDisplayType == CD_NETSPEED_GRAPH)
156
150
                        CD_APPLET_SET_MY_DATA_RENDERER_HISTORY_TO_MAX;
157
151
                
158
 
                if (! cairo_dock_task_is_running (myData.pPeriodicTask))
159
 
                        cd_netspeed_update_from_data (myApplet);
 
152
                /**if (! cairo_dock_task_is_running (myData.pPeriodicTask))
 
153
                        cd_netspeed_update_from_data (myApplet);*/
160
154
        }
161
155
CD_APPLET_RELOAD_END