コード例 #1
0
CDAppletIndicator *cd_indicator_new (GldiModuleInstance *pApplet, const gchar *cBusName, const gchar *cServiceObject, const gchar *cServiceInterface, const gchar *cMenuObject, int iVersion)
{
    if (!s_bIndicatorIconThemeAdded)
    {
        s_bIndicatorIconThemeAdded = TRUE;
        cairo_dock_add_path_to_icon_theme (INDICATOR_ICONS_DIR);  /// maybe we should add it back when the icons manager is reloaded ?...
    }
    CDAppletIndicator *pIndicator = g_new0 (CDAppletIndicator, 1);
    pIndicator->pApplet = pApplet;
    pIndicator->cBusName = cBusName;
    pIndicator->cServiceObject = cServiceObject;
    pIndicator->cServiceInterface = cServiceInterface;
    pIndicator->cMenuObject = cMenuObject;

    pIndicator->service = indicator_service_manager_new_version ((gchar*)cBusName, iVersion);
    g_object_weak_ref (G_OBJECT (pIndicator->service),
                       (GWeakNotify)_on_service_destroyed,
                       pIndicator);  // most probably useless, but let's be parano, since we're using the dreadful "libindicator" :p

    g_signal_connect (G_OBJECT(pIndicator->service), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_changed), pIndicator);  // on sera appele une fois la connexion etablie.  // pour le cast, cf plus haut.

    // indicators don't send the 'connection-change' signal if the connection couldn't be done, so we have to handle this case ourselves.
    pIndicator->iSidCheckIndicator = g_timeout_add_seconds (3, (GSourceFunc)_check_indicator, pIndicator);

    return pIndicator;
}
gboolean
delay_start (gpointer data)
{
	g_debug("Starting Manager");

	goodis = indicator_service_manager_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD);
	g_signal_connect(G_OBJECT(goodis), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_good), NULL);

	g_timeout_add_seconds(1, timeout, NULL);

	return FALSE;
}