~ubuntu-branches/ubuntu/vivid/cairo-dock-plug-ins/vivid

« back to all changes in this revision

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

  • Committer: Matthieu Baerts
  • Date: 2013-08-27 14:46:47 UTC
  • mto: (53.1.4 cairo-dock-plug-ins)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: matttbe@gmail.com-20130827144647-wm0kyawa8vcg0cso
Tags: upstream-3.2.99.beta1.1~20130827~bzr2928
ImportĀ upstreamĀ versionĀ 3.2.99.beta1.1~20130827~bzr2928

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
CD_APPLET_DEFINE_END
41
41
 
42
42
 
43
 
static void _set_data_renderer (CairoDockModuleInstance *myApplet, gboolean bReload)
 
43
static void _set_data_renderer (GldiModuleInstance *myApplet, gboolean bReload)
44
44
{
45
45
        CairoDataRendererAttribute *pRenderAttr = NULL;  // attributes for the global data-renderer.
46
46
        CairoGaugeAttribute aGaugeAttr;  // gauge attributes.
63
63
                        pRenderAttr->cModelName = "graph";
64
64
                        int w, h;
65
65
                        CD_APPLET_GET_MY_ICON_EXTENT (&w, &h);
66
 
                        pRenderAttr->iMemorySize = (w > 1 ? w : 32);  // fWidth peut etre <= 1 en mode desklet au chargement.  // fWidht peut etre <= 1 en mode desklet au chargement.
 
66
                        pRenderAttr->iMemorySize = (w > 1 ? w : 32);  // fWidth can be <= 1 in desklet mode when loading it
67
67
                        aGraphAttr.iType = myConfig.iGraphType;
68
68
                        aGraphAttr.fHighColor = myConfig.fHigholor;
69
69
                        aGraphAttr.fLowColor = myConfig.fLowColor;
89
89
        }
90
90
}
91
91
 
 
92
static void _set_iwconfig_path (GldiModuleInstance *myApplet)
 
93
{
 
94
        gchar *cResult = cairo_dock_launch_command_sync ("which iwconfig");
 
95
        if (cResult != NULL && *cResult == '/')
 
96
                myData.cIWConfigPath = cResult;
 
97
        else
 
98
        {
 
99
                g_free (cResult);
 
100
                // if '/sbin' is not in $PATH
 
101
                myData.cIWConfigPath = g_strdup ("/sbin/iwconfig");
 
102
        }
 
103
}
 
104
 
92
105
CD_APPLET_INIT_BEGIN
93
106
        if (myDesklet != NULL)
94
107
        {
96
109
                CD_APPLET_ALLOW_NO_CLICKABLE_DESKLET;
97
110
        }
98
111
        
99
 
        // Initialisation du rendu.
 
112
        // Renderer Init
100
113
        _set_data_renderer (myApplet, FALSE);
101
 
        
102
 
        // Initialisation de la tache periodique de mesure.
103
 
        myData.iPreviousQuality = -2;  // force le dessin.
 
114
 
 
115
        // check iwconfig path
 
116
        _set_iwconfig_path (myApplet);
 
117
 
 
118
        // Initialisation of the periodic task
 
119
        myData.iPreviousQuality = -2;  // force a redraw.
104
120
        myData.pTask = cairo_dock_new_task (myConfig.iCheckInterval,
105
121
                (CairoDockGetDataAsyncFunc) cd_wifi_get_data,
106
122
                (CairoDockUpdateSyncFunc) cd_wifi_update_from_data,